(CommandList
  children: [
    (C {(set)} {(-o)} {(errexit)})
    (C {(set)} {(-o)} {(nounset)})
    (C {(set)} {(-o)} {(pipefail)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:KUBE_ROOT)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [83 91]
              ) (/..)
            }
          spids: [82]
        )
      ]
      spids: [82]
    )
    (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/hack/lib/init.sh))})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:KUBECTL)
          op: Equal
          rhs: {(DQ (${ VSub_Name KUBE_OUTPUT_HOSTBIN) (/kubectl))}
          spids: [104]
        )
      ]
      spids: [104]
    )
    (Assignment
      keyword: Assign_Declare
      flags: [-a]
      pairs: [
        (assign_pair
          lhs: (LhsName name:resources)
          op: Equal
          rhs: 
            {
              (ArrayLiteralPart
                words: [
                  {(DQ (endpoints))}
                  {(DQ (events))}
                  {(DQ (limitranges))}
                  {(DQ (namespaces))}
                  {(DQ (nodes))}
                  {(DQ (pods))}
                  {(DQ (persistentvolumes))}
                  {(DQ (persistentvolumeclaims))}
                  {(DQ (replicationcontrollers))}
                  {(DQ (resourcequotas))}
                  {(DQ (secrets))}
                  {(DQ (services))}
                  {(DQ (jobs))}
                  {(DQ (horizontalpodautoscalers))}
                  {(DQ (storageclasses))}
                  {(DQ (roles.rbac.authorization.k8s.io))}
                  {(DQ (rolebindings.rbac.authorization.k8s.io))}
                  {(DQ (clusterroles.rbac.authorization.k8s.io))}
                  {(DQ (clusterrolebindings.rbac.authorization.k8s.io))}
                ]
              )
            }
          spids: [126]
        )
      ]
      spids: [122]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:namespaces)
          op: Equal
          rhs: 
            {
              (ArrayLiteralPart
                words: [
                  {
                    (CommandSubPart
                      command_list: 
                        (CommandList
                          children: [
                            (C {(DQ (${ VSub_Name KUBECTL))} {(get)} {(namespaces)} {(-o)} 
                              {(go-template) (Lit_Other '=') 
                                (DQ ('{{range.items}}{{.metadata.name}} {{end}}'))
                              }
                            )
                          ]
                        )
                      left_token: <Left_CommandSub '$('>
                      spids: [233 251]
                    )
                  }
                ]
              )
            }
          spids: [230]
        )
      ]
      spids: [230]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (C {(Lit_Other '[')} {(-z)} 
              {
                (DQ 
                  (BracedVarSub
                    token: <VSub_Name namespaces>
                    suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                    spids: [261 264]
                  )
                )
              } {(Lit_Other ']')}
            )
          ]
          action: [
            (C {(echo)} {(DQ ('Unexpected: No namespace found. Nothing to do.'))})
            (C {(exit)} {(1)})
          ]
          spids: [16777215 269]
        )
      ]
      spids: [16777215 283]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:all_failed) op:Equal rhs:{(1)} spids:[286])]
      spids: [286]
    )
    (ForEach
      iter_name: resource
      iter_words: [
        {
          (DQ 
            (BracedVarSub
              token: <VSub_Name resources>
              bracket_op: (WholeArray op_id:Lit_At)
              spids: [297 302]
            )
          )
        }
      ]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (ForEach
              iter_name: namespace
              iter_words: [
                {
                  (DQ 
                    (BracedVarSub
                      token: <VSub_Name namespaces>
                      bracket_op: (WholeArray op_id:Lit_At)
                      spids: [315 320]
                    )
                  )
                }
              ]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (C {(set)} {(Lit_Other '+') (e)})
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:instances)
                          op: Equal
                          rhs: 
                            {
                              (ArrayLiteralPart
                                words: [
                                  {
                                    (CommandSubPart
                                      command_list: 
                                        (CommandList
                                          children: [
                                            (C {(DQ (${ VSub_Name KUBECTL))} {(get)} 
                                              {(DQ (${ VSub_Name resource))} {(--namespace) (Lit_Other '=') (DQ (${ VSub_Name namespace))} {(-o)} 
                                              {(go-template) (Lit_Other '=') 
                                                (DQ ('{{range.items}}{{.metadata.name}} {{end}}'))
                                              }
                                            )
                                          ]
                                        )
                                      left_token: <Left_CommandSub '$('>
                                      spids: [348 378]
                                    )
                                  }
                                ]
                              )
                            }
                          spids: [345]
                        )
                      ]
                      spids: [345]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:result)
                          op: Equal
                          rhs: {($ VSub_QMark '$?')}
                          spids: [382]
                        )
                      ]
                      spids: [382]
                    )
                    (C {(set)} {(-e)})
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: 
                                    (LogicalAnd
                                      left: 
                                        (BoolBinary
                                          op_id: BoolBinary_eq
                                          left: {(DQ (${ VSub_Name all_failed))}
                                          right: {(1)}
                                        )
                                      right: 
                                        (BoolBinary
                                          op_id: BoolBinary_eq
                                          left: {(DQ (${ VSub_Name result))}
                                          right: {(0)}
                                        )
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:all_failed)
                                  op: Equal
                                  rhs: {(0)}
                                  spids: [424]
                                )
                              ]
                              spids: [424]
                            )
                          ]
                          spids: [16777215 421]
                        )
                      ]
                      spids: [16777215 428]
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (DBracket
                              expr: 
                                (BoolUnary
                                  op_id: BoolUnary_z
                                  child: 
                                    {
                                      (DQ 
                                        (BracedVarSub
                                          token: <VSub_Name instances>
                                          suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                                          spids: [443 446]
                                        )
                                      )
                                    }
                                )
                            )
                          ]
                          action: [(ControlFlow token:<ControlFlow_Continue continue>)]
                          spids: [16777215 452]
                        )
                      ]
                      spids: [16777215 458]
                    )
                    (ForEach
                      iter_name: instance
                      iter_words: [
                        {
                          (DQ 
                            (BracedVarSub
                              token: <VSub_Name instances>
                              bracket_op: (WholeArray op_id:Lit_At)
                              spids: [468 473]
                            )
                          )
                        }
                      ]
                      do_arg_iter: False
                      body: 
                        (DoGroup
                          children: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:success)
                                  op: Equal
                                  rhs: {(0)}
                                  spids: [500]
                                )
                              ]
                              spids: [500]
                            )
                            (ForExpr
                              init: 
                                (BinaryAssign
                                  op_id: Arith_Equal
                                  left: (LhsName name:tries)
                                  right: (ArithWord w:{(Lit_Digits 0)})
                                )
                              cond: 
                                (ArithBinary
                                  op_id: Arith_Less
                                  left: (ArithVarRef name:tries)
                                  right: (ArithWord w:{(Lit_Digits 5)})
                                )
                              update: (UnaryAssign op_id:Arith_DPlus child:(LhsName name:tries))
                              body: 
                                (DoGroup
                                  children: [
                                    (Assignment
                                      keyword: Assign_None
                                      pairs: [
                                        (assign_pair
                                          lhs: (LhsName name:filename)
                                          op: Equal
                                          rhs: 
                                            {
                                              (DQ (/tmp/k8s-) (${ VSub_Name namespace) (-) 
                                                (${ VSub_Name resource) (-) (${ VSub_Name instance) (.json)
                                              )
                                            }
                                          spids: [528]
                                        )
                                      ]
                                      spids: [528]
                                    )
                                    (AndOr
                                      children: [
                                        (Subshell
                                          child: 
                                            (SimpleCommand
                                              words: [
                                                {(DQ (${ VSub_Name KUBECTL))}
                                                {(get)}
                                                {(DQ (${ VSub_Name resource))}
                                                {(DQ (${ VSub_Name instance))}
                                                {(--namespace) (Lit_Other '=') 
                                                  (DQ (${ VSub_Name namespace))
                                                }
                                                {(-o)}
                                                {(json)}
                                              ]
                                              redirects: [
                                                (Redir
                                                  op_id: Redir_Great
                                                  fd: 16777215
                                                  arg_word: {(DQ (${ VSub_Name filename))}
                                                  spids: [580]
                                                )
                                              ]
                                            )
                                          spids: [546 588]
                                        )
                                        (C {(true)})
                                      ]
                                      op_id: Op_DPipe
                                    )
                                    (If
                                      arms: [
                                        (if_arm
                                          cond: [
                                            (DBracket
                                              expr: 
                                                (LogicalNot
                                                  child: 
                                                    (BoolUnary
                                                      op_id: BoolUnary_s
                                                      child: {(DQ (${ VSub_Name filename))}
                                                    )
                                                )
                                            )
                                          ]
                                          action: [
                                            (C {(echo)} 
                                              {
                                                (DQ ('Looks like ') (${ VSub_Name instance) 
                                                  (' got deleted. Ignoring it')
                                                )
                                              }
                                            )
                                            (ControlFlow
                                              token: <ControlFlow_Continue continue>
                                            )
                                          ]
                                          spids: [16777215 612]
                                        )
                                      ]
                                      spids: [16777215 637]
                                    )
                                    (AndOr
                                      children: [
                                        (Assignment
                                          keyword: Assign_None
                                          pairs: [
                                            (assign_pair
                                              lhs: (LhsName name:output)
                                              op: Equal
                                              rhs: 
                                                {
                                                  (CommandSubPart
                                                    command_list: 
                                                      (CommandList
                                                        children: [
                                                          (C {(DQ (${ VSub_Name KUBECTL))} {(replace)} 
                                                            {(-f)} {(DQ (${ VSub_Name filename))} {(--namespace) (Lit_Other '=') (DQ (${ VSub_Name namespace))}
                                                          )
                                                        ]
                                                      )
                                                    left_token: <Left_CommandSub '$('>
                                                    spids: [641 665]
                                                  )
                                                }
                                              spids: [640]
                                            )
                                          ]
                                          spids: [640]
                                        )
                                        (C {(true)})
                                      ]
                                      op_id: Op_DPipe
                                    )
                                    (C {(rm)} {(DQ (${ VSub_Name filename))})
                                    (If
                                      arms: [
                                        (if_arm
                                          cond: [
                                            (C {(Lit_Other '[')} {(-n)} 
                                              {
                                                (DQ 
                                                  (BracedVarSub
                                                    token: <VSub_Name output>
                                                    suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                                                    spids: [688 691]
                                                  )
                                                )
                                              } {(Lit_Other ']')}
                                            )
                                          ]
                                          action: [
                                            (Assignment
                                              keyword: Assign_None
                                              pairs: [
                                                (assign_pair
                                                  lhs: (LhsName name:success)
                                                  op: Equal
                                                  rhs: {(1)}
                                                  spids: [700]
                                                )
                                              ]
                                              spids: [700]
                                            )
                                            (ControlFlow
                                              token: <ControlFlow_Break break>
                                            )
                                          ]
                                          spids: [16777215 697]
                                        )
                                      ]
                                      spids: [16777215 707]
                                    )
                                  ]
                                  spids: [525 710]
                                )
                            )
                            (If
                              arms: [
                                (if_arm
                                  cond: [
                                    (DBracket
                                      expr: 
                                        (BoolBinary
                                          op_id: BoolBinary_eq
                                          left: {(DQ (${ VSub_Name success))}
                                          right: {(0)}
                                        )
                                    )
                                  ]
                                  action: [
                                    (C {(echo)} 
                                      {
                                        (DQ ('Error: failed to update ') (${ VSub_Name resource) (/) 
                                          (${ VSub_Name instance) (' in ') (${ VSub_Name namespace) (' namespace after 5 tries')
                                        )
                                      }
                                    )
                                    (C {(exit)} {(1)})
                                  ]
                                  spids: [16777215 730]
                                )
                              ]
                              spids: [16777215 757]
                            )
                          ]
                          spids: [477 760]
                        )
                      spids: [466 16777215]
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (AndOr
                              children: [
                                (DBracket
                                  expr: 
                                    (BoolBinary
                                      op_id: BoolBinary_GlobDEqual
                                      left: {(DQ (${ VSub_Name resource))}
                                      right: {(DQ (namespaces))}
                                    )
                                )
                                (DBracket
                                  expr: 
                                    (BoolBinary
                                      op_id: BoolBinary_GlobDEqual
                                      left: {(DQ (${ VSub_Name resource))}
                                      right: {(DQ (nodes))}
                                    )
                                )
                              ]
                              op_id: Op_DPipe
                            )
                          ]
                          action: [(ControlFlow token:<ControlFlow_Break break>)]
                          spids: [16777215 800]
                        )
                      ]
                      spids: [16777215 814]
                    )
                  ]
                  spids: [324 817]
                )
              spids: [313 16777215]
            )
          ]
          spids: [305 819]
        )
      spids: [295 16777215]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_eq
                      left: {(DQ (${ VSub_Name all_failed))}
                      right: {(1)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(echo)} {(DQ ('kubectl get failed for all resources'))}) (C {(exit)} {(1)})]
          spids: [16777215 839]
        )
      ]
      spids: [16777215 853]
    )
    (C {(echo)} {(DQ ('All objects updated successfully!!'))})
    (C {(exit)} {(0)})
  ]
)