(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:16777215 arg_word:{(2)} spids:[107])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [16777215 94]
        )
      ]
      spids: [16777215 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: [16777215 496]
                )
              ]
              spids: [16777215 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: [16777215 702]
                )
              ]
              spids: [16777215 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: [16777215 798]
                )
              ]
              spids: [16777215 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: 16777215
                      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: 16777215
                      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: 16777215
                          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: 16777215
                          arg_word: {(ca-config.json)}
                          spids: [902]
                        )
                      ]
                    )
                    (Pipeline
                      children: [
                        (SimpleCommand
                          words: [{(cat)}]
                          redirects: [
                            (HereDoc
                              op_id: Redir_DLess
                              fd: 16777215
                              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: [966]
                            )
                          ]
                        )
                        (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 1036]
            )
            (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: [1040 1063]
                      )
                    }
                  spids: [1039]
                )
              ]
              spids: [1039]
            )
            (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: [1067 1090]
                      )
                    }
                  spids: [1066]
                )
              ]
              spids: [1066]
            )
          ]
          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:[1114])]
              spids: [1112]
            )
            (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: [1123 1126]
                                  )
                                }
                            )
                        )
                      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: [1134]
                        )
                      ]
                      spids: [1134]
                    )
                  ]
                  spids: [16777215 1131]
                )
                (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: [1153 1156]
                                  )
                                }
                            )
                        )
                      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: [1164]
                        )
                      ]
                      spids: [1164]
                    )
                  ]
                  spids: [1147 1161]
                )
              ]
              else_action: [
                (C {(echo)} {(DQ ("can't get auth credentials for the current master"))})
                (C {(exit)} {(1)})
              ]
              spids: [1180 1195]
            )
            (Until
              cond: [
                (Sentence
                  child: 
                    (C {(curl)} {(--insecure)} 
                      {
                        (DQ 
                          (BracedVarSub
                            token: <VSub_Name curl_auth_arg>
                            bracket_op: (WholeArray op_id:Lit_At)
                            spids: [1206 1211]
                          )
                        )
                      } {(--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: [1237 1252]
                )
            )
            (C {(echo)} {(DQ ('== Done =='))})
          ]
          spids: [1101]
        )
      spids: [1095 1100]
    )
    (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: [1283]
        )
      spids: [1277 1282]
    )
    (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: [1364 1369]
                  )
                }
                {(--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:[1381])]
            )
          ]
          spids: [1339]
        )
      spids: [1333 1338]
    )
    (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: [1411]
        )
      spids: [1405 1410]
    )
    (FuncDef
      name: upgrade-nodes
      body: (BraceGroup children:[(C {(prepare-node-upgrade)}) (C {(do-node-upgrade)})] spids:[1512])
      spids: [1506 1511]
    )
    (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: [1566 1571]
                                            )
                                          )
                                        }
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [1562 1573]
                              )
                            }
                          spids: [1561]
                        )
                      ]
                      spids: [1561]
                    )
                    (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: [1599]
                                )
                              ]
                              spids: [1599]
                            )
                          ]
                          spids: [16777215 1596]
                        )
                      ]
                      spids: [16777215 1605]
                    )
                    (C {(source)} 
                      {
                        (DQ (${ VSub_Name KUBE_ROOT) (/cluster/gce/) 
                          (${ VSub_Name NODE_OS_DISTRIBUTION) (/node-helper.sh)
                        )
                      }
                    )
                    (C {(set-node-image)})
                  ]
                  spids: [16777215 1551]
                )
              ]
              spids: [16777215 1631]
            )
          ]
          spids: [1529]
        )
      spids: [1523 1528]
    )
    (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:16777215 arg_word:{(2)} spids:[1715])]
            )
            (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: [1724 1738]
                      )
                    }
                  spids: [1723]
                )
              ]
              spids: [1723]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:scope_flags) op:Equal rhs:{(SQ )} spids:[1748])]
              spids: [1746]
            )
            (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: [1769]
                        )
                      ]
                      spids: [1769]
                    )
                  ]
                  spids: [16777215 1766]
                )
              ]
              else_action: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:scope_flags)
                      op: Equal
                      rhs: {(DQ (--no-scopes))}
                      spids: [1781]
                    )
                  ]
                  spids: [1781]
                )
              ]
              spids: [1778 1787]
            )
            (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: [1798 1800]
                      )
                    }
                  spids: [1797]
                )
              ]
              spids: [1795]
            )
            (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: [1804 1816]
                      )
                    }
                  spids: [1803]
                )
              ]
              spids: [1803]
            )
            (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: [1820 1832]
                      )
                    }
                  spids: [1819]
                )
              ]
              spids: [1819]
            )
            (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: [1836 1848]
                      )
                    }
                  spids: [1835]
                )
              ]
              spids: [1835]
            )
            (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: [1852 1864]
                      )
                    }
                  spids: [1851]
                )
              ]
              spids: [1851]
            )
            (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: [1868 1880]
                      )
                    }
                  spids: [1867]
                )
              ]
              spids: [1867]
            )
            (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: [1884 1896]
                      )
                    }
                  spids: [1883]
                )
              ]
              spids: [1883]
            )
            (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: [1900 1912]
                      )
                    }
                  spids: [1899]
                )
              ]
              spids: [1899]
            )
            (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: [1943 1949]
                      )
                    }
                  spids: [1942]
                )
              ]
              spids: [1940]
            )
            (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:16777215 arg_word:{(2)} spids:[1985])]
            )
          ]
          spids: [1702]
        )
      spids: [1696 1701]
    )
    (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: [2020 2023]
                                        )
                                      )
                                    }
                                  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: [2035 2038]
                                        )
                                      )
                                    }
                                  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: [2058 2060]
                              )
                            }
                          spids: [2057]
                        )
                      ]
                      spids: [2055]
                    )
                    (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: [2064 2076]
                              )
                            }
                          spids: [2063]
                        )
                      ]
                      spids: [2063]
                    )
                  ]
                  spids: [16777215 2049]
                )
              ]
              spids: [16777215 2079]
            )
          ]
          spids: [1997]
        )
      spids: [1991 1996]
    )
    (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: [2109]
                )
              ]
              spids: [2105]
            )
            (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: [2159]
                                      )
                                    ]
                                  )
                                ]
                              )
                            left_token: <Left_CommandSub '$('>
                            spids: [2116 2161]
                          )
                        }
                      spids: [2115]
                    )
                  ]
                  spids: [2115]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:describe_rc)
                          op: Equal
                          rhs: {($ VSub_QMark '$?')}
                          spids: [2165]
                        )
                      ]
                      spids: [2165]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:describe_rc)
                          op: Equal
                          rhs: {($ VSub_QMark '$?')}
                          spids: [2170]
                        )
                      ]
                      spids: [2170]
                    )
                  ]
                  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: [16777215 2191]
                )
              ]
              spids: [16777215 2221]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ('== Draining ') (${ VSub_Name instance) ('. == '))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[2239])]
            )
            (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: [2268]
                        )
                      ]
                      spids: [2268]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:drain_rc)
                          op: Equal
                          rhs: {($ VSub_QMark '$?')}
                          spids: [2273]
                        )
                      ]
                      spids: [2273]
                    )
                  ]
                  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: [16777215 2294]
                )
              ]
              spids: [16777215 2315]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ('== Recreating instance ') (${ VSub_Name instance) ('. =='))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[2333])]
            )
            (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: [2385]
                                      )
                                    ]
                                  )
                                ]
                              )
                            left_token: <Left_CommandSub '$('>
                            spids: [2338 2387]
                          )
                        }
                      spids: [2337]
                    )
                  ]
                  spids: [2337]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:recreate_rc)
                          op: Equal
                          rhs: {($ VSub_QMark '$?')}
                          spids: [2391]
                        )
                      ]
                      spids: [2391]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:recreate_rc)
                          op: Equal
                          rhs: {($ VSub_QMark '$?')}
                          spids: [2396]
                        )
                      ]
                      spids: [2396]
                    )
                  ]
                  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: [16777215 2417]
                )
              ]
              spids: [16777215 2447]
            )
            (SimpleCommand
              words: [
                {(echo)}
                {(DQ ('== Waiting for instance ') (${ VSub_Name instance) (' to be recreated. =='))}
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[2465])]
            )
            (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: [2521]
                                              )
                                            ]
                                          )
                                        ]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                    spids: [2478 2523]
                                  )
                                }
                              spids: [2477]
                            )
                          ]
                          spids: [2477]
                        )
                        (AndOr
                          children: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:describe_rc)
                                  op: Equal
                                  rhs: {($ VSub_QMark '$?')}
                                  spids: [2527]
                                )
                              ]
                              spids: [2527]
                            )
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:describe_rc)
                                  op: Equal
                                  rhs: {($ VSub_QMark '$?')}
                                  spids: [2532]
                                )
                              ]
                              spids: [2532]
                            )
                          ]
                          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: [16777215 2553]
                        )
                        (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: [2583 2604]
                        )
                      ]
                      else_action: [
                        (C {(echo)} {(DQ ('Instance ') (${ VSub_Name instance) (' recreated.'))})
                        (ControlFlow token:<ControlFlow_Break break>)
                      ]
                      spids: [2614 2631]
                    )
                    (C {(sleep)} {(1)})
                  ]
                  spids: [2474 2639]
                )
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ('== Waiting for new node to be added to k8s.  =='))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[2653])]
            )
            (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: [2691]
                                              )
                                            ]
                                          )
                                        ]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                    spids: [2666 2693]
                                  )
                                }
                              spids: [2665]
                            )
                          ]
                          spids: [2665]
                        )
                        (AndOr
                          children: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:kubectl_rc)
                                  op: Equal
                                  rhs: {($ VSub_QMark '$?')}
                                  spids: [2697]
                                )
                              ]
                              spids: [2697]
                            )
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:kubectl_rc)
                                  op: Equal
                                  rhs: {($ VSub_QMark '$?')}
                                  spids: [2702]
                                )
                              ]
                              spids: [2702]
                            )
                          ]
                          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: [16777215 2723]
                        )
                        (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: [2753 2774]
                        )
                        (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: [2791 2812]
                        )
                      ]
                      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: [2822 2851]
                    )
                    (C {(sleep)} {(1)})
                  ]
                  spids: [2662 2859]
                )
            )
            (SimpleCommand
              words: [
                {(echo)}
                {(DQ ('== Waiting for ') (${ VSub_Name instance) (' to become ready. =='))}
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[2881])]
            )
            (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: [2894 2917]
                              )
                            }
                          spids: [2893]
                        )
                      ]
                      spids: [2893]
                    )
                    (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: [2921 2944]
                              )
                            }
                          spids: [2920]
                        )
                      ]
                      spids: [2920]
                    )
                    (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: [16777215 2966]
                        )
                        (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: [2983 3002]
                        )
                      ]
                      else_action: [
                        (C {(echo)} 
                          {(DQ ('Node ') (${ VSub_Name instance) (' Ready=') (${ VSub_Name ready))}
                        )
                        (ControlFlow token:<ControlFlow_Break break>)
                      ]
                      spids: [3019 3039]
                    )
                    (C {(sleep)} {(1)})
                  ]
                  spids: [2890 3047]
                )
            )
          ]
          spids: [2102]
        )
      spids: [2096 2101]
    )
    (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:16777215 arg_word:{(2)} spids:[3081])]
            )
            (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: [3100 3106]
                      )
                    }
                  spids: [3099]
                )
              ]
              spids: [3097]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:old_templates)
                  op: Equal
                  rhs: {(ArrayLiteralPart)}
                  spids: [3111]
                )
              ]
              spids: [3109]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:updates)
                  op: Equal
                  rhs: {(ArrayLiteralPart)}
                  spids: [3118]
                )
              ]
              spids: [3116]
            )
            (ForEach
              iter_name: group
              iter_words: [
                {
                  (BracedVarSub
                    token: <VSub_Name INSTANCE_GROUPS>
                    bracket_op: (WholeArray op_id:Lit_At)
                    spids: [3129 3134]
                  )
                }
              ]
              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: [3142 3190]
                                    )
                                  }
                                ]
                              )
                            }
                          spids: [3140]
                        )
                      ]
                      spids: [3140]
                    )
                    (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: [3242]
                                              )
                                            ]
                                          )
                                        ]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                    spids: [3195 3244]
                                  )
                                }
                              spids: [3194]
                            )
                          ]
                          spids: [3194]
                        )
                        (AndOr
                          children: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:set_instance_template_rc)
                                  op: Equal
                                  rhs: {($ VSub_QMark '$?')}
                                  spids: [3248]
                                )
                              ]
                              spids: [3248]
                            )
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:set_instance_template_rc)
                                  op: Equal
                                  rhs: {($ VSub_QMark '$?')}
                                  spids: [3253]
                                )
                              ]
                              spids: [3253]
                            )
                          ]
                          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: [16777215 3274]
                        )
                      ]
                      spids: [16777215 3308]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:instances)
                          op: Equal
                          rhs: {(ArrayLiteralPart)}
                          spids: [3311]
                        )
                      ]
                      spids: [3311]
                    )
                    (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: [3363]
                                                    )
                                                  ]
                                                )
                                              ]
                                            )
                                          left_token: <Left_CommandSub '$('>
                                          spids: [3318 3365]
                                        )
                                      }
                                    ]
                                  )
                                }
                              spids: [3316]
                            )
                          ]
                          spids: [3316]
                        )
                        (AndOr
                          children: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:list_instances_rc)
                                  op: Equal
                                  rhs: {($ VSub_QMark '$?')}
                                  spids: [3370]
                                )
                              ]
                              spids: [3370]
                            )
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:list_instances_rc)
                                  op: Equal
                                  rhs: {($ VSub_QMark '$?')}
                                  spids: [3375]
                                )
                              ]
                              spids: [3375]
                            )
                          ]
                          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: [16777215 3396]
                        )
                      ]
                      spids: [16777215 3426]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:process_count_left)
                          op: Equal
                          rhs: {(${ VSub_Name node_upgrade_parallelism)}
                          spids: [3430]
                        )
                      ]
                      spids: [3430]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:pids)
                          op: Equal
                          rhs: {(ArrayLiteralPart)}
                          spids: [3436]
                        )
                      ]
                      spids: [3436]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:ret_code_sum)
                          op: Equal
                          rhs: {(0)}
                          spids: [3441]
                        )
                      ]
                      spids: [3441]
                    )
                    (ForEach
                      iter_name: instance
                      iter_words: [
                        {
                          (BracedVarSub
                            token: <VSub_Name instances>
                            bracket_op: (WholeArray op_id:Lit_At)
                            spids: [3454 3459]
                          )
                        }
                      ]
                      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: [3475]
                                )
                              ]
                              spids: [3475]
                            )
                            (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: [3497 3504]
                                      )
                                    }
                                  spids: [3496]
                                )
                              ]
                              spids: [3496]
                            )
                            (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: [3528 3534]
                                                        )
                                                      )
                                                    }
                                                )
                                            )
                                        )
                                      terminator: <Op_Semi ';'>
                                    )
                                  ]
                                  action: [
                                    (ForEach
                                      iter_name: pid
                                      iter_words: [
                                        {
                                          (DQ 
                                            (BracedVarSub
                                              token: <VSub_Name pids>
                                              bracket_op: (WholeArray op_id:Lit_At)
                                              spids: [3554 3559]
                                            )
                                          )
                                        }
                                      ]
                                      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: [3572 3581]
                                                      )
                                                    }
                                                  spids: [3571]
                                                )
                                              ]
                                              spids: [3571]
                                            )
                                          ]
                                          spids: [3563 3584]
                                        )
                                      spids: [3552 3561]
                                    )
                                    (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: [16777215 3606]
                                        )
                                      ]
                                      spids: [16777215 3627]
                                    )
                                    (Assignment
                                      keyword: Assign_None
                                      pairs: [
                                        (assign_pair
                                          lhs: (LhsName name:process_count_left)
                                          op: Equal
                                          rhs: {(${ VSub_Name node_upgrade_parallelism)}
                                          spids: [3630]
                                        )
                                      ]
                                      spids: [3630]
                                    )
                                  ]
                                  spids: [16777215 3540]
                                )
                              ]
                              spids: [16777215 3636]
                            )
                          ]
                          spids: [3462 3639]
                        )
                      spids: [3453 3460]
                    )
                  ]
                  spids: [3137 3642]
                )
              spids: [3128 3135]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ('== Deleting old templates in ') (${ VSub_Name PROJECT) ('. =='))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[3660])]
            )
            (ForEach
              iter_name: tmpl
              iter_words: [
                {
                  (BracedVarSub
                    token: <VSub_Name old_templates>
                    bracket_op: (WholeArray op_id:Lit_At)
                    spids: [3670 3675]
                  )
                }
              ]
              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: [3678 3716]
                )
              spids: [3669 3676]
            )
            (SimpleCommand
              words: [
                {(echo)}
                {(DQ ('== Finished upgrading nodes to ') (${ VSub_Name KUBE_VERSION) ('. =='))}
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[3730])]
            )
          ]
          spids: [3064]
        )
      spids: [3058 3063]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:master_upgrade) op:Equal rhs:{(true)} spids:[3736])]
      spids: [3736]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:node_upgrade) op:Equal rhs:{(true)} spids:[3739])]
      spids: [3739]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:node_prereqs) op:Equal rhs:{(false)} spids:[3742])]
      spids: [3742]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:local_binaries) op:Equal rhs:{(false)} spids:[3745])]
      spids: [3745]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:env_os_distro) op:Equal rhs:{(false)} spids:[3748])]
      spids: [3748]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:node_upgrade_parallelism)
          op: Equal
          rhs: {(1)}
          spids: [3751]
        )
      ]
      spids: [3751]
    )
    (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: [3782]
                        )
                      ]
                      spids: [3782]
                    )
                  ]
                  spids: [3778 3779 3786 16777215]
                )
                (case_arm
                  pat_list: [{(N)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:master_upgrade)
                          op: Equal
                          rhs: {(false)}
                          spids: [3793]
                        )
                      ]
                      spids: [3793]
                    )
                  ]
                  spids: [3789 3790 3797 16777215]
                )
                (case_arm
                  pat_list: [{(P)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:node_prereqs)
                          op: Equal
                          rhs: {(true)}
                          spids: [3804]
                        )
                      ]
                      spids: [3804]
                    )
                  ]
                  spids: [3800 3801 3808 16777215]
                )
                (case_arm
                  pat_list: [{(l)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:local_binaries)
                          op: Equal
                          rhs: {(true)}
                          spids: [3815]
                        )
                      ]
                      spids: [3815]
                    )
                  ]
                  spids: [3811 3812 3819 16777215]
                )
                (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: [3827 3831]
                              )
                            }
                          spids: [3826]
                        )
                      ]
                      spids: [3826]
                    )
                  ]
                  spids: [3822 3823 3834 16777215]
                )
                (case_arm
                  pat_list: [{(o)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:env_os_distro)
                          op: Equal
                          rhs: {(true)}
                          spids: [3841]
                        )
                      ]
                      spids: [3841]
                    )
                  ]
                  spids: [3837 3838 3845 16777215]
                )
                (case_arm
                  pat_list: [{(h)}]
                  action: [(C {(usage)}) (C {(exit)} {(0)})]
                  spids: [3848 3849 3860 16777215]
                )
                (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: 16777215
                          arg_word: {(2)}
                          spids: [3874]
                        )
                      ]
                    )
                    (C {(usage)})
                    (C {(exit)} {(1)})
                  ]
                  spids: [3863 3864 3886 16777215]
                )
              ]
              spids: [3769 3775 3889]
            )
          ]
          spids: [3766 3891]
        )
    )
    (C {(shift)} 
      {
        (ArithSubPart
          anode: 
            (ArithBinary
              op_id: Arith_Minus
              left: (ArithVarRef name:OPTIND)
              right: (ArithWord w:{(Lit_Digits 1)})
            )
          spids: [3895 3900]
        )
      }
    )
    (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:16777215 arg_word:{(2)} spids:[3925])]
            )
            (C {(usage)})
            (C {(exit)} {(1)})
          ]
          spids: [16777215 3916]
        )
      ]
      spids: [16777215 3936]
    )
    (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: [16777215 3970]
        )
      ]
      spids: [16777215 3980]
    )
    (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:16777215 arg_word:{(2)} spids:[4029])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [16777215 4020]
        )
      ]
      spids: [16777215 4037]
    )
    (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: [4050 4053]
                                )
                              )
                            }
                        )
                    )
                    (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: [4063 4066]
                                    )
                                  )
                                }
                              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: [16777215 4219]
                        )
                      ]
                      spids: [16777215 4227]
                    )
                  ]
                  spids: [16777215 4186]
                )
              ]
              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:16777215 arg_word:{(2)} spids:[4259])]
                )
                (C {(exit)} {(1)})
              ]
              spids: [4230 4268]
            )
          ]
          spids: [16777215 4096]
        )
      ]
      spids: [16777215 4270]
    )
    (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: [16777215 4299]
        )
      ]
      spids: [16777215 4308]
    )
    (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: [16777215 4333]
        )
      ]
      spids: [16777215 4343]
    )
    (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: [16777215 4365]
        )
      ]
      spids: [16777215 4370]
    )
    (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: 16777215
                          arg_word: {(2)}
                          spids: [4423]
                        )
                      ]
                    )
                    (C {(exit)} {(1)})
                  ]
                  spids: [16777215 4414]
                )
              ]
              else_action: [(C {(upgrade-nodes)})]
              spids: [4432 4438]
            )
          ]
          spids: [16777215 4392]
        )
      ]
      spids: [16777215 4440]
    )
    (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))})
  ]
)