(CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: { (DQ (BracedVarSub token: <VSub_Name KUBERNETES_PROVIDER> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(gce)}) spids: [78 82] ) ) } right: {(DQ (gce))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("!!! ") (${ VSub_Number 1) (" only works on GCE"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[107])] ) (C {(exit)} {(1)}) ] spids: [-1 94] ) ] spids: [-1 115] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_ROOT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: <Left_CommandSub "$("> spids: [119 127] ) (/../..) } spids: [118] ) ] spids: [118] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/hack/lib/util.sh))}) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/kube-util.sh))}) (FuncDef name: usage body: (BraceGroup children: [ (C {(echo)} {(DQ ("!!! EXPERIMENTAL !!!"))}) (C {(echo)} {(DQ )}) (C {(echo)} { (DQ (${ VSub_Number 0) (" [-M | -N | -P] [-o] (-l | <version number or publication>)")) } ) (C {(echo)} {(DQ (" Upgrades master and nodes by default"))}) (C {(echo)} {(DQ (" -M: Upgrade master only"))}) (C {(echo)} {(DQ (" -N: Upgrade nodes only"))}) (C {(echo)} {(DQ (" -P: Node upgrade prerequisites only (create a new instance template)"))} ) (C {(echo)} { (DQ ( " -c: Upgrade NODE_UPGRADE_PARALLELISM nodes in parallel (default=1) within a single instance group. The MIGs themselves are dealt serially." ) ) } ) (C {(echo)} { (DQ ( " -o: Use os distro sepcified in KUBE_NODE_OS_DISTRIBUTION for new nodes. Options include 'debian' or 'gci'" ) ) } ) (C {(echo)} {(DQ (" -l: Use local(dev) binaries. This is only supported for master upgrades."))} ) (C {(echo)} {(DQ )}) (C {(echo)} {(SQ <" Version number or publication is either a proper version number">)}) (C {(echo)} {(SQ <" (e.g. \"v1.0.6\", \"v1.2.0-alpha.1.881+376438b69c7612\") or a version">)} ) (C {(echo)} {(SQ <" publication of the form <bucket>/<version> (e.g. \"release/stable\",">)} ) (C {(echo)} {(SQ <" \"ci/latest-1\"). Some common ones are:">)}) (C {(echo)} {(SQ <" - \"release/stable\"">)}) (C {(echo)} {(SQ <" - \"release/latest\"">)}) (C {(echo)} {(SQ <" - \"ci/latest\"">)}) (C {(echo)} { (SQ < " See the docs on getting builds for more information about version publication." > ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("(... Fetching current release versions ...)"))}) (C {(echo)} {(DQ )}) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:release_stable) op:Equal spids:[318])] spids: [316] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:release_latest) op:Equal spids:[323])] spids: [321] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:ci_latest) op:Equal spids:[328])] spids: [326] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:release_stable) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(gsutil)} {(cat)} {(gs) (Lit_Other ":") (//kubernetes-release/release/stable.txt)} ) ] ) left_token: <Left_CommandSub "$("> spids: [333 341] ) } spids: [332] ) ] spids: [332] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:release_latest) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(gsutil)} {(cat)} {(gs) (Lit_Other ":") (//kubernetes-release/release/latest.txt)} ) ] ) left_token: <Left_CommandSub "$("> spids: [345 353] ) } spids: [344] ) ] spids: [344] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ci_latest) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(gsutil)} {(cat)} {(gs) (Lit_Other ":") (//kubernetes-release-dev/ci/latest.txt)} ) ] ) left_token: <Left_CommandSub "$("> spids: [357 365] ) } spids: [356] ) ] spids: [356] ) (C {(echo)} {(DQ ("Right now, versions are as follows:"))}) (C {(echo)} {(DQ (" release/stable: ") (${ VSub_Number 0) (" ") (${ VSub_Name release_stable))} ) (C {(echo)} {(DQ (" release/latest: ") (${ VSub_Number 0) (" ") (${ VSub_Name release_latest))} ) (C {(echo)} {(DQ (" ci/latest: ") (${ VSub_Number 0) (" ") (${ VSub_Name ci_latest))}) ] spids: [155] ) spids: [149 154] ) (FuncDef name: print-node-version-info body: (BraceGroup children: [ (C {(echo)} {(DQ ("== ") ($ VSub_Number "$1") (" Node OS and Kubelet Versions =="))}) (C {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/kubectl.sh))} {(get)} {(nodes)} {(-o) (Lit_Other "=") (Lit_VarLike "jsonpath=") (SQ < "{range .items[*]}name: \"{.metadata.name}\", osImage: \"{.status.nodeInfo.osImage}\", kubeletVersion: \"{.status.nodeInfo.kubeletVersion}\"{\"\\n\"}{end}" > ) } ) ] spids: [426] ) spids: [420 425] ) (FuncDef name: upgrade-master body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:num_masters) op:Equal spids:[470])] spids: [468] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:num_masters) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(get-master-replicas-count)})]) left_token: <Left_CommandSub "$("> spids: [474 476] ) } spids: [473] ) ] spids: [473] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name num_masters))} right: {(1)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} { (DQ ( "Upgrade of master not supported if more than one master replica present. The current number of master replicas: " ) (${ VSub_Name num_masters) ) } ) (C {(exit)} {(1)}) ] spids: [-1 496] ) ] spids: [-1 514] ) (C {(echo)} { (DQ ("== Upgrading master to '") (${ VSub_Name SERVER_BINARY_TAR_URL) ("'. Do not interrupt, deleting master instance. ==") ) } ) (C {(get-kubeconfig-basicauth)}) (C {(get-kubeconfig-bearertoken)}) (C {(detect-master)}) (C {(parse-master-env)}) (C {(upgrade-master-env)}) (C {(backfile-kubeletauth-certs)}) (C {(gcloud)} {(compute)} {(instances)} {(delete)} {(--project)} {(DQ (${ VSub_Name PROJECT))} {(--quiet)} {(--zone)} {(DQ (${ VSub_Name ZONE))} {(DQ (${ VSub_Name MASTER_NAME))} ) (C {(create-master-instance)} {(DQ (${ VSub_Name MASTER_NAME) (-ip))}) (C {(wait-for-master)}) ] spids: [465] ) spids: [459 464] ) (FuncDef name: upgrade-master-env body: (BraceGroup children: [ (C {(echo)} {(DQ ("== Upgrading master environment variables. =="))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalAnd left: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (DQ (BracedVarSub token: <VSub_Name ENABLE_NODE_PROBLEM_DETECTOR> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [673 676] ) ) } right: {(DQ (standalone))} ) right: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (DQ (BracedVarSub token: <VSub_Name NODE_PROBLEM_DETECTOR_TOKEN> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [688 691] ) ) } right: {(DQ )} ) ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NODE_PROBLEM_DETECTOR_TOKEN) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (SimpleCommand words: [ {(dd)} {(Lit_VarLike "if=") (/dev/urandom)} {(Lit_VarLike "bs=") (128)} {(Lit_VarLike "count=") (1)} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [718] ) ] ) (C {(base64)}) (C {(tr)} {(-d)} {(DQ ("=+/"))}) (SimpleCommand words: [ {(dd)} {(Lit_VarLike "bs=") (32)} {(Lit_VarLike "count=") (1)} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [745] ) ] ) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [706 747] ) } spids: [705] ) ] spids: [705] ) ] spids: [-1 702] ) ] spids: [-1 750] ) ] spids: [650] ) spids: [644 649] ) (FuncDef name: backfile-kubeletauth-certs body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalAnd left: (LogicalNot child: (BoolUnary op_id: BoolUnary_z child: { (DQ (BracedVarSub token: <VSub_Name KUBEAPISERVER_CERT_BASE64> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [776 779] ) ) } ) ) right: (LogicalNot child: (BoolUnary op_id: BoolUnary_z child: { (DQ (BracedVarSub token: <VSub_Name KUBEAPISERVER_CERT_BASE64> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [789 792] ) ) } ) ) ) ) terminator: <Op_Semi ";"> ) ] action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})] spids: [-1 798] ) ] spids: [-1 806] ) (C {(mkdir)} {(-p)} {(DQ (${ VSub_Name KUBE_TEMP) (/pki))}) (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name CA_KEY_BASE64))}) (SimpleCommand words: [{(base64)} {(-d)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name KUBE_TEMP) (/pki/ca.key))} spids: [836] ) ] ) ] negated: False ) (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name CA_CERT_BASE64))}) (SimpleCommand words: [{(base64)} {(-d)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name KUBE_TEMP) (/pki/ca.crt))} spids: [860] ) ] ) ] negated: False ) (Subshell child: (CommandList children: [ (C {(cd)} {(DQ (${ VSub_Name KUBE_TEMP) (/pki))}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (util) (Lit_Other ":") (Lit_Other ":") (ensure-cfssl) } {(DQ (${ VSub_Name KUBE_TEMP) (/cfssl))} ) (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("{\n") (" ") (Right_DoubleQuote "\"") (signing) (Right_DoubleQuote "\"") (": {\n") (" ") (Right_DoubleQuote "\"") (client) (Right_DoubleQuote "\"") (": {\n") (" ") (Right_DoubleQuote "\"") (expiry) (Right_DoubleQuote "\"") (": ") (Right_DoubleQuote "\"") (43800h) (Right_DoubleQuote "\"") (",\n") (" ") (Right_DoubleQuote "\"") (usages) (Right_DoubleQuote "\"") (": [\n") (" ") (Right_DoubleQuote "\"") (signing) (Right_DoubleQuote "\"") (",\n") (" ") (Right_DoubleQuote "\"") ("key encipherment") (Right_DoubleQuote "\"") (",\n") (" ") (Right_DoubleQuote "\"") ("client auth") (Right_DoubleQuote "\"") ("\n") (" ]\n") (" }\n") (" }\n") ("}\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [899] ) (Redir op_id: Redir_Great fd: -1 arg_word: {(ca-config.json)} spids: [902] ) ] ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("{\n") (" ") (Right_DoubleQuote "\"") (CN) (Right_DoubleQuote "\"") (": ") (Right_DoubleQuote "\"") (kube-apiserver) (Right_DoubleQuote "\"") ("\n") ("}\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [965] ) ] ) (C {(DQ (${ VSub_Name CFSSL_BIN))} {(gencert)} {(-ca) (Lit_Other "=") (ca.crt)} {(-ca-key) (Lit_Other "=") (ca.key)} {(-config) (Lit_Other "=") (ca-config.json)} {(-profile) (Lit_Other "=") (client)} {(-)} ) (C {(DQ (${ VSub_Name CFSSLJSON_BIN))} {(-bare)} {(kube-apiserver)}) ] negated: False ) ] ) spids: [870 1034] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBEAPISERVER_CERT_BASE64) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(cat)} {(DQ (${ VSub_Name KUBE_TEMP) (/pki/kube-apiserver.pem))}) (C {(base64)}) (C {(tr)} {(-d)} {(SQ <"\\r\\n">)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1038 1061] ) } spids: [1037] ) ] spids: [1037] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBEAPISERVER_KEY_BASE64) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(cat)} {(DQ (${ VSub_Name KUBE_TEMP) (/pki/kube-apiserver-key.pem))} ) (C {(base64)}) (C {(tr)} {(-d)} {(SQ <"\\r\\n">)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1065 1088] ) } spids: [1064] ) ] spids: [1064] ) ] spids: [764] ) spids: [758 763] ) (FuncDef name: wait-for-master body: (BraceGroup children: [ (C {(echo)} {(DQ ("== Waiting for new master to respond to API requests =="))}) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:curl_auth_arg) op:Equal spids:[1112])] spids: [1110] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_n child: { (BracedVarSub token: <VSub_Name KUBE_BEARER_TOKEN> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{}) spids: [1121 1124] ) } ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:curl_auth_arg) op: Equal rhs: { (ArrayLiteralPart words: [ {(-H)} {(DQ ("Authorization: Bearer ") (${ VSub_Name KUBE_BEARER_TOKEN))} ] ) } spids: [1132] ) ] spids: [1132] ) ] spids: [-1 1129] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_n child: { (BracedVarSub token: <VSub_Name KUBE_PASSWORD> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{}) spids: [1151 1154] ) } ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:curl_auth_arg) op: Equal rhs: { (ArrayLiteralPart words: [ {(--user)} {(DQ (${ VSub_Name KUBE_USER) (":") (${ VSub_Name KUBE_PASSWORD))} ] ) } spids: [1162] ) ] spids: [1162] ) ] spids: [1145 1159] ) ] else_action: [ (C {(echo)} {(DQ ("can't get auth credentials for the current master"))}) (C {(exit)} {(1)}) ] spids: [1178 1193] ) (Until cond: [ (Sentence child: (C {(curl)} {(--insecure)} { (DQ (BracedVarSub token: <VSub_Name curl_auth_arg> bracket_op: (WholeArray op_id:Lit_At) spids: [1204 1209] ) ) } {(--max-time)} {(5)} {(--fail)} {(--output)} {(/dev/null)} {(--silent)} {(DQ ("https://") (${ VSub_Name KUBE_MASTER_IP) (/healthz))} ) terminator: <Op_Semi ";"> ) ] body: (DoGroup children: [(C {(printf)} {(DQ (.))}) (C {(sleep)} {(2)})] spids: [1235 1250] ) ) (C {(echo)} {(DQ ("== Done =="))}) ] spids: [1099] ) spids: [1093 1098] ) (FuncDef name: prepare-upgrade body: (BraceGroup children: [ (C {(kube) (Lit_Other ":") (Lit_Other ":") (util) (Lit_Other ":") (Lit_Other ":") (ensure-temp-dir) } ) (C {(detect-project)}) (C {(detect-subnetworks)}) (C {(detect-node-names)}) (C {(write-cluster-name)}) (C {(tars_from_version)}) ] spids: [1281] ) spids: [1275 1280] ) (FuncDef name: get-node-env body: (BraceGroup children: [ (SimpleCommand words: [ {(gcloud)} {(compute)} {(--project)} {(${ VSub_Name PROJECT)} {(ssh)} {(--zone)} {(${ VSub_Name ZONE)} { (BracedVarSub token: <VSub_Name NODE_NAMES> bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [1362 1367] ) } {(--command)} { (DQ ("curl --fail --silent -H 'Metadata-Flavor: Google' ") (" 'http://metadata/computeMetadata/v1/instance/attributes/kube-env'") ) } ] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[1379])] ) ] spids: [1337] ) spids: [1331 1336] ) (FuncDef name: get-node-os body: (BraceGroup children: [ (C {(gcloud)} {(compute)} {(ssh)} {(DQ ($ VSub_Number "$1"))} {(--project)} {(DQ (${ VSub_Name PROJECT))} {(--zone)} {(DQ (${ VSub_Name ZONE))} {(--command)} { (DQ ("cat /etc/os-release | grep ") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ("^ID=.*") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (" | cut -c 4-") ) } ) ] spids: [1409] ) spids: [1403 1408] ) (FuncDef name: upgrade-nodes body: (BraceGroup children:[(C {(prepare-node-upgrade)})(C {(do-node-upgrade)})] spids:[1510]) spids: [1504 1509] ) (FuncDef name: setup-base-image body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name env_os_distro))} right: {(DQ (false))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} { (DQ ( "== Ensuring that new Node base OS image matched the existing Node base OS image" ) ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NODE_OS_DISTRIBUTION) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-node-os)} { (DQ (BracedVarSub token: <VSub_Name NODE_NAMES> bracket_op: (ArrayIndex expr: (ArithWord w:{(Lit_Digits 0)}) ) spids: [1564 1569] ) ) } ) ] ) left_token: <Left_CommandSub "$("> spids: [1560 1571] ) } spids: [1559] ) ] spids: [1559] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name NODE_OS_DISTRIBUTION))} right: {(DQ (cos))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NODE_OS_DISTRIBUTION) op: Equal rhs: {(DQ (gci))} spids: [1597] ) ] spids: [1597] ) ] spids: [-1 1594] ) ] spids: [-1 1603] ) (C {(source)} { (DQ (${ VSub_Name KUBE_ROOT) (/cluster/gce/) (${ VSub_Name NODE_OS_DISTRIBUTION) (/node-helper.sh) ) } ) (C {(set-node-image)}) ] spids: [-1 1549] ) ] spids: [-1 1629] ) ] spids: [1527] ) spids: [1521 1526] ) (FuncDef name: prepare-node-upgrade body: (BraceGroup children: [ (SimpleCommand words: [ {(echo)} {(DQ ("== Preparing node upgrade (to ") (${ VSub_Name KUBE_VERSION) ("). =="))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1713])] ) (C {(setup-base-image)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SANITIZED_VERSION) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(${ VSub_Name KUBE_VERSION)}) (C {(sed)} {(SQ <"s/[\\.\\+]/-/g">)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1722 1736] ) } spids: [1721] ) ] spids: [1721] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:scope_flags) op:Equal rhs:{(SQ )} spids:[1746])] spids: [1744] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ (${ VSub_Name NODE_SCOPES))} {(Lit_Other "]")}) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scope_flags) op: Equal rhs: {(DQ ("--scopes ") (${ VSub_Name NODE_SCOPES))} spids: [1767] ) ] spids: [1767] ) ] spids: [-1 1764] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scope_flags) op: Equal rhs: {(DQ (--no-scopes))} spids: [1779] ) ] spids: [1779] ) ] spids: [1776 1785] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:node_env) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(get-node-env)})]) left_token: <Left_CommandSub "$("> spids: [1796 1798] ) } spids: [1795] ) ] spids: [1793] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBELET_TOKEN) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-env-val)} {(DQ (${ VSub_Name node_env))} {(DQ (KUBELET_TOKEN))}) ] ) left_token: <Left_CommandSub "$("> spids: [1802 1814] ) } spids: [1801] ) ] spids: [1801] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_PROXY_TOKEN) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-env-val)} {(DQ (${ VSub_Name node_env))} {(DQ (KUBE_PROXY_TOKEN))}) ] ) left_token: <Left_CommandSub "$("> spids: [1818 1830] ) } spids: [1817] ) ] spids: [1817] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NODE_PROBLEM_DETECTOR_TOKEN) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-env-val)} {(DQ (${ VSub_Name node_env))} {(DQ (NODE_PROBLEM_DETECTOR_TOKEN))} ) ] ) left_token: <Left_CommandSub "$("> spids: [1834 1846] ) } spids: [1833] ) ] spids: [1833] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CA_CERT_BASE64) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-env-val)} {(DQ (${ VSub_Name node_env))} {(DQ (CA_CERT))}) ] ) left_token: <Left_CommandSub "$("> spids: [1850 1862] ) } spids: [1849] ) ] spids: [1849] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:EXTRA_DOCKER_OPTS) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-env-val)} {(DQ (${ VSub_Name node_env))} {(DQ (EXTRA_DOCKER_OPTS))} ) ] ) left_token: <Left_CommandSub "$("> spids: [1866 1878] ) } spids: [1865] ) ] spids: [1865] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBELET_CERT_BASE64) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-env-val)} {(DQ (${ VSub_Name node_env))} {(DQ (KUBELET_CERT))}) ] ) left_token: <Left_CommandSub "$("> spids: [1882 1894] ) } spids: [1881] ) ] spids: [1881] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBELET_KEY_BASE64) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-env-val)} {(DQ (${ VSub_Name node_env))} {(DQ (KUBELET_KEY))}) ] ) left_token: <Left_CommandSub "$("> spids: [1898 1910] ) } spids: [1897] ) ] spids: [1897] ) (C {(upgrade-node-env)}) (C {(write-node-env)}) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:template_name) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-template-name-from-version)} {(${ VSub_Name SANITIZED_VERSION)}) ] ) left_token: <Left_CommandSub "$("> spids: [1941 1947] ) } spids: [1940] ) ] spids: [1938] ) (C {(create-node-instance-template)} {(DQ (${ VSub_Name template_name))}) (C {(echo)} {(DQ ("Instance template name: ") (${ VSub_Name template_name))}) (SimpleCommand words: [ {(echo)} { (DQ ("== Finished preparing node upgrade (to ") (${ VSub_Name KUBE_VERSION) ("). ==")) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1983])] ) ] spids: [1700] ) spids: [1694 1699] ) (FuncDef name: upgrade-node-env body: (BraceGroup children: [ (C {(echo)} {(DQ ("== Upgrading node environment variables. =="))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalAnd left: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (DQ (BracedVarSub token: <VSub_Name ENABLE_NODE_PROBLEM_DETECTOR> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [2018 2021] ) ) } right: {(DQ (standalone))} ) right: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (DQ (BracedVarSub token: <VSub_Name NODE_PROBLEM_DETECTOR_TOKEN> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [2033 2036] ) ) } right: {(DQ )} ) ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(detect-master)}) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:master_env) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(get-master-env)})]) left_token: <Left_CommandSub "$("> spids: [2056 2058] ) } spids: [2055] ) ] spids: [2053] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NODE_PROBLEM_DETECTOR_TOKEN) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-env-val)} {(DQ (${ VSub_Name master_env))} {(DQ (NODE_PROBLEM_DETECTOR_TOKEN))} ) ] ) left_token: <Left_CommandSub "$("> spids: [2062 2074] ) } spids: [2061] ) ] spids: [2061] ) ] spids: [-1 2047] ) ] spids: [-1 2077] ) ] spids: [1995] ) spids: [1989 1994] ) (FuncDef name: do-single-node-upgrade body: (BraceGroup children: [ (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:instance) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [2107] ) ] spids: [2103] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:instance_id) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(gcloud)} {(compute)} {(instances)} {(describe)} {(DQ (${ VSub_Name instance))} {(--format) (Lit_Other "=") (SQ <"get(id)">)} {(--project) (Lit_Other "=") (DQ (${ VSub_Name PROJECT))} {(--zone) (Lit_Other "=") (DQ (${ VSub_Name ZONE))} ] redirects: [ (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [2157] ) ] ) ] ) left_token: <Left_CommandSub "$("> spids: [2114 2159] ) } spids: [2113] ) ] spids: [2113] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:describe_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2163] ) ] spids: [2163] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:describe_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2168] ) ] spids: [2168] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ (${ VSub_Name describe_rc))} right: {(0)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(DQ ("== FAILED to describe ") (${ VSub_Name instance) (" =="))}) (C {(echo)} {(DQ (${ VSub_Name instance_id))}) (ControlFlow token: <ControlFlow_Return return> arg_word: {(${ VSub_Name describe_rc)} ) ] spids: [-1 2189] ) ] spids: [-1 2219] ) (SimpleCommand words: [{(echo)} {(DQ ("== Draining ") (${ VSub_Name instance) (". == "))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[2237])] ) (AndOr children: [ (C {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/kubectl.sh))} {(drain)} {(--delete-local-data)} {(--force)} {(--ignore-daemonsets)} {(DQ (${ VSub_Name instance))} ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:drain_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2266] ) ] spids: [2266] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:drain_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2271] ) ] spids: [2271] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ (${ VSub_Name drain_rc))} right: {(0)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(DQ ("== FAILED to drain ") (${ VSub_Name instance) (" =="))}) (ControlFlow token: <ControlFlow_Return return> arg_word: {(${ VSub_Name drain_rc)} ) ] spids: [-1 2292] ) ] spids: [-1 2313] ) (SimpleCommand words: [{(echo)} {(DQ ("== Recreating instance ") (${ VSub_Name instance) (". =="))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[2331])] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:recreate) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(gcloud)} {(compute)} {(instance-groups)} {(managed)} {(recreate-instances)} {(DQ (${ VSub_Name group))} {(--project) (Lit_Other "=") (DQ (${ VSub_Name PROJECT))} {(--zone) (Lit_Other "=") (DQ (${ VSub_Name ZONE))} {(--instances) (Lit_Other "=") (DQ (${ VSub_Name instance))} ] redirects: [ (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [2383] ) ] ) ] ) left_token: <Left_CommandSub "$("> spids: [2336 2385] ) } spids: [2335] ) ] spids: [2335] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:recreate_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2389] ) ] spids: [2389] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:recreate_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2394] ) ] spids: [2394] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ (${ VSub_Name recreate_rc))} right: {(0)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(DQ ("== FAILED to recreate ") (${ VSub_Name instance) (" =="))}) (C {(echo)} {(DQ (${ VSub_Name recreate))}) (ControlFlow token: <ControlFlow_Return return> arg_word: {(${ VSub_Name recreate_rc)} ) ] spids: [-1 2415] ) ] spids: [-1 2445] ) (SimpleCommand words: [ {(echo)} {(DQ ("== Waiting for instance ") (${ VSub_Name instance) (" to be recreated. =="))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[2463])] ) (While cond: [(Sentence child:(C {(true)}) terminator:<Op_Semi ";">)] body: (DoGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:new_instance_id) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(gcloud)} {(compute)} {(instances)} {(describe)} {(DQ (${ VSub_Name instance))} {(--format) (Lit_Other "=") (SQ <"get(id)">)} {(--project) (Lit_Other "=") (DQ (${ VSub_Name PROJECT))} {(--zone) (Lit_Other "=") (DQ (${ VSub_Name ZONE))} ] redirects: [ (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [2519] ) ] ) ] ) left_token: <Left_CommandSub "$("> spids: [2476 2521] ) } spids: [2475] ) ] spids: [2475] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:describe_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2525] ) ] spids: [2525] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:describe_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2530] ) ] spids: [2530] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ (${ VSub_Name describe_rc))} right: {(0)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(DQ ("== FAILED to describe ") (${ VSub_Name instance) (" =="))} ) (C {(echo)} {(DQ (${ VSub_Name new_instance_id))}) (C {(echo)} {(DQ (" (Will retry.)"))}) ] spids: [-1 2551] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name new_instance_id))} right: {(DQ (${ VSub_Name instance_id))} ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(echo)} {(-n)} {(.)})] spids: [2581 2602] ) ] else_action: [ (C {(echo)} {(DQ ("Instance ") (${ VSub_Name instance) (" recreated."))}) (ControlFlow token:<ControlFlow_Break break>) ] spids: [2612 2629] ) (C {(sleep)} {(1)}) ] spids: [2472 2637] ) ) (SimpleCommand words: [{(echo)} {(DQ ("== Waiting for new node to be added to k8s. =="))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[2651])] ) (While cond: [(Sentence child:(C {(true)}) terminator:<Op_Semi ";">)] body: (DoGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:external_id) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/kubectl.sh))} {(get)} {(node)} {(DQ (${ VSub_Name instance))} {(--output) (Lit_Other "=") (Lit_VarLike "jsonpath=") (SQ <"{.spec.externalID}">) } ] redirects: [ (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [2689] ) ] ) ] ) left_token: <Left_CommandSub "$("> spids: [2664 2691] ) } spids: [2663] ) ] spids: [2663] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kubectl_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2695] ) ] spids: [2695] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kubectl_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2700] ) ] spids: [2700] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ (${ VSub_Name kubectl_rc))} right: {(0)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(DQ ("== FAILED to get node ") (${ VSub_Name instance) (" =="))} ) (C {(echo)} {(DQ (${ VSub_Name external_id))}) (C {(echo)} {(DQ (" (Will retry.)"))}) ] spids: [-1 2721] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name external_id))} right: {(DQ (${ VSub_Name new_instance_id))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(DQ ("Node ") (${ VSub_Name instance) (" recreated."))}) (ControlFlow token:<ControlFlow_Break break>) ] spids: [2751 2772] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name external_id))} right: {(DQ (${ VSub_Name instance_id))} ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(echo)} {(-n)} {(.)})] spids: [2789 2810] ) ] else_action: [ (C {(echo)} { (DQ ("Unexpected external_id '") (${ VSub_Name external_id) ("' matches neither old ('") (${ VSub_Name instance_id) ("') nor new ('") (${ VSub_Name new_instance_id) ("').") ) } ) (C {(echo)} {(DQ (" (Will retry.)"))}) ] spids: [2820 2849] ) (C {(sleep)} {(1)}) ] spids: [2660 2857] ) ) (SimpleCommand words: [ {(echo)} {(DQ ("== Waiting for ") (${ VSub_Name instance) (" to become ready. =="))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[2879])] ) (While cond: [(Sentence child:(C {(true)}) terminator:<Op_Semi ";">)] body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cordoned) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/kubectl.sh))} {(get)} {(node)} {(DQ (${ VSub_Name instance))} {(--output) (Lit_Other "=") (SQ < "jsonpath={.status.conditions[?(@.type == \"SchedulingDisabled\")].status}" > ) } ) ] ) left_token: <Left_CommandSub "$("> spids: [2892 2915] ) } spids: [2891] ) ] spids: [2891] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ready) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/kubectl.sh))} {(get)} {(node)} {(DQ (${ VSub_Name instance))} {(--output) (Lit_Other "=") (SQ < "jsonpath={.status.conditions[?(@.type == \"Ready\")].status}" > ) } ) ] ) left_token: <Left_CommandSub "$("> spids: [2919 2942] ) } spids: [2918] ) ] spids: [2918] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name cordoned))} right: {(SQ <True>)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} { (DQ ("Node ") (${ VSub_Name instance) (" is still not ready: SchedulingDisabled=") (${ VSub_Name ready) ) } ) ] spids: [-1 2964] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ (${ VSub_Name ready))} right: {(SQ <True>)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} { (DQ ("Node ") (${ VSub_Name instance) (" is still not ready: Ready=") (${ VSub_Name ready) ) } ) ] spids: [2981 3000] ) ] else_action: [ (C {(echo)} {(DQ ("Node ") (${ VSub_Name instance) (" Ready=") (${ VSub_Name ready))} ) (ControlFlow token:<ControlFlow_Break break>) ] spids: [3017 3037] ) (C {(sleep)} {(1)}) ] spids: [2888 3045] ) ) ] spids: [2100] ) spids: [2094 2099] ) (FuncDef name: do-node-upgrade body: (BraceGroup children: [ (SimpleCommand words: [ {(echo)} { (DQ ("== Upgrading nodes to ") (${ VSub_Name KUBE_VERSION) (" with max parallelism of ") (${ VSub_Name node_upgrade_parallelism) (". ==") ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3079])] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:template_name) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get-template-name-from-version)} {(${ VSub_Name SANITIZED_VERSION)}) ] ) left_token: <Left_CommandSub "$("> spids: [3098 3104] ) } spids: [3097] ) ] spids: [3095] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:old_templates) op: Equal rhs: {(ArrayLiteralPart)} spids: [3109] ) ] spids: [3107] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:updates) op: Equal rhs: {(ArrayLiteralPart)} spids: [3116] ) ] spids: [3114] ) (ForEach iter_name: group iter_words: [ { (BracedVarSub token: <VSub_Name INSTANCE_GROUPS> bracket_op: (WholeArray op_id:Lit_At) spids: [3127 3132] ) } ] do_arg_iter: False body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:old_templates) op: PlusEqual rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (C {(gcloud)} {(compute)} {(instance-groups)} {(managed)} {(list)} {(--project) (Lit_Other "=") (DQ (${ VSub_Name PROJECT))} {(--filter) (Lit_Other "=") (DQ ("name ~ '") (${ VSub_Name group) ("' AND zone:(") (${ VSub_Name ZONE) (")") ) } {(--format) (Lit_Other "=") (SQ <"value(instanceTemplate)">)} ) (C {(true)}) ] op_id: Op_DPipe ) ] ) left_token: <Left_CommandSub "$("> spids: [3140 3188] ) } ] ) } spids: [3138] ) ] spids: [3138] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:set_instance_template_out) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(gcloud)} {(compute)} {(instance-groups)} {(managed)} {(set-instance-template)} {(DQ (${ VSub_Name group))} {(--template) (Lit_Other "=") (DQ (${ VSub_Name template_name)) } {(--project) (Lit_Other "=") (DQ (${ VSub_Name PROJECT))} {(--zone) (Lit_Other "=") (DQ (${ VSub_Name ZONE))} ] redirects: [ (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [3240] ) ] ) ] ) left_token: <Left_CommandSub "$("> spids: [3193 3242] ) } spids: [3192] ) ] spids: [3192] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:set_instance_template_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [3246] ) ] spids: [3246] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:set_instance_template_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [3251] ) ] spids: [3251] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ (${ VSub_Name set_instance_template_rc))} right: {(0)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} { (DQ ("== FAILED to set-instance-template for ") (${ VSub_Name group) (" to ") (${ VSub_Name template_name) (" ==") ) } ) (C {(echo)} {(DQ (${ VSub_Name set_instance_template_out))}) (ControlFlow token: <ControlFlow_Return return> arg_word: {(${ VSub_Name set_instance_template_rc)} ) ] spids: [-1 3272] ) ] spids: [-1 3306] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:instances) op: Equal rhs: {(ArrayLiteralPart)} spids: [3309] ) ] spids: [3309] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:instances) op: PlusEqual rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(gcloud)} {(compute)} {(instance-groups)} {(managed)} {(list-instances)} {(DQ (${ VSub_Name group))} {(--format) (Lit_Other "=") (SQ <"value(instance)">) } {(--project) (Lit_Other "=") (DQ (${ VSub_Name PROJECT)) } {(--zone) (Lit_Other "=") (DQ (${ VSub_Name ZONE))} ] redirects: [ (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [3361] ) ] ) ] ) left_token: <Left_CommandSub "$("> spids: [3316 3363] ) } ] ) } spids: [3314] ) ] spids: [3314] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:list_instances_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [3368] ) ] spids: [3368] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:list_instances_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [3373] ) ] spids: [3373] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ (${ VSub_Name list_instances_rc))} right: {(0)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} { (DQ ("== FAILED to list instances in group ") (${ VSub_Name group) (" ==") ) } ) (C {(echo)} {(DQ (${ VSub_Name instances))}) (ControlFlow token: <ControlFlow_Return return> arg_word: {(${ VSub_Name list_instances_rc)} ) ] spids: [-1 3394] ) ] spids: [-1 3424] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:process_count_left) op: Equal rhs: {(${ VSub_Name node_upgrade_parallelism)} spids: [3428] ) ] spids: [3428] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pids) op: Equal rhs: {(ArrayLiteralPart)} spids: [3434] ) ] spids: [3434] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ret_code_sum) op: Equal rhs: {(0)} spids: [3439] ) ] spids: [3439] ) (ForEach iter_name: instance iter_words: [ { (BracedVarSub token: <VSub_Name instances> bracket_op: (WholeArray op_id:Lit_At) spids: [3452 3457] ) } ] do_arg_iter: False body: (DoGroup children: [ (Sentence child: (C {(do-single-node-upgrade)} {(DQ (${ VSub_Name instance))}) terminator: <Op_Amp "&"> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pids) op: PlusEqual rhs: {(ArrayLiteralPart words:[{(DQ ($ VSub_Bang "$!"))}])} spids: [3473] ) ] spids: [3473] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:process_count_left) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithVarRef name:process_count_left) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [3495 3502] ) } spids: [3494] ) ] spids: [3494] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalOr left: (BoolBinary op_id: BoolBinary_eq left: {(process_count_left)} right: {(0)} ) right: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name instance))} right: { (DQ (BracedVarSub token: <VSub_Name instances> bracket_op: (ArrayIndex expr: (ArithUnary op_id: Node_UnaryMinus child: (ArithWord w:{(Lit_Digits 1)}) ) ) spids: [3526 3532] ) ) } ) ) ) terminator: <Op_Semi ";"> ) ] action: [ (ForEach iter_name: pid iter_words: [ { (DQ (BracedVarSub token: <VSub_Name pids> bracket_op: (WholeArray op_id:Lit_At) spids: [3552 3557] ) ) } ] do_arg_iter: False body: (DoGroup children: [ (C {(wait)} {($ VSub_Name "$pid")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ret_code_sum) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithVarRef name:ret_code_sum) right: (ArithWord w:{($ VSub_QMark "$?")}) ) spids: [3570 3579] ) } spids: [3569] ) ] spids: [3569] ) ] spids: [3561 3582] ) spids: [3550 3559] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(${ VSub_Name ret_code_sum)} right: {(0)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} { (DQ ("== Some of the ") (${ VSub_Name node_upgrade_parallelism) (" parallel node upgrades failed. ==") ) } ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(${ VSub_Name ret_code_sum)} ) ] spids: [-1 3604] ) ] spids: [-1 3625] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:process_count_left) op: Equal rhs: {(${ VSub_Name node_upgrade_parallelism)} spids: [3628] ) ] spids: [3628] ) ] spids: [-1 3538] ) ] spids: [-1 3634] ) ] spids: [3460 3637] ) spids: [3451 3458] ) ] spids: [3135 3640] ) spids: [3126 3133] ) (SimpleCommand words: [{(echo)} {(DQ ("== Deleting old templates in ") (${ VSub_Name PROJECT) (". =="))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3658])] ) (ForEach iter_name: tmpl iter_words: [ { (BracedVarSub token: <VSub_Name old_templates> bracket_op: (WholeArray op_id:Lit_At) spids: [3668 3673] ) } ] do_arg_iter: False body: (DoGroup children: [ (AndOr children: [ (C {(gcloud)} {(compute)} {(instance-templates)} {(delete)} {(--quiet)} {(--project) (Lit_Other "=") (DQ (${ VSub_Name PROJECT))} {(DQ (${ VSub_Name tmpl))} ) (C {(true)}) ] op_id: Op_DPipe ) ] spids: [3676 3714] ) spids: [3667 3674] ) (SimpleCommand words: [ {(echo)} {(DQ ("== Finished upgrading nodes to ") (${ VSub_Name KUBE_VERSION) (". =="))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3728])] ) ] spids: [3062] ) spids: [3056 3061] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:master_upgrade) op:Equal rhs:{(true)} spids:[3734])] spids: [3734] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:node_upgrade) op:Equal rhs:{(true)} spids:[3737])] spids: [3737] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:node_prereqs) op:Equal rhs:{(false)} spids:[3740])] spids: [3740] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:local_binaries) op:Equal rhs:{(false)} spids:[3743])] spids: [3743] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:env_os_distro) op:Equal rhs:{(false)} spids:[3746])] spids: [3746] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:node_upgrade_parallelism) op: Equal rhs: {(1)} spids: [3749] ) ] spids: [3749] ) (While cond: [(Sentence child:(C {(getopts)} {(DQ (":MNPlcho"))} {(opt)}) terminator:<Op_Semi ";">)] body: (DoGroup children: [ (Case to_match: {(${ VSub_Name opt)} arms: [ (case_arm pat_list: [{(M)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:node_upgrade) op: Equal rhs: {(false)} spids: [3780] ) ] spids: [3780] ) ] spids: [3776 3777 3784 -1] ) (case_arm pat_list: [{(N)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:master_upgrade) op: Equal rhs: {(false)} spids: [3791] ) ] spids: [3791] ) ] spids: [3787 3788 3795 -1] ) (case_arm pat_list: [{(P)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:node_prereqs) op: Equal rhs: {(true)} spids: [3802] ) ] spids: [3802] ) ] spids: [3798 3799 3806 -1] ) (case_arm pat_list: [{(l)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:local_binaries) op: Equal rhs: {(true)} spids: [3813] ) ] spids: [3813] ) ] spids: [3809 3810 3817 -1] ) (case_arm pat_list: [{(c)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:node_upgrade_parallelism) op: Equal rhs: { (BracedVarSub token: <VSub_Name NODE_UPGRADE_PARALLELISM> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(1)}) spids: [3825 3829] ) } spids: [3824] ) ] spids: [3824] ) ] spids: [3820 3821 3832 -1] ) (case_arm pat_list: [{(o)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:env_os_distro) op: Equal rhs: {(true)} spids: [3839] ) ] spids: [3839] ) ] spids: [3835 3836 3843 -1] ) (case_arm pat_list: [{(h)}] action: [(C {(usage)}) (C {(exit)} {(0)})] spids: [3846 3847 3858 -1] ) (case_arm pat_list: [{(EscapedLiteralPart token:<Lit_EscapedChar "\\?">)}] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Invalid option: -") ($ VSub_Name "$OPTARG"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3872])] ) (C {(usage)}) (C {(exit)} {(1)}) ] spids: [3861 3862 3884 -1] ) ] spids: [3767 3773 3887] ) ] spids: [3764 3889] ) ) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithVarRef name:OPTIND) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [3893 3898] ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id:BoolBinary_gt left:{($ VSub_Pound "$#")} right:{(1)}) ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ( "Error: Only one parameter (<version number or publication>) may be passed after the set of flags!" ) ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[3923])] ) (C {(usage)}) (C {(exit)} {(1)}) ] spids: [-1 3914] ) ] spids: [-1 3934] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (BoolBinary op_id:BoolBinary_lt left:{($ VSub_Pound "$#")} right:{(1)}) ) (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name local_binaries))} right: {(DQ (false))} ) ) ] op_id: Op_DAmp ) terminator: <Op_Semi ";"> ) ] action: [(C {(usage)}) (C {(exit)} {(1)})] spids: [-1 3968] ) ] spids: [-1 3978] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name master_upgrade))} right: {(DQ (false))} ) ) (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name node_upgrade))} right: {(DQ (false))} ) ) ] op_id: Op_DAmp ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Can't specify both -M and -N"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[4027])] ) (C {(exit)} {(1)}) ] spids: [-1 4018] ) ] spids: [-1 4035] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (BoolUnary op_id: BoolUnary_z child: { (DQ (BracedVarSub token: <VSub_Name STORAGE_MEDIA_TYPE> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [4048 4051] ) ) } ) ) (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: { (DQ (BracedVarSub token: <VSub_Name STORAGE_BACKEND> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [4061 4064] ) ) } right: {(DQ (etcd2))} ) ) (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name master_upgrade))} right: {(DQ (true))} ) ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} { (DQ ( "The default etcd storage media type in 1.6 has changed from application/json to application/vnd.kubernetes.protobuf." ) ) } ) (C {(echo)} { (DQ ( "Documentation about the change can be found at https://kubernetes.io/docs/admin/etcd_upgrade." ) ) } ) (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ( "ETCD2 DOES NOT SUPPORT PROTOBUF: If you wish to have to ability to downgrade to etcd2 later application/json must be used." ) ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("It's HIGHLY recommended that etcd be backed up before this step!!"))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("To enable using json, before running this script set:"))}) (C {(echo)} {(DQ ("export STORAGE_MEDIA_TYPE=application/json"))}) (C {(echo)} {(DQ )}) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(Lit_Other "[")} {(-t)} {(0)} {(Lit_Other "]")}) (C {(Lit_Other "[")} {(-t)} {(1)} {(Lit_Other "]")}) ] op_id: Op_DAmp ) terminator: <Op_Semi ";"> ) ] action: [ (C {(read)} {(-p)} { (DQ ( "Would you like to continue with the new default, and lose the ability to downgrade to etcd2? [y/N] " ) ) } {(confirm)} ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ (${ VSub_Name confirm))} right: {(DQ (y))} ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(exit)} {(1)})] spids: [-1 4217] ) ] spids: [-1 4225] ) ] spids: [-1 4184] ) ] else_action: [ (C {(echo)} {(DQ ("To enable using protobuf, before running this script set:"))}) (C {(echo)} {(DQ ("export STORAGE_MEDIA_TYPE=application/vnd.kubernetes.protobuf"))}) (C {(echo)} {(DQ )}) (SimpleCommand words: [ {(echo)} {(DQ ("STORAGE_MEDIA_TYPE must be specified when run non-interactively."))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[4257])] ) (C {(exit)} {(1)}) ] spids: [4228 4266] ) ] spids: [-1 4094] ) ] spids: [-1 4268] ) (C {(print-node-version-info)} {(DQ (Pre-Upgrade))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name local_binaries))} right: {(DQ (false))} ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(set_binary_version)} {(${ VSub_Number 1)})] spids: [-1 4297] ) ] spids: [-1 4306] ) (C {(prepare-upgrade)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name node_prereqs))} right: {(DQ (true))} ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(prepare-node-upgrade)}) (C {(exit)} {(0)})] spids: [-1 4331] ) ] spids: [-1 4341] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name master_upgrade))} right: {(DQ (true))} ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(upgrade-master)})] spids: [-1 4363] ) ] spids: [-1 4368] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name node_upgrade))} right: {(DQ (true))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name local_binaries))} right: {(DQ (true))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {(DQ ("Upgrading nodes to local binaries is not yet supported."))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[4421])] ) (C {(exit)} {(1)}) ] spids: [-1 4412] ) ] else_action: [(C {(upgrade-nodes)})] spids: [4430 4436] ) ] spids: [-1 4390] ) ] spids: [-1 4438] ) (C {(echo)} {(DQ ("== Validating cluster post-upgrade =="))}) (C {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/validate-cluster.sh))}) (C {(print-node-version-info)} {(DQ (Post-Upgrade))}) ] )