(CommandList
  children: [
    (C {(set)} {(-o)} {(nounset)})
    (C {(set)} {(-o)} {(pipefail)})
    (FuncDef
      name: docker_monitoring
      body: 
        (BraceGroup
          children: [
            (While
              cond: [
                (Sentence
                  child: (C {(Lit_Other '[')} {(1)} {(Lit_Other ']')})
                  terminator: <Op_Semi ';'>
                )
              ]
              body: 
                (DoGroup
                  children: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (Pipeline
                                  children: [
                                    (SimpleCommand
                                      words: [{(timeout)} {(60)} {(docker)} {(ps)}]
                                      redirects: [
                                        (Redir
                                          op_id: Redir_Great
                                          fd: 16777215
                                          arg_word: {(/dev/null)}
                                          spids: [107]
                                        )
                                      ]
                                    )
                                  ]
                                  negated: True
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} {(DQ ('Docker daemon failed!'))})
                            (C {(pkill)} {(docker)})
                            (C {(sleep)} {(30)})
                          ]
                          spids: [16777215 112]
                        )
                      ]
                      else_action: [(C {(sleep)} {(DQ (${ VSub_Name SLEEP_SECONDS))})]
                      spids: [136 148]
                    )
                  ]
                  spids: [92 151]
                )
            )
          ]
          spids: [80]
        )
      spids: [76 79]
    )
    (FuncDef
      name: kubelet_monitoring
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {(DQ ('Wait for 2 minutes for kubelet to be fuctional'))})
            (C {(sleep)} {(120)})
            (Assignment
              keyword: Assign_Local
              flags: [-r]
              pairs: [(assign_pair lhs:(LhsName name:max_seconds) op:Equal rhs:{(10)} spids:[183])]
              spids: [179]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:output) op:Equal rhs:{(DQ )} spids:[189])]
              spids: [187]
            )
            (While
              cond: [
                (Sentence
                  child: (C {(Lit_Other '[')} {(1)} {(Lit_Other ']')})
                  terminator: <Op_Semi ';'>
                )
              ]
              body: 
                (DoGroup
                  children: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (Pipeline
                                  children: [
                                    (Assignment
                                      keyword: Assign_None
                                      pairs: [
                                        (assign_pair
                                          lhs: (LhsName name:output)
                                          op: Equal
                                          rhs: 
                                            {
                                              (CommandSubPart
                                                command_list: 
                                                  (CommandList
                                                    children: [
                                                      (SimpleCommand
                                                        words: [
                                                          {(curl)}
                                                          {(--insecure)}
                                                          {(-m)}
                                                          {(DQ (${ VSub_Name max_seconds))}
                                                          {(-f)}
                                                          {(-s)}
                                                          {(-S)}
                                                          {(https) (Lit_Other ':') (//127.0.0.1) 
                                                            (Lit_Other ':') 
                                                            (BracedVarSub
                                                              token: <VSub_Name KUBELET_PORT>
                                                              suffix_op: 
                                                                (StringUnary
                                                                  op_id: VTest_ColonHyphen
                                                                  arg_word: {(10250)}
                                                                )
                                                              spids: [234 238]
                                                            ) (/healthz)
                                                          }
                                                        ]
                                                        redirects: [
                                                          (Redir
                                                            op_id: Redir_GreatAnd
                                                            fd: 2
                                                            arg_word: {(1)}
                                                            spids: [241]
                                                          )
                                                        ]
                                                      )
                                                    ]
                                                  )
                                                left_token: <Left_CommandSub '$('>
                                                spids: [211 243]
                                              )
                                            }
                                          spids: [210]
                                        )
                                      ]
                                      spids: [210]
                                    )
                                  ]
                                  negated: True
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} {($ VSub_Name '$output')})
                            (C {(echo)} {(DQ ('Kubelet is unhealthy!'))})
                            (C {(pkill)} {(kubelet)})
                            (C {(sleep)} {(60)})
                          ]
                          spids: [16777215 246]
                        )
                      ]
                      else_action: [(C {(sleep)} {(DQ (${ VSub_Name SLEEP_SECONDS))})]
                      spids: [279 291]
                    )
                  ]
                  spids: [203 294]
                )
            )
          ]
          spids: [160]
        )
      spids: [156 159]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: (BoolBinary op_id:BoolBinary_ne left:{(DQ ($ VSub_Pound '$#'))} right:{(1)})
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(echo)} {(DQ ('Usage: health-monitor.sh <docker/kubelet>'))}) (C {(exit)} {(1)})]
          spids: [16777215 318]
        )
      ]
      spids: [16777215 332]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:KUBE_ENV)
          op: Equal
          rhs: {(DQ (/home/kubernetes/kube-env))}
          spids: [335]
        )
      ]
      spids: [335]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (LogicalNot
                      child: (BoolUnary op_id:BoolUnary_e child:{(DQ (${ VSub_Name KUBE_ENV))})
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ ('The ') (${ VSub_Name KUBE_ENV) 
                  (' file does not exist!! Terminate health monitoring')
                )
              }
            )
            (C {(exit)} {(1)})
          ]
          spids: [16777215 357]
        )
      ]
      spids: [16777215 375]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:SLEEP_SECONDS) op:Equal rhs:{(10)} spids:[378])]
      spids: [378]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:component)
          op: Equal
          rhs: {($ VSub_Number '$1')}
          spids: [381]
        )
      ]
      spids: [381]
    )
    (C {(echo)} {(DQ ('Start kubernetes health monitoring for ') (${ VSub_Name component))})
    (C {(source)} {(DQ (${ VSub_Name KUBE_ENV))})
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: {(DQ (${ VSub_Name component))}
                      right: {(DQ (docker))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(docker_monitoring)})]
          spids: [16777215 420]
        )
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: {(DQ (${ VSub_Name component))}
                      right: {(DQ (kubelet))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(kubelet_monitoring)})]
          spids: [426 445]
        )
      ]
      else_action: [
        (C {(echo)} 
          {(DQ ('Health monitoring for component ')) (${ VSub_Name component) 
            (DQ (' is not supported!'))
          }
        )
      ]
      spids: [450 465]
    )
  ]
)