File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ FROM alpine:3.6 AS builder
22
33RUN apk update && apk add curl
44
5+ RUN curl -o kubectl1.14 -L https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
6+ RUN curl -o kubectl1.15 -L https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/linux/amd64/kubectl
57RUN curl -o kubectl1.10 -L https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/amd64/kubectl
68RUN curl -o kubectl1.6 -L https://storage.googleapis.com/kubernetes-release/release/v1.6.0/bin/linux/amd64/kubectl
79
@@ -10,11 +12,13 @@ FROM alpine:3.6
1012
1113RUN apk add --update bash
1214
13- # copy both versions of kubectl to switch between them later.
15+ # copy all versions of kubectl to switch between them later.
16+ COPY --from=builder kubectl1.15 /usr/local/bin/
17+ COPY --from=builder kubectl1.14 /usr/local/bin/
1418COPY --from=builder kubectl1.10 /usr/local/bin/kubectl
1519COPY --from=builder kubectl1.6 /usr/local/bin/
1620
17- RUN chmod +x /usr/local/bin/kubectl /usr/local/bin/kubectl1.6
21+ RUN chmod +x /usr/local/bin/kubectl /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl1.14 /usr/local/bin/kubectl1.15
1822
1923WORKDIR /
2024
Original file line number Diff line number Diff line change 6262# check the cluster version and decide which version of kubectl to use:
6363SERVER_VERSION=$( kubectl version --short=true --context " ${KUBECONTEXT} " | grep -i server | cut -d ' :' -f2 | cut -d ' .' -f2 | sed ' s/[^0-9]*//g' )
6464echo " Server minor version: $SERVER_VERSION "
65- if (( "$SERVER_VERSION " <= "6 " )) ; then mv /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl; fi 2> /dev/null
66-
67-
65+ if (( "$SERVER_VERSION " <= "6 " )) ; then cp -f /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl; fi 2> /dev/null
66+ if (( " $SERVER_VERSION " == " 14 " )) ; then cp -f /usr/local/bin/kubectl1.14 /usr/local/bin/kubectl ; fi 2> /dev/null
67+ if (( " $SERVER_VERSION " >= " 15 " )) ; then cp -f /usr/local/bin/kubectl1.15 /usr/local/bin/kubectl ; fi 2> /dev/null
6868[ ! -f " ${deployment_file} " ] && echo " Couldn't find $deployment_file file at $( pwd) " && exit 1;
6969
70-
7170DEPLOYMENT_FILE=${deployment_file} -$( date ' +%y-%m-%d_%H-%M-%S' ) .yml
7271$( dirname $0 ) /template.sh " $deployment_file " > " $DEPLOYMENT_FILE " || fatal " Failed to apply deployment template on $deployment_file "
7372
You can’t perform that action at this time.
0 commit comments