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
2
2
3
3
RUN apk update && apk add curl
4
4
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
5
7
RUN curl -o kubectl1.10 -L https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/amd64/kubectl
6
8
RUN curl -o kubectl1.6 -L https://storage.googleapis.com/kubernetes-release/release/v1.6.0/bin/linux/amd64/kubectl
7
9
@@ -10,11 +12,13 @@ FROM alpine:3.6
10
12
11
13
RUN apk add --update bash
12
14
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/
14
18
COPY --from=builder kubectl1.10 /usr/local/bin/kubectl
15
19
COPY --from=builder kubectl1.6 /usr/local/bin/
16
20
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
18
22
19
23
WORKDIR /
20
24
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 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
68
68
[ ! -f " ${deployment_file} " ] && echo " Couldn't find $deployment_file file at $( pwd) " && exit 1;
69
69
70
-
71
70
DEPLOYMENT_FILE=${deployment_file} -$( date ' +%y-%m-%d_%H-%M-%S' ) .yml
72
71
$( dirname $0 ) /template.sh " $deployment_file " > " $DEPLOYMENT_FILE " || fatal " Failed to apply deployment template on $deployment_file "
73
72
You can’t perform that action at this time.
0 commit comments