#!/usr/bin/env bash # Copyright 2016 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # This script downloads and installs the Kubernetes client and server # (and optionally test) binaries, # It is intended to be called from an extracted Kubernetes release tarball. # # We automatically choose the correct client binaries to download. # # Options: # Set KUBERNETES_SERVER_ARCH to choose the server (Kubernetes cluster) # architecture to download: # * amd64 [default] # * arm # * arm64 # * ppc64le # * s390x # # Set KUBERNETES_SKIP_CONFIRM to skip the installation confirmation prompt. # Set KUBERNETES_RELEASE_URL to choose where to download binaries from. # (Defaults to https://storage.googleapis.com/kubernetes-release/release). # Set KUBERNETES_DOWNLOAD_TESTS to additionally download and extract the test # binaries tarball. set -o errexit set -o nounset set -o pipefail global KUBE_ROOT := $[cd $[dirname $(BASH_SOURCE)]/.. && pwd] global KUBERNETES_RELEASE_URL := $(KUBERNETES_RELEASE_URL:-https://dl.k8s.io) proc detect_kube_release { if [[ -n "${KUBE_VERSION:-}" ]] { return 0 # Allow caller to explicitly set version } if [[ ! -e "${KUBE_ROOT}/version" ]] { echo "Can't determine Kubernetes release." > !2 echo "$(BASH_SOURCE) should only be run from a prebuilt Kubernetes release." > !2 echo "Did you mean to use get-kube.sh instead?" > !2 exit 1 } global KUBE_VERSION := $[cat "$(KUBE_ROOT)/version] } proc detect_client_info { var kernel = $[uname -s] matchstr $(kernel) { Darwin { global CLIENT_PLATFORM := '"darwin'" } Linux { global CLIENT_PLATFORM := '"linux'" } * { echo "Unknown, unsupported platform: $(kernel)." > !2 echo "Supported platforms: Linux, Darwin." > !2 echo "Bailing out." > !2 exit 2 } } # TODO: migrate the kube::util::host_platform function out of hack/lib and # use it here. var machine = $[uname -m] matchstr $(machine) { x86_64*|i?86_64*|amd64* { global CLIENT_ARCH := '"amd64'" } aarch64*|arm64* { global CLIENT_ARCH := '"arm64'" } arm* { global CLIENT_ARCH := '"arm'" } i?86* { global CLIENT_ARCH := '"386'" } s390x* { global CLIENT_ARCH := '"s390x'" } * { echo "Unknown, unsupported architecture ($(machine))." > !2 echo "Supported architectures x86_64, i686, arm, arm64, s390x." > !2 echo "Bailing out." > !2 exit 3 } } } proc md5sum_file { if which md5 >/dev/null !2 > !1 { md5 -q $1 } else { md5sum $1 | awk '{ print $1 }' } } proc sha1sum_file { if which sha1sum >/dev/null !2 > !1 { sha1sum $1 | awk '{ print $1 }' } else { shasum -a1 $1 | awk '{ print $1 }' } } proc download_tarball { var -r download_path = $1 var -r file = $2 global url := ""$(DOWNLOAD_URL_PREFIX)/$(file)"" mkdir -p $(download_path) if [[ $(which curl) ]] { curl -fL --retry 3 --keepalive-time 2 $(url) -o "$(download_path)/$(file)" } elif [[ $(which wget) ]] { wget $(url) -O "$(download_path)/$(file)" } else { echo "Couldn't find curl or wget. Bailing out." > !2 exit 4 } echo var md5sum = $[md5sum_file "$(download_path)/$(file)] echo "md5sum($(file))=$(md5sum)" var sha1sum = $[sha1sum_file "$(download_path)/$(file)] echo "sha1sum($(file))=$(sha1sum)" echo # TODO: add actual verification } proc extract_arch_tarball { var -r tarfile = $1 var -r platform = $2 var -r arch = $3 global platforms_dir := ""$(KUBE_ROOT)/platforms/$(platform)/$(arch)"" echo "Extracting $(tarfile) into $(platforms_dir)" mkdir -p $(platforms_dir) # Tarball looks like kubernetes/{client,server}/bin/BINARY" tar -xzf $(tarfile) --strip-components 3 -C $(platforms_dir) # Create convenience symlink ln -sf $(platforms_dir) "$[dirname $(tarfile)]/bin" echo "Add '$[dirname $(tarfile)]/bin' to your PATH to use newly-installed binaries." } detect_kube_release global DOWNLOAD_URL_PREFIX := ""$(KUBERNETES_RELEASE_URL)/$(KUBE_VERSION)"" global SERVER_PLATFORM := '"linux'" global SERVER_ARCH := $(KUBERNETES_SERVER_ARCH:-amd64) global SERVER_TAR := ""kubernetes-server-$(SERVER_PLATFORM)-$(SERVER_ARCH).tar.gz"" detect_client_info global CLIENT_TAR := ""kubernetes-client-$(CLIENT_PLATFORM)-$(CLIENT_ARCH).tar.gz"" echo "Kubernetes release: $(KUBE_VERSION)" echo "Server: $(SERVER_PLATFORM)/$(SERVER_ARCH) (to override, set KUBERNETES_SERVER_ARCH)" echo "Client: $(CLIENT_PLATFORM)/$(CLIENT_ARCH) (autodetected)" echo # TODO: remove this check and default to true when we stop shipping server # tarballs in kubernetes.tar.gz global DOWNLOAD_SERVER_TAR := 'false' if [[ ! -e "${KUBE_ROOT}/server/${SERVER_TAR}" ]] { global DOWNLOAD_SERVER_TAR := 'true' echo "Will download $(SERVER_TAR) from $(DOWNLOAD_URL_PREFIX)" } # TODO: remove this check and default to true when we stop shipping kubectl # in kubernetes.tar.gz global DOWNLOAD_CLIENT_TAR := 'false' if [[ ! -x "${KUBE_ROOT}/platforms/${CLIENT_PLATFORM}/${CLIENT_ARCH}/kubectl" ]] { global DOWNLOAD_CLIENT_TAR := 'true' echo "Will download and extract $(CLIENT_TAR) from $(DOWNLOAD_URL_PREFIX)" } global TESTS_TAR := '"kubernetes-test.tar.gz'" global DOWNLOAD_TESTS_TAR := 'false' if [[ -n "${KUBERNETES_DOWNLOAD_TESTS-}" ]] { global DOWNLOAD_TESTS_TAR := 'true' echo "Will download and extract $(TESTS_TAR) from $(DOWNLOAD_URL_PREFIX)" } if [[ "${DOWNLOAD_CLIENT_TAR}" == false && \ "${DOWNLOAD_SERVER_TAR}" == false && \ "${DOWNLOAD_TESTS_TAR}" == false ]] { echo "Nothing additional to download." exit 0 } if [[ -z "${KUBERNETES_SKIP_CONFIRM-}" ]] { echo "Is this ok? [Y]/n" read confirm if [[ "${confirm}" =~ ^[nN]$ ]] { echo "Aborting." exit 1 } } if $(DOWNLOAD_SERVER_TAR) { download_tarball "$(KUBE_ROOT)/server" $(SERVER_TAR) } if $(DOWNLOAD_CLIENT_TAR) { download_tarball "$(KUBE_ROOT)/client" $(CLIENT_TAR) extract_arch_tarball "$(KUBE_ROOT)/client/$(CLIENT_TAR)" $(CLIENT_PLATFORM) $(CLIENT_ARCH) } if $(DOWNLOAD_TESTS_TAR) { download_tarball "$(KUBE_ROOT)/test" $(TESTS_TAR) echo "Extracting $(TESTS_TAR) into $(KUBE_ROOT)" # Strip leading "kubernetes/" tar -xzf "$(KUBE_ROOT)/test/$(TESTS_TAR)" --strip-components 1 -C $(KUBE_ROOT) } (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_ROOT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (C {(cd)} { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [128 136] ) (/..) } ) (C {(pwd)}) ] op_id: Op_DAmp ) ] ) left_token: spids: [125 142] ) } spids: [124] ) ] spids: [124] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBERNETES_RELEASE_URL) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {("https:") (Lit_Slash /) (Lit_Slash /) (dl.k8s.io)} ) spids: [147 154] ) ) } spids: [145] ) ] spids: [145] ) (FuncDef name: detect_kube_release body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_n child: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [174 177] ) ) } ) ) terminator: ) ] action: [(ControlFlow token: arg_word:{(0)})] spids: [-1 183] ) ] spids: [-1 194] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id: BoolUnary_e child: {(DQ (${ VSub_Name KUBE_ROOT) (/version))} ) ) ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Can't determine Kubernetes release."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[225])] ) (SimpleCommand words: [ {(echo)} { (DQ (${ VSub_Name BASH_SOURCE) (" should only be run from a prebuilt Kubernetes release.") ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[238])] ) (SimpleCommand words: [{(echo)} {(DQ ("Did you mean to use get-kube.sh instead?"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[248])] ) (C {(exit)} {(1)}) ] spids: [-1 216] ) ] spids: [-1 257] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_VERSION) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(cat)} {(DQ (${ VSub_Name KUBE_ROOT) (/version))})] ) left_token: spids: [262 271] ) } spids: [261] ) ] spids: [261] ) ] spids: [164] ) spids: [158 163] ) (FuncDef name: detect_client_info body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:kernel) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(uname)} {(-s)})]) left_token: spids: [288 292] ) } spids: [287] ) ] spids: [285] ) (Case to_match: {(DQ (${ VSub_Name kernel))} arms: [ (case_arm pat_list: [{(Darwin)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CLIENT_PLATFORM) op: Equal rhs: {(DQ (darwin))} spids: [310] ) ] spids: [310] ) ] spids: [306 307 316 -1] ) (case_arm pat_list: [{(Linux)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CLIENT_PLATFORM) op: Equal rhs: {(DQ (linux))} spids: [323] ) ] spids: [323] ) ] spids: [319 320 329 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (SimpleCommand words: [ {(echo)} {(DQ ("Unknown, unsupported platform: ") (${ VSub_Name kernel) (.))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[346])] ) (SimpleCommand words: [{(echo)} {(DQ ("Supported platforms: Linux, Darwin."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[356])] ) (SimpleCommand words: [{(echo)} {(DQ ("Bailing out."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[366])] ) (C {(exit)} {(2)}) ] spids: [332 333 -1 375] ) ] spids: [295 303 375] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:machine) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(uname)} {(-m)})]) left_token: spids: [390 394] ) } spids: [389] ) ] spids: [387] ) (Case to_match: {(DQ (${ VSub_Name machine))} arms: [ (case_arm pat_list: [ {(x86_64) (Lit_Other "*")} {(i) (Lit_Other "?") (86_64) (Lit_Other "*")} {(amd64) (Lit_Other "*")} ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CLIENT_ARCH) op: Equal rhs: {(DQ (amd64))} spids: [421] ) ] spids: [421] ) ] spids: [408 418 427 -1] ) (case_arm pat_list: [{(aarch64) (Lit_Other "*")} {(arm64) (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CLIENT_ARCH) op: Equal rhs: {(DQ (arm64))} spids: [438] ) ] spids: [438] ) ] spids: [430 435 444 -1] ) (case_arm pat_list: [{(arm) (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CLIENT_ARCH) op: Equal rhs: {(DQ (arm))} spids: [452] ) ] spids: [452] ) ] spids: [447 449 458 -1] ) (case_arm pat_list: [{(i) (Lit_Other "?") (86) (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CLIENT_ARCH) op: Equal rhs: {(DQ (386))} spids: [468] ) ] spids: [468] ) ] spids: [461 465 474 -1] ) (case_arm pat_list: [{(s390x) (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CLIENT_ARCH) op: Equal rhs: {(DQ (s390x))} spids: [482] ) ] spids: [482] ) ] spids: [477 479 488 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (SimpleCommand words: [ {(echo)} {(DQ ("Unknown, unsupported architecture (") (${ VSub_Name machine) (")."))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[506])] ) (SimpleCommand words: [ {(echo)} {(DQ ("Supported architectures x86_64, i686, arm, arm64, s390x."))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[516])] ) (SimpleCommand words: [{(echo)} {(DQ ("Bailing out."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[526])] ) (C {(exit)} {(3)}) ] spids: [492 493 535 -1] ) ] spids: [397 405 538] ) ] spids: [282] ) spids: [276 281] ) (FuncDef name: md5sum_file body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [{(which)} {(md5)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [558] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [561] ) ] ) terminator: ) ] action: [(C {(md5)} {(-q)} {(DQ ($ VSub_Number "$1"))})] spids: [-1 565] ) ] else_action: [ (Pipeline children: [ (C {(md5sum)} {(DQ ($ VSub_Number "$1"))}) (C {(awk)} {(SQ <"{ print $1 }">)}) ] negated: False ) ] spids: [577 595] ) ] spids: [549] ) spids: [543 548] ) (FuncDef name: sha1sum_file body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [{(which)} {(sha1sum)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [615] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [618] ) ] ) terminator: ) ] action: [ (Pipeline children: [ (C {(sha1sum)} {(DQ ($ VSub_Number "$1"))}) (C {(awk)} {(SQ <"{ print $1 }">)}) ] negated: False ) ] spids: [-1 622] ) ] else_action: [ (Pipeline children: [ (C {(shasum)} {(-a1)} {(DQ ($ VSub_Number "$1"))}) (C {(awk)} {(SQ <"{ print $1 }">)}) ] negated: False ) ] spids: [640 660] ) ] spids: [606] ) spids: [600 605] ) (FuncDef name: download_tarball body: (BraceGroup children: [ (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:download_path) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [678] ) ] spids: [674] ) (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:file) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [688] ) ] spids: [684] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:url) op: Equal rhs: {(DQ (${ VSub_Name DOWNLOAD_URL_PREFIX) (/) (${ VSub_Name file))} spids: [694] ) ] spids: [694] ) (C {(mkdir)} {(-p)} {(DQ (${ VSub_Name download_path))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(curl)})]) left_token: spids: [721 725] ) } ) ) terminator: ) ] action: [ (C {(curl)} {(-fL)} {(--retry)} {(3)} {(--keepalive-time)} {(2)} {(DQ (${ VSub_Name url))} {(-o)} {(DQ (${ VSub_Name download_path) (/) (${ VSub_Name file))} ) ] spids: [-1 730] ) (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(wget)})]) left_token: spids: [768 772] ) } ) ) terminator: ) ] action: [ (C {(wget)} {(DQ (${ VSub_Name url))} {(-O)} {(DQ (${ VSub_Name download_path) (/) (${ VSub_Name file))} ) ] spids: [764 777] ) ] else_action: [ (SimpleCommand words: [{(echo)} {(DQ ("Couldn't find curl or wget. Bailing out."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[810])] ) (C {(exit)} {(4)}) ] spids: [801 819] ) (C {(echo)}) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:md5sum) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(md5sum_file)} {(DQ (${ VSub_Name download_path) (/) (${ VSub_Name file))} ) ] ) left_token: spids: [828 840] ) } spids: [827] ) ] spids: [825] ) (C {(echo)} {(DQ ("md5sum(") (${ VSub_Name file) (")=") (${ VSub_Name md5sum))}) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:sha1sum) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(sha1sum_file)} {(DQ (${ VSub_Name download_path) (/) (${ VSub_Name file))} ) ] ) left_token: spids: [860 872] ) } spids: [859] ) ] spids: [857] ) (C {(echo)} {(DQ ("sha1sum(") (${ VSub_Name file) (")=") (${ VSub_Name sha1sum))}) (C {(echo)}) ] spids: [671] ) spids: [665 670] ) (FuncDef name: extract_arch_tarball body: (BraceGroup children: [ (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:tarfile) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [911] ) ] spids: [907] ) (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:platform) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [921] ) ] spids: [917] ) (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:arch) op: Equal rhs: {(DQ ($ VSub_Number "$3"))} spids: [931] ) ] spids: [927] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:platforms_dir) op: Equal rhs: { (DQ (${ VSub_Name KUBE_ROOT) (/platforms/) (${ VSub_Name platform) (/) (${ VSub_Name arch) ) } spids: [938] ) ] spids: [938] ) (C {(echo)} {(DQ ("Extracting ") (${ VSub_Name tarfile) (" into ") (${ VSub_Name platforms_dir))} ) (C {(mkdir)} {(-p)} {(DQ (${ VSub_Name platforms_dir))}) (C {(tar)} {(-xzf)} {(DQ (${ VSub_Name tarfile))} {(--strip-components)} {(3)} {(-C)} {(DQ (${ VSub_Name platforms_dir))} ) (C {(ln)} {(-sf)} {(DQ (${ VSub_Name platforms_dir))} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(dirname)} {(${ VSub_Name tarfile)})]) left_token: spids: [1021 1027] ) (/bin) ) } ) (C {(echo)} { (DQ ("Add '") (CommandSubPart command_list: (CommandList children:[(C {(dirname)} {(${ VSub_Name tarfile)})]) left_token: spids: [1036 1042] ) ("/bin' to your PATH to use newly-installed binaries.") ) } ) ] spids: [904] ) spids: [898 903] ) (C {(detect_kube_release)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DOWNLOAD_URL_PREFIX) op: Equal rhs: {(DQ (${ VSub_Name KUBERNETES_RELEASE_URL) (/) (${ VSub_Name KUBE_VERSION))} spids: [1051] ) ] spids: [1051] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SERVER_PLATFORM) op: Equal rhs: {(DQ (linux))} spids: [1063] ) ] spids: [1063] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SERVER_ARCH) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(amd64)}) spids: [1070 1074] ) ) } spids: [1068] ) ] spids: [1068] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SERVER_TAR) op: Equal rhs: { (DQ (kubernetes-server-) (${ VSub_Name SERVER_PLATFORM) (-) (${ VSub_Name SERVER_ARCH) (.tar.gz) ) } spids: [1077] ) ] spids: [1077] ) (C {(detect_client_info)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CLIENT_TAR) op: Equal rhs: { (DQ (kubernetes-client-) (${ VSub_Name CLIENT_PLATFORM) (-) (${ VSub_Name CLIENT_ARCH) (.tar.gz) ) } spids: [1093] ) ] spids: [1093] ) (C {(echo)} {(DQ ("Kubernetes release: ") (${ VSub_Name KUBE_VERSION))}) (C {(echo)} { (DQ ("Server: ") (${ VSub_Name SERVER_PLATFORM) (/) (${ VSub_Name SERVER_ARCH) (" (to override, set KUBERNETES_SERVER_ARCH)") ) } ) (C {(echo)} { (DQ ("Client: ") (${ VSub_Name CLIENT_PLATFORM) (/) (${ VSub_Name CLIENT_ARCH) (" (autodetected)") ) } ) (C {(echo)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DOWNLOAD_SERVER_TAR) op: Equal rhs: {(false)} spids: [1153] ) ] spids: [1153] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id: BoolUnary_e child: {(DQ (${ VSub_Name KUBE_ROOT) (/server/) (${ VSub_Name SERVER_TAR))} ) ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DOWNLOAD_SERVER_TAR) op: Equal rhs: {(true)} spids: [1180] ) ] spids: [1180] ) (C {(echo)} { (DQ ("Will download ") (${ VSub_Name SERVER_TAR) (" from ") (${ VSub_Name DOWNLOAD_URL_PREFIX) ) } ) ] spids: [-1 1177] ) ] spids: [-1 1197] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DOWNLOAD_CLIENT_TAR) op: Equal rhs: {(false)} spids: [1206] ) ] spids: [1206] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id: BoolUnary_x child: { (DQ (${ VSub_Name KUBE_ROOT) (/platforms/) (${ VSub_Name CLIENT_PLATFORM) (/) (${ VSub_Name CLIENT_ARCH) (/kubectl) ) } ) ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DOWNLOAD_CLIENT_TAR) op: Equal rhs: {(true)} spids: [1238] ) ] spids: [1238] ) (C {(echo)} { (DQ ("Will download and extract ") (${ VSub_Name CLIENT_TAR) (" from ") (${ VSub_Name DOWNLOAD_URL_PREFIX) ) } ) ] spids: [-1 1235] ) ] spids: [-1 1255] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TESTS_TAR) op: Equal rhs: {(DQ (kubernetes-test.tar.gz))} spids: [1258] ) ] spids: [1258] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:DOWNLOAD_TESTS_TAR) op:Equal rhs:{(false)} spids:[1263])] spids: [1263] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_n child: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(SQ )}) spids: [1273 1276] ) ) } ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DOWNLOAD_TESTS_TAR) op: Equal rhs: {(true)} spids: [1285] ) ] spids: [1285] ) (C {(echo)} { (DQ ("Will download and extract ") (${ VSub_Name TESTS_TAR) (" from ") (${ VSub_Name DOWNLOAD_URL_PREFIX) ) } ) ] spids: [-1 1282] ) ] spids: [-1 1302] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalAnd left: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name DOWNLOAD_CLIENT_TAR))} right: {(false)} ) right: (LogicalAnd left: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name DOWNLOAD_SERVER_TAR))} right: {(false)} ) right: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name DOWNLOAD_TESTS_TAR))} right: {(false)} ) ) ) ) terminator: ) ] action: [(C {(echo)} {(DQ ("Nothing additional to download."))}) (C {(exit)} {(0)})] spids: [-1 1350] ) ] spids: [-1 1364] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_z child: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(SQ )}) spids: [1374 1377] ) ) } ) ) terminator: ) ] action: [ (C {(echo)} {(DQ ("Is this ok? [Y]/n"))}) (C {(read)} {(confirm)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_EqualTilde left: {(DQ (${ VSub_Name confirm))} right: {(Lit_Other "^") (Lit_Other "[") (nN) (Lit_Other "]") (Lit_Other "$")} ) ) terminator: ) ] action: [(C {(echo)} {(DQ (Aborting.))}) (C {(exit)} {(1)})] spids: [-1 1419] ) ] spids: [-1 1434] ) ] spids: [-1 1383] ) ] spids: [-1 1436] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(DQ (${ VSub_Name DOWNLOAD_SERVER_TAR))}) terminator: ) ] action: [ (C {(download_tarball)} {(DQ (${ VSub_Name KUBE_ROOT) (/server))} {(DQ (${ VSub_Name SERVER_TAR))} ) ] spids: [-1 1448] ) ] spids: [-1 1466] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(DQ (${ VSub_Name DOWNLOAD_CLIENT_TAR))}) terminator: ) ] action: [ (C {(download_tarball)} {(DQ (${ VSub_Name KUBE_ROOT) (/client))} {(DQ (${ VSub_Name CLIENT_TAR))} ) (C {(extract_arch_tarball)} {(DQ (${ VSub_Name KUBE_ROOT) (/client/) (${ VSub_Name CLIENT_TAR))} {(DQ (${ VSub_Name CLIENT_PLATFORM))} {(DQ (${ VSub_Name CLIENT_ARCH))} ) ] spids: [-1 1478] ) ] spids: [-1 1521] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(DQ (${ VSub_Name DOWNLOAD_TESTS_TAR))}) terminator: ) ] action: [ (C {(download_tarball)} {(DQ (${ VSub_Name KUBE_ROOT) (/test))} {(DQ (${ VSub_Name TESTS_TAR))} ) (C {(echo)} {(DQ ("Extracting ") (${ VSub_Name TESTS_TAR) (" into ") (${ VSub_Name KUBE_ROOT))} ) (C {(tar)} {(-xzf)} {(DQ (${ VSub_Name KUBE_ROOT) (/test/) (${ VSub_Name TESTS_TAR))} {(--strip-components)} {(1)} {(-C)} {(DQ (${ VSub_Name KUBE_ROOT))} ) ] spids: [-1 1533] ) ] spids: [-1 1596] ) ] )