File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,11 @@ RUN apk add --update bash
15
15
# copy all versions of kubectl to switch between them later.
16
16
COPY --from=builder kubectl1.15 /usr/local/bin/
17
17
COPY --from=builder kubectl1.14 /usr/local/bin/
18
+ COPY --from=builder kubectl1.10 /usr/local/bin/
18
19
COPY --from=builder kubectl1.10 /usr/local/bin/kubectl
19
20
COPY --from=builder kubectl1.6 /usr/local/bin/
20
21
21
- RUN chmod +x /usr/local/bin/kubectl /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl1.14 /usr/local/bin/kubectl1.15
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
22
23
23
24
WORKDIR /
24
25
Original file line number Diff line number Diff line change 62
62
# check the cluster version and decide which version of kubectl to use:
63
63
SERVER_VERSION=$( kubectl version --short=true --context " ${KUBECONTEXT} " | grep -i server | cut -d ' :' -f2 | cut -d ' .' -f2 | sed ' s/[^0-9]*//g' )
64
64
echo " Server minor version: $SERVER_VERSION "
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
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
+
68
76
[ ! -f " ${deployment_file} " ] && echo " Couldn't find $deployment_file file at $( pwd) " && exit 1;
69
77
70
78
DEPLOYMENT_FILE=${deployment_file} -$( date ' +%y-%m-%d_%H-%M-%S' ) .yml
You can’t perform that action at this time.
0 commit comments