-
Notifications
You must be signed in to change notification settings - Fork 128
/
entrypoint.sh
executable file
·34 lines (28 loc) · 1.23 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
set -e
# Extract the base64 encoded config data and write this to the KUBECONFIG
echo "$KUBE_CONFIG_DATA" | base64 -d > /tmp/config
export KUBECONFIG=/tmp/config
if [ -z ${KUBECTL_VERSION+x} ] ; then
echo "Using kubectl version: $(kubectl version --client)"
else
echo "Pulling kubectl for version $KUBECTL_VERSION"
rm /usr/bin/kubectl
curl -sL -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/"$KUBECTL_VERSION"/bin/linux/amd64/kubectl && \
chmod +x /usr/bin/kubectl
echo "Using kubectl version: $(kubectl version --client --short)"
fi
if [ -z ${IAM_VERSION+x} ] ; then
echo "Using aws-iam-authenticator version: $(aws-iam-authenticator version)"
else
echo "Pulling aws-iam-authenticator for version $IAM_VERSION"
rm /usr/bin/aws-iam-authenticator
curl -sL -o /usr/bin/aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v"$IAM_VERSION"/aws-iam-authenticator_"$IAM_VERSION"_linux_amd64 && \
chmod +x /usr/bin/aws-iam-authenticator
echo "Using aws-iam-authenticator version: $(aws-iam-authenticator version)"
fi
if [ -z "$RUN_COMMAND" ] ; then
sh -c "kubectl $*"
else
sh -c "kubectl $RUN_COMMAND"
fi