File tree Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,10 @@ RUN apk add --update bash
1515# copy all versions of kubectl to switch between them later.
1616COPY --from=builder kubectl1.15 /usr/local/bin/
1717COPY --from=builder kubectl1.14 /usr/local/bin/
18- COPY --from=builder kubectl1.10 /usr/local/bin/
1918COPY --from=builder kubectl1.10 /usr/local/bin/kubectl
2019COPY --from=builder kubectl1.6 /usr/local/bin/
2120
22- RUN chmod +x /usr/local/bin/kubectl /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl1.10 /usr/local/bin/kubectl1. 14 /usr/local/bin/kubectl1.15
21+ RUN chmod +x /usr/local/bin/kubectl /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl1.14 /usr/local/bin/kubectl1.15
2322
2423WORKDIR /
2524
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
66- KUBECTL_MINOR_VERSION=6
67- elif (( "$SERVER_VERSION " <= "12 " )) ; then
68- KUBECTL_MINOR_VERSION=10
69- elif (( "$SERVER_VERSION " <= "14 " )) ; then
70- KUBECTL_MINOR_VERSION=14
71- elif (( "$SERVER_VERSION " >= "15 " )) ; then
72- KUBECTL_MINOR_VERSION=15
73- fi
74- cp -f /usr/local/bin/kubectl1.$KUBECTL_MINOR_VERSION /usr/local/bin/kubectl > 2> /dev/null
75-
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
7668[ ! -f " ${deployment_file} " ] && echo " Couldn't find $deployment_file file at $( pwd) " && exit 1;
7769
7870DEPLOYMENT_FILE=${deployment_file} -$( date ' +%y-%m-%d_%H-%M-%S' ) .yml
You can’t perform that action at this time.
0 commit comments