Skip to content

Commit de30cf9

Browse files
committed
2 parents d3d3ce3 + 7f823cd commit de30cf9

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

Dockerfile

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
FROM amazon/aws-cli
1+
FROM amazon/aws-cli:latest
22

3-
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl && \
4-
curl -L -o /usr/local/bin/aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.7/aws-iam-authenticator_0.5.7_linux_amd64 && \
5-
chmod +x /usr/local/bin/aws-iam-authenticator && \
6-
chmod +x ./kubectl && \
7-
mv ./kubectl /usr/bin/kubectl
3+
RUN yum install jq -y && curl -sL -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
4+
curl -sL -o /usr/bin/aws-iam-authenticator $(curl -s https://api.github.com/repos/kubernetes-sigs/aws-iam-authenticator/releases/latest | jq -r ' .assets[] | select(.name | contains("linux_amd64") )' | jq -r '.browser_download_url') && \
5+
chmod +x /usr/bin/aws-iam-authenticator && \
6+
chmod +x /usr/bin/kubectl
87

9-
RUN kubectl version --client
108
COPY entrypoint.sh /entrypoint.sh
119
ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

+21-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,24 @@ set -e
66
echo "$KUBE_CONFIG_DATA" | base64 -d > /tmp/config
77
export KUBECONFIG=/tmp/config
88

9-
sh -c "kubectl $*"
9+
if [ -z ${KUBECTL_VERSION+x} ] ; then
10+
echo "Using kubectl version: $(kubectl version --client --short)"
11+
else
12+
echo "Pulling kubectl for version $KUBECTL_VERSION"
13+
rm /usr/bin/kubectl
14+
curl -sL -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/"$KUBECTL_VERSION"/bin/linux/amd64/kubectl && \
15+
chmod +x /usr/bin/kubectl
16+
echo "Using kubectl version: $(kubectl version --client --short)"
17+
fi
18+
19+
if [ -z ${IAM_VERSION+x} ] ; then
20+
echo "Using aws-iam-authenticator version: $(aws-iam-authenticator version)"
21+
else
22+
echo "Pulling aws-iam-authenticator for version $IAM_VERSION"
23+
rm /usr/bin/aws-iam-authenticator
24+
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 && \
25+
chmod +x /usr/bin/aws-iam-authenticator
26+
echo "Using aws-iam-authenticator version: $(aws-iam-authenticator version)"
27+
fi
28+
29+
sh -c "kubectl $*"

0 commit comments

Comments
 (0)