#!/usr/bin/env bash # Copyright 2014 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. # Bring up a Kubernetes cluster. # Usage: # wget -q -O - https://get.k8s.io | bash # or # curl -fsSL https://get.k8s.io | bash # # Advanced options # Set KUBERNETES_PROVIDER to choose between different providers: # Google Compute Engine [default] # * export KUBERNETES_PROVIDER=gce; wget -q -O - https://get.k8s.io | bash # Google Container Engine # * export KUBERNETES_PROVIDER=gke; wget -q -O - https://get.k8s.io | bash # Amazon EC2 # * export KUBERNETES_PROVIDER=aws; wget -q -O - https://get.k8s.io | bash # Libvirt (with CoreOS as a guest operating system) # * export KUBERNETES_PROVIDER=libvirt-coreos; wget -q -O - https://get.k8s.io | bash # Microsoft Azure # * export KUBERNETES_PROVIDER=azure-legacy; wget -q -O - https://get.k8s.io | bash # Vagrant (local virtual machines) # * export KUBERNETES_PROVIDER=vagrant; wget -q -O - https://get.k8s.io | bash # VMWare Photon Controller # * export KUBERNETES_PROVIDER=photon-controller; wget -q -O - https://get.k8s.io | bash # OpenStack-Heat # * export KUBERNETES_PROVIDER=openstack-heat; wget -q -O - https://get.k8s.io | bash # # Set KUBERNETES_RELEASE to choose a specific release instead of the current # stable release, (e.g. 'v1.3.7'). # See https://github.com/kubernetes/kubernetes/releases for release options. # Set KUBERNETES_RELEASE_URL to choose where to download binaries from. # (Defaults to https://storage.googleapis.com/kubernetes-release/release). # # Set KUBERNETES_SERVER_ARCH to choose the server (Kubernetes cluster) # architecture to download: # * amd64 [default] # * arm # * arm64 # # Set KUBERNETES_SKIP_DOWNLOAD to skip downloading a release. # Set KUBERNETES_SKIP_CONFIRM to skip the installation confirmation prompt. # Set KUBERNETES_SKIP_CREATE_CLUSTER to skip starting a cluster. # Set KUBERNETES_SKIP_RELEASE_VALIDATION to skip trying to validate the # Kubernetes release string. This implies that you know what you're doing # and have set KUBERNETES_RELEASE and KUBERNETES_RELEASE_URL properly. set -o errexit set -o nounset set -o pipefail # If KUBERNETES_RELEASE_URL is overridden but KUBERNETES_CI_RELEASE_URL is not then set KUBERNETES_CI_RELEASE_URL to KUBERNETES_RELEASE_URL. global KUBERNETES_CI_RELEASE_URL := $(KUBERNETES_CI_RELEASE_URL:-${KUBERNETES_RELEASE_URL:-https://dl.k8s.io/ci}) global KUBERNETES_RELEASE_URL := $(KUBERNETES_RELEASE_URL:-https://dl.k8s.io) global KUBE_RELEASE_VERSION_REGEX := '"^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-([a-zA-Z0-9]+)\\.(0|[1-9][0-9]*))?$'" global KUBE_CI_VERSION_REGEX := '"^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)-([a-zA-Z0-9]+)\\.(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*)\\+[-0-9a-z]*)?$'" # Sets KUBE_VERSION variable if an explicit version number was provided (e.g. "v1.0.6", # "v1.2.0-alpha.1.881+376438b69c7612") or resolves the "published" version # / (e.g. "release/stable",' "ci/latest-1") by reading from GCS. # # See the docs on getting builds for more information about version # publication. # # Args: # $1 version string from command line # Vars set: # KUBE_VERSION proc set_binary_version { if [[ "${1}" =~ "/" ]] { export KUBE_VERSION=$[curl -fsSL --retry 5 "https://dl.k8s.io/$(1).txt] } else { export KUBE_VERSION=$(1) } } # Use the script from inside the Kubernetes tarball to fetch the client and # server binaries (if not included in kubernetes.tar.gz). proc download_kube_binaries { shell { cd kubernetes if [[ -x ./cluster/get-kube-binaries.sh ]] { # Make sure to use the same download URL in get-kube-binaries.sh env KUBERNETES_RELEASE_URL=$(KUBERNETES_RELEASE_URL) \ ./cluster/get-kube-binaries.sh } } } proc create_cluster { if [[ -n "${KUBERNETES_SKIP_CREATE_CLUSTER-}" ]] { exit 0 } echo "Creating a kubernetes on $(KUBERNETES_PROVIDER:-gce)..." shell { cd kubernetes ./cluster/kube-up.sh echo "Kubernetes binaries at $(PWD)/cluster/" if [[ ":$PATH:" != *":${PWD}/cluster:"* ]] { echo "You may want to add this directory to your PATH in \$HOME/.profile" } echo "Installation successful!" } } if [[ -n "${KUBERNETES_SKIP_DOWNLOAD-}" ]] { create_cluster exit 0 } if [[ -d "./kubernetes" ]] { if [[ -z "${KUBERNETES_SKIP_CONFIRM-}" ]] { echo "'kubernetes' directory already exist. Should we skip download step and start to create cluster based on it? [Y]/n" read confirm if [[ ! "${confirm}" =~ ^[nN]$ ]] { echo "Skipping download step." create_cluster exit 0 } } } # TODO: remove client checks once kubernetes.tar.gz no longer includes client # binaries by default. global kernel := $[uname -s] matchstr $(kernel) { Darwin { global platform := '"darwin'" } Linux { global platform := '"linux'" } * { echo "Unknown, unsupported platform: $(kernel)." > !2 echo "Supported platforms: Linux, Darwin." > !2 echo "Bailing out." > !2 exit 2 } } global machine := $[uname -m] matchstr $(machine) { x86_64*|i?86_64*|amd64* { global arch := '"amd64'" } aarch64*|arm64* { global arch := '"arm64'" } arm* { global arch := '"arm'" } i?86* { global arch := '"386'" } * { echo "Unknown, unsupported architecture ($(machine))." > !2 echo "Supported architectures x86_64, i686, arm, arm64." > !2 echo "Bailing out." > !2 exit 3 } } global file := 'kubernetes.tar.gz' global release := $(KUBERNETES_RELEASE:-"release/stable") # Validate Kubernetes release version. # Translate a published version / (e.g. "release/stable") to version number. set_binary_version $(release) if [[ -z "${KUBERNETES_SKIP_RELEASE_VALIDATION-}" ]] { if [[ ${KUBE_VERSION} =~ ${KUBE_CI_VERSION_REGEX} ]] { # Override KUBERNETES_RELEASE_URL to point to the CI bucket; # this will be used by get-kube-binaries.sh. global KUBERNETES_RELEASE_URL := $(KUBERNETES_CI_RELEASE_URL) } elif ! [[ ${KUBE_VERSION} =~ ${KUBE_RELEASE_VERSION_REGEX} ]] { echo "Version doesn't match regexp" > !2 exit 1 } } global kubernetes_tar_url := ""$(KUBERNETES_RELEASE_URL)/$(KUBE_VERSION)/$(file)"" global need_download := 'true' if [[ -r "${PWD}/${file}" ]] { global downloaded_version := $[tar -xzOf "$(PWD)/$(file)" kubernetes/version !2 >/dev/null || true] echo "Found preexisting $(file), release $(downloaded_version)" if [[ "${downloaded_version}" == "${KUBE_VERSION}" ]] { echo "Using preexisting kubernetes.tar.gz" global need_download := 'false' } } if $(need_download) { echo "Downloading kubernetes release $(KUBE_VERSION)" echo " from $(kubernetes_tar_url)" echo " to $(PWD)/$(file)" } if [[ -e "${PWD}/kubernetes" ]] { # Let's try not to accidentally nuke something that isn't a kubernetes # release dir. if [[ ! -f "${PWD}/kubernetes/version" ]] { echo "$(PWD)/kubernetes exists but does not look like a Kubernetes release." echo "Aborting!" exit 5 } echo "Will also delete preexisting 'kubernetes' directory." } if [[ -z "${KUBERNETES_SKIP_CONFIRM-}" ]] { echo "Is this ok? [Y]/n" read confirm if [[ "${confirm}" =~ ^[nN]$ ]] { echo "Aborting." exit 0 } } if $(need_download) { if [[ $(which curl) ]] { curl -fL --retry 5 --keepalive-time 2 $(kubernetes_tar_url) -o $(file) } elif [[ $(which wget) ]] { wget $(kubernetes_tar_url) } else { echo "Couldn't find curl or wget. Bailing out." exit 1 } } echo "Unpacking kubernetes release $(KUBE_VERSION)" rm -rf "$(PWD)/kubernetes" tar -xzf $(file) download_kube_binaries create_cluster (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBERNETES_CI_RELEASE_URL) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {("https:") (Lit_Slash /) (Lit_Slash /) (dl.k8s.io) (Lit_Slash /) (ci)} ) spids: [201 210] ) } ) spids: [198 211] ) ) } spids: [196] ) ] spids: [196] ) (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: [216 223] ) ) } spids: [214] ) ] spids: [214] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_RELEASE_VERSION_REGEX) op: Equal rhs: { (DQ ("^v(0|[1-9][0-9]*)") (EscapedLiteralPart token:) (".(0|[1-9][0-9]*)") (EscapedLiteralPart token:) (".(0|[1-9][0-9]*)(-([a-zA-Z0-9]+)") (EscapedLiteralPart token:) (".(0|[1-9][0-9]*))?") (Lit_Other "$") ) } spids: [227] ) ] spids: [227] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_CI_VERSION_REGEX) op: Equal rhs: { (DQ ("^v(0|[1-9][0-9]*)") (EscapedLiteralPart token:) (".(0|[1-9][0-9]*)") (EscapedLiteralPart token:) (".(0|[1-9][0-9]*)-([a-zA-Z0-9]+)") (EscapedLiteralPart token:) (".(0|[1-9][0-9]*)(") (EscapedLiteralPart token:) (".(0|[1-9][0-9]*)") (EscapedLiteralPart token:) ("+[-0-9a-z]*)?") (Lit_Other "$") ) } spids: [239] ) ] spids: [239] ) (FuncDef name: set_binary_version body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_EqualTilde left: {(DQ (${ VSub_Number 1))} right: {(DQ (/))} ) ) terminator: ) ] action: [ (C {(export)} {(Lit_VarLike "KUBE_VERSION=") (CommandSubPart command_list: (CommandList children: [ (C {(curl)} {(-fsSL)} {(--retry)} {(5)} {(DQ ("https://dl.k8s.io/") (${ VSub_Number 1) (.txt))} ) ] ) left_token: spids: [323 339] ) } ) ] spids: [-1 317] ) ] else_action: [(C {(export)} {(Lit_VarLike "KUBE_VERSION=") (${ VSub_Number 1)})] spids: [342 353] ) ] spids: [295] ) spids: [289 294] ) (FuncDef name: download_kube_binaries body: (BraceGroup children: [ (Subshell child: (CommandList children: [ (C {(cd)} {(kubernetes)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_x child: {(./cluster/get-kube-binaries.sh)} ) ) terminator: ) ] action: [ (SimpleCommand words: [{(./cluster/get-kube-binaries.sh)}] more_env: [ (env_pair name: KUBERNETES_RELEASE_URL val: {(DQ (${ VSub_Name KUBERNETES_RELEASE_URL))} spids: [397] ) ] ) ] spids: [-1 390] ) ] spids: [-1 409] ) ] ) spids: [371 412] ) ] spids: [368] ) spids: [364 367] ) (FuncDef name: create_cluster 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_Hyphen arg_word:{(SQ )}) spids: [431 434] ) ) } ) ) terminator: ) ] action: [(C {(exit)} {(0)})] spids: [-1 440] ) ] spids: [-1 448] ) (C {(echo)} { (DQ ("Creating a kubernetes on ") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(gce)}) spids: [455 459] ) (...) ) } ) (Subshell child: (CommandList children: [ (C {(cd)} {(kubernetes)}) (C {(./cluster/kube-up.sh)}) (C {(echo)} {(DQ ("Kubernetes binaries at ") (${ VSub_Name PWD) (/cluster/))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ (":") ($ VSub_Name "$PATH") (":"))} right: {(Lit_Other "*") (DQ (":") (${ VSub_Name PWD) ("/cluster:")) (Lit_Other "*") } ) ) terminator: ) ] action: [ (C {(echo)} { (DQ ("You may want to add this directory to your PATH in ") (EscapedLiteralPart token: ) (HOME/.profile) ) } ) ] spids: [-1 511] ) ] spids: [-1 523] ) (C {(echo)} {(DQ ("Installation successful!"))}) ] ) spids: [464 534] ) ] spids: [421] ) spids: [417 420] ) (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: [546 549] ) ) } ) ) terminator: ) ] action: [(C {(create_cluster)}) (C {(exit)} {(0)})] spids: [-1 555] ) ] spids: [-1 565] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr:(BoolUnary op_id:BoolUnary_d child:{(DQ (./kubernetes))})) terminator: ) ] action: [ (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: [591 594] ) ) } ) ) terminator: ) ] action: [ (C {(echo)} { (DQ ( "'kubernetes' directory already exist. Should we skip download step and start to create cluster based on it? [Y]/n" ) ) } ) (C {(read)} {(confirm)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (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 ("Skipping download step."))}) (C {(create_cluster)}) (C {(exit)} {(0)}) ] spids: [-1 638] ) ] spids: [-1 656] ) ] spids: [-1 600] ) ] spids: [-1 659] ) ] spids: [-1 581] ) ] spids: [-1 661] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kernel) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(uname)} {(-s)})]) left_token: spids: [671 675] ) } spids: [670] ) ] spids: [670] ) (Case to_match: {(DQ (${ VSub_Name kernel))} arms: [ (case_arm pat_list: [{(Darwin)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:platform) op: Equal rhs: {(DQ (darwin))} spids: [692] ) ] spids: [692] ) ] spids: [688 689 698 -1] ) (case_arm pat_list: [{(Linux)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:platform) op: Equal rhs: {(DQ (linux))} spids: [705] ) ] spids: [705] ) ] spids: [701 702 711 -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:[728])] ) (SimpleCommand words: [{(echo)} {(DQ ("Supported platforms: Linux, Darwin."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[738])] ) (SimpleCommand words: [{(echo)} {(DQ ("Bailing out."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[748])] ) (C {(exit)} {(2)}) ] spids: [714 715 -1 756] ) ] spids: [677 685 756] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:machine) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(uname)} {(-m)})]) left_token: spids: [760 764] ) } spids: [759] ) ] spids: [759] ) (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:arch) op:Equal rhs:{(DQ (amd64))} spids:[790])] spids: [790] ) ] spids: [777 787 796 -1] ) (case_arm pat_list: [{(aarch64) (Lit_Other "*")} {(arm64) (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (arm64))} spids:[807])] spids: [807] ) ] spids: [799 804 813 -1] ) (case_arm pat_list: [{(arm) (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (arm))} spids:[821])] spids: [821] ) ] spids: [816 818 827 -1] ) (case_arm pat_list: [{(i) (Lit_Other "?") (86) (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (386))} spids:[837])] spids: [837] ) ] spids: [830 834 843 -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:[860])] ) (SimpleCommand words: [{(echo)} {(DQ ("Supported architectures x86_64, i686, arm, arm64."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[870])] ) (SimpleCommand words: [{(echo)} {(DQ ("Bailing out."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[880])] ) (C {(exit)} {(3)}) ] spids: [846 847 889 -1] ) ] spids: [766 774 891] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:file) op:Equal rhs:{(kubernetes.tar.gz)} spids:[894])] spids: [894] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:release) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(DQ (release/stable))}) spids: [898 904] ) } spids: [897] ) ] spids: [897] ) (C {(set_binary_version)} {(DQ (${ VSub_Name release))}) (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: [928 931] ) ) } ) ) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_EqualTilde left: {(${ VSub_Name KUBE_VERSION)} right: {(${ VSub_Name KUBE_CI_VERSION_REGEX)} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBERNETES_RELEASE_URL) op: Equal rhs: {(DQ (${ VSub_Name KUBERNETES_CI_RELEASE_URL))} spids: [968] ) ] spids: [968] ) ] spids: [-1 957] ) (if_arm cond: [ (Sentence child: (Pipeline children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_EqualTilde left: {(${ VSub_Name KUBE_VERSION)} right: {(${ VSub_Name KUBE_RELEASE_VERSION_REGEX)} ) ) ] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Version doesn't match regexp"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1004])] ) (C {(exit)} {(1)}) ] spids: [976 995] ) ] spids: [-1 1013] ) ] spids: [-1 937] ) ] spids: [-1 1015] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kubernetes_tar_url) op: Equal rhs: { (DQ (${ VSub_Name KUBERNETES_RELEASE_URL) (/) (${ VSub_Name KUBE_VERSION) (/) (${ VSub_Name file) ) } spids: [1017] ) ] spids: [1017] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:need_download) op:Equal rhs:{(true)} spids:[1033])] spids: [1033] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_r child: {(DQ (${ VSub_Name PWD) (/) (${ VSub_Name file))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:downloaded_version) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (SimpleCommand words: [ {(tar)} {(-xzOf)} {(DQ (${ VSub_Name PWD) (/) (${ VSub_Name file))} {(kubernetes/version)} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [1076] ) ] ) (C {(true)}) ] op_id: Op_DPipe ) ] ) left_token: spids: [1059 1082] ) } spids: [1058] ) ] spids: [1058] ) (C {(echo)} { (DQ ("Found preexisting ") (${ VSub_Name file) (", release ") (${ VSub_Name downloaded_version) ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name downloaded_version))} right: {(DQ (${ VSub_Name KUBE_VERSION))} ) ) terminator: ) ] action: [ (C {(echo)} {(DQ ("Using preexisting kubernetes.tar.gz"))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:need_download) op: Equal rhs: {(false)} spids: [1130] ) ] spids: [1130] ) ] spids: [-1 1120] ) ] spids: [-1 1134] ) ] spids: [-1 1055] ) ] spids: [-1 1136] ) (If arms: [ (if_arm cond: [(Sentence child:(C {(DQ (${ VSub_Name need_download))}) terminator:)] action: [ (C {(echo)} {(DQ ("Downloading kubernetes release ") (${ VSub_Name KUBE_VERSION))}) (C {(echo)} {(DQ (" from ") (${ VSub_Name kubernetes_tar_url))}) (C {(echo)} {(DQ (" to ") (${ VSub_Name PWD) (/) (${ VSub_Name file))}) ] spids: [-1 1148] ) ] spids: [-1 1184] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id:BoolUnary_e child:{(DQ (${ VSub_Name PWD) (/kubernetes))}) ) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id: BoolUnary_f child: {(DQ (${ VSub_Name PWD) (/kubernetes/version))} ) ) ) terminator: ) ] action: [ (C {(echo)} { (DQ (${ VSub_Name PWD) ("/kubernetes exists but does not look like a Kubernetes release.") ) } ) (C {(echo)} {(DQ ("Aborting!"))}) (C {(exit)} {(5)}) ] spids: [-1 1232] ) ] spids: [-1 1257] ) (C {(echo)} {(DQ ("Will also delete preexisting 'kubernetes' directory."))}) ] spids: [-1 1203] ) ] spids: [-1 1266] ) (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: [1276 1279] ) ) } ) ) 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)} {(0)})] spids: [-1 1321] ) ] spids: [-1 1336] ) ] spids: [-1 1285] ) ] spids: [-1 1338] ) (If arms: [ (if_arm cond: [(Sentence child:(C {(DQ (${ VSub_Name need_download))}) terminator:)] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(curl)})]) left_token: spids: [1357 1361] ) } ) ) terminator: ) ] action: [ (C {(curl)} {(-fL)} {(--retry)} {(5)} {(--keepalive-time)} {(2)} {(DQ (${ VSub_Name kubernetes_tar_url))} {(-o)} {(DQ (${ VSub_Name file))} ) ] spids: [-1 1366] ) (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(wget)})]) left_token: spids: [1400 1404] ) } ) ) terminator: ) ] action: [(C {(wget)} {(DQ (${ VSub_Name kubernetes_tar_url))})] spids: [1396 1409] ) ] else_action: [ (C {(echo)} {(DQ ("Couldn't find curl or wget. Bailing out."))}) (C {(exit)} {(1)}) ] spids: [1421 1436] ) ] spids: [-1 1350] ) ] spids: [-1 1438] ) (C {(echo)} {(DQ ("Unpacking kubernetes release ") (${ VSub_Name KUBE_VERSION))}) (C {(rm)} {(-rf)} {(DQ (${ VSub_Name PWD) (/kubernetes))}) (C {(tar)} {(-xzf)} {(${ VSub_Name file)}) (C {(download_kube_binaries)}) (C {(create_cluster)}) ] )