Skip to content

Commit

Permalink
feat: skip auth checking when running kustomize (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
exelban committed Jun 3, 2022
1 parent a28c700 commit 676db77
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

set -e

echo "/usr/local/bin/kubectl" >> $GITHUB_PATH

if [ ! -d "$HOME/.kube" ]; then
mkdir -p $HOME/.kube
fi

if [ ! -f "$HOME/.kube/config" ]; then
if [ ! -z "${KUBE_CONFIG}" ]; then

echo "$KUBE_CONFIG" | base64 -d > $HOME/.kube/config

if [ ! -z "${KUBE_CONTEXT}" ]; then
kubectl config use-context $KUBE_CONTEXT
fi

elif [ ! -z "${KUBE_HOST}" ]; then

echo "$KUBE_CERTIFICATE" | base64 -d > $HOME/.kube/certificate
kubectl config set-cluster default --server=https://$KUBE_HOST --certificate-authority=$HOME/.kube/certificate > /dev/null

Expand All @@ -31,13 +30,11 @@ if [ ! -f "$HOME/.kube/config" ]; then

kubectl config set-context default --cluster=default --namespace=default --user=cluster-admin > /dev/null
kubectl config use-context default > /dev/null

elif [[ $INPUT_ARGS == "kustomize" ]]; then :;
else
echo "No authorization data found. Please provide KUBE_CONFIG or KUBE_HOST variables. Exiting..."
exit 1
fi
fi

echo "/usr/local/bin/kubectl" >> $GITHUB_PATH

kubectl $*
kubectl $INPUT_ARGS

0 comments on commit 676db77

Please sign in to comment.