(List (Com {[LIT_CHARS set]} {[LIT_CHARS -o]} {[LIT_CHARS errexit]} ) (Com {[LIT_CHARS set]} {[LIT_CHARS -o]} {[LIT_CHARS nounset]} ) (Com {[LIT_CHARS set]} {[LIT_CHARS -o]} {[LIT_CHARS pipefail]} ) (= scope= flags=0 words=[] bindings=[('KUBE_ROOT', {[ComSub (Com {[LIT_CHARS dirname]} {[DQ [VarSub BASH_SOURCE]]})] [LIT_CHARS /..]})]) (If (Com {[LIT_DBRACKET_LIKE "["]} {[LIT_CHARS -f]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/env.sh]]} {[LIT_DBRACKET_LIKE "]"]} ) (Com {[LIT_CHARS source]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/env.sh]]} ) ) (Com {[LIT_CHARS source]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/lib/util.sh]]} ) (Com {[LIT_CHARS source]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/kube-util.sh]]} ) (FunctionDef kubectl_retry [] (List (= scope= flags=0 words=[] bindings=[('tries', {[LIT_CHARS 3]})]) (While (Pipeline! (Com {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/kubectl.sh]]} {[DQ [VarSub @]]} ) ) (List (= scope= flags=0 words=[] bindings=[('tries', {[ArithSub {A2 AS_OP_MINUS {A Atom NODE_ARITH_WORD {[VarSub tries]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}}]})]) (If (DBracket {B2 BINARY_INT_LE {[VarSub tries]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "('kubectl "][VarSub @][LIT_CHARS "' failed, giving up)"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (Com {[LIT_CHARS return]} {[LIT_CHARS 1]} ) ) ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "(kubectl failed, will retry "][VarSub tries][LIT_CHARS " times)"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (Com {[LIT_CHARS sleep]} {[LIT_CHARS 1]} ) ) ) ) ) (= scope= flags=0 words=[] bindings=[('ALLOWED_NOTREADY_NODES', {[DQ [VarSub ALLOWED_NOTREADY_NODES test_op=VS_TEST_COLON_HYPHEN {[LIT_CHARS 0]}]]})]) (= scope= flags=0 words=[] bindings=[('CLUSTER_READY_ADDITIONAL_TIME_SECONDS', {[DQ [VarSub CLUSTER_READY_ADDITIONAL_TIME_SECONDS test_op=VS_TEST_COLON_HYPHEN {[LIT_CHARS 30]}]]})]) (= scope= flags=0 words=[] bindings=[('EXPECTED_NUM_NODES', {[DQ [VarSub NUM_NODES]]})]) (If (DBracket {B2 BINARY_STRING_EQUAL {[DQ [VarSub REGISTER_MASTER_KUBELET test_op=VS_TEST_COLON_HYPHEN {}]]} {[DQ [LIT_CHARS true]]}}) (= scope= flags=0 words=[] bindings=[('EXPECTED_NUM_NODES', {[ArithSub {A2 AS_OP_PLUS {A Atom NODE_ARITH_WORD {[VarSub EXPECTED_NUM_NODES]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}}]})]) ) (= scope= flags=0 words=[] bindings=[('REQUIRED_NUM_NODES', {[ArithSub {A2 AS_OP_MINUS {A Atom NODE_ARITH_WORD {[VarSub EXPECTED_NUM_NODES]}} {A Atom NODE_ARITH_WORD {[VarSub ALLOWED_NOTREADY_NODES]}}}]})]) (= scope= flags=0 words=[] bindings=[('return_value', {[LIT_CHARS 0]})]) (= scope= flags=0 words=[] bindings=[('attempt', {[LIT_CHARS 0]})]) (= scope= flags=0 words=[] bindings=[('PAUSE_BETWEEN_ITERATIONS_SECONDS', {[LIT_CHARS 15]})]) (= scope= flags=0 words=[] bindings=[('ADDITIONAL_ITERATIONS', {[ArithSub {A2 AS_OP_SLASH {A2 AS_OP_MINUS {A2 AS_OP_PLUS {A Atom NODE_ARITH_WORD {[VarSub CLUSTER_READY_ADDITIONAL_TIME_SECONDS]}} {A Atom NODE_ARITH_WORD {[VarSub PAUSE_BETWEEN_ITERATIONS_SECONDS]}}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}} {A Atom NODE_ARITH_WORD {[VarSub PAUSE_BETWEEN_ITERATIONS_SECONDS]}}}]})]) (While (Com {[LIT_CHARS true]} ) (List (If (DBracket {B2 BINARY_INT_GT {[VarSub attempt]} {[LIT_CHARS 0]}}) (Com {[LIT_CHARS sleep]} {[LIT_CHARS 15]} ) ) (= scope= flags=0 words=[] bindings=[('attempt', {[ArithSub {A2 AS_OP_PLUS {A Atom NODE_ARITH_WORD {[VarSub attempt]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}}]})]) (AndOr OP_OR_IF (= scope= flags=0 words=[] bindings=[('node', {[ComSub (Com {[LIT_CHARS kubectl_retry]} {[LIT_CHARS get]} {[LIT_CHARS nodes]})]})]) (Com {[LIT_CHARS continue]} ) ) (= scope= flags=0 words=[] bindings=[('found', {[ArithSub {A2 AS_OP_MINUS {A Atom NODE_ARITH_WORD {[ComSub (Pipeline (Com {[LIT_CHARS echo]} {[DQ [VarSub node]]}) (Com {[LIT_CHARS wc]} {[LIT_CHARS -l]}) )]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}}]})]) (= scope= flags=0 words=[] bindings=[('ready', {[ArithSub {A2 AS_OP_MINUS {A Atom NODE_ARITH_WORD {[ComSub (Pipeline (Com {[LIT_CHARS echo]} {[DQ [VarSub node]]}) (Com {[LIT_CHARS grep]} {[LIT_CHARS -v]} {[DQ [LIT_CHARS NotReady]]}) (Com {[LIT_CHARS wc]} {[LIT_CHARS -l]}) )]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}}]})]) (If (AndOr OP_AND_IF (DParen {A2 AS_OP_DEQUAL {A Atom NODE_ARITH_WORD {[DQ [VarSub found]]}} {A Atom NODE_ARITH_WORD {[DQ [VarSub EXPECTED_NUM_NODES]]}}}) (DParen {A2 AS_OP_DEQUAL {A Atom NODE_ARITH_WORD {[DQ [VarSub ready]]}} {A Atom NODE_ARITH_WORD {[DQ [VarSub EXPECTED_NUM_NODES]]}}}) ) (Com {[LIT_CHARS break]} ) (DParen {A2 AS_OP_GREAT {A Atom NODE_ARITH_WORD {[DQ [VarSub found]]}} {A Atom NODE_ARITH_WORD {[DQ [VarSub EXPECTED_NUM_NODES]]}}}) (List (If (DBracket {B2 BINARY_STRING_NOT_EQUAL {[DQ [VarSub KUBE_USE_EXISTING_MASTER test_op=VS_TEST_COLON_HYPHEN {}]]} {[DQ [LIT_CHARS true]]}}) (Com {[LIT_CHARS echo]} {[LIT_CHARS -e]} {[DQ [VarSub color_red][LIT_CHARS "Found "][VarSub found][LIT_CHARS " nodes, but expected "][VarSub EXPECTED_NUM_NODES][LIT_CHARS ". Your cluster may not behave correctly."][VarSub color_norm]]} ) ) (Com {[LIT_CHARS break]} ) ) (DParen {A2 AS_OP_GREAT {A Atom NODE_ARITH_WORD {[DQ [VarSub ready]]}} {A Atom NODE_ARITH_WORD {[DQ [VarSub EXPECTED_NUM_NODES]]}}}) (List (Com {[LIT_CHARS echo]} {[LIT_CHARS -e]} {[DQ [VarSub color_red][LIT_CHARS "Found "][VarSub ready][LIT_CHARS " ready nodes, but expected "][VarSub EXPECTED_NUM_NODES][LIT_CHARS ". Your cluster may not behave correctly."][VarSub color_norm]]} ) (Com {[LIT_CHARS break]} ) ) (ElseTrue) (List (If (DBracket {B2 BINARY_INT_LE {[DQ [VarSub REQUIRED_NUM_NODES]]} {[DQ [VarSub ready]]}}) (List (Com {[LIT_CHARS echo]} {[LIT_CHARS -e]} {[DQ [VarSub color_green][LIT_CHARS "Found "][VarSub REQUIRED_NUM_NODES][LIT_CHARS " Nodes, allowing additional "][VarSub ADDITIONAL_ITERATIONS][LIT_CHARS " iterations for other Nodes to join."][VarSub color_norm]]} ) (= scope= flags=0 words=[] bindings=[('last_run', {[DQ [VarSub last_run test_op=VS_TEST_COLON_HYPHEN {[ArithSub {A2 AS_OP_MINUS {A2 AS_OP_PLUS {A Atom NODE_ARITH_WORD {[VarSub attempt]}} {A Atom NODE_ARITH_WORD {[VarSub ADDITIONAL_ITERATIONS]}}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}}]}]]})]) ) ) (If (DBracket {B2 BINARY_INT_GT {[DQ [VarSub attempt]]} {[DQ [VarSub last_run test_op=VS_TEST_COLON_HYPHEN {[LIT_CHARS 100]}]]}}) (List (Com {[LIT_CHARS echo]} {[LIT_CHARS -e]} {[DQ [VarSub color_yellow][LIT_CHARS "Detected "][VarSub ready][LIT_CHARS " ready nodes, found "][VarSub found][LIT_CHARS " nodes out of expected "][VarSub EXPECTED_NUM_NODES][LIT_CHARS ". Your cluster may not be fully functional."][VarSub color_norm]]} ) (Com {[LIT_CHARS kubectl_retry]} {[LIT_CHARS get]} {[LIT_CHARS nodes]} ) (If (DBracket {B2 BINARY_INT_GT {[DQ [VarSub REQUIRED_NUM_NODES]]} {[DQ [VarSub ready]]}}) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) (ElseTrue) (List (= scope= flags=0 words=[] bindings=[('return_value', {[LIT_CHARS 2]})]) (Com {[LIT_CHARS break]} ) ) ) ) (ElseTrue) (Com {[LIT_CHARS echo]} {[LIT_CHARS -e]} {[DQ [VarSub color_yellow][LIT_CHARS "Waiting for "][VarSub EXPECTED_NUM_NODES][LIT_CHARS " ready nodes. "][VarSub ready][LIT_CHARS " ready nodes, "][VarSub found][LIT_CHARS " registered. Retrying."][VarSub color_norm]]} ) ) ) ) ) ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "Found "][VarSub found][LIT_CHARS " node(s)."]]} ) (Com {[LIT_CHARS kubectl_retry]} {[LIT_CHARS get]} {[LIT_CHARS nodes]} ) (= scope= flags=0 words=[] bindings=[('attempt', {[LIT_CHARS 0]})]) (While (Com {[LIT_CHARS true]} ) (List (AndOr OP_OR_IF (= scope= flags=0 words=[] bindings=[('cs_status', {[ComSub (Com {[LIT_CHARS kubectl_retry]} {[LIT_CHARS get]} {[LIT_CHARS componentstatuses]} {[LIT_CHARS -o]} {[LIT_CHARS template]} {[LIT_CHARS --template] [LIT_DBRACKET_LIKE "="] [SQ ]})]})]) (Com {[LIT_CHARS true]} ) ) (AndOr OP_OR_IF (= scope= flags=0 words=[] bindings=[('componentstatuses', {[ComSub (Pipeline (Com {[LIT_CHARS echo]} {[DQ [VarSub cs_status]]}) (Com {[LIT_CHARS grep]} {[LIT_CHARS -c]} {[SQ ]}) )]})]) (Com {[LIT_CHARS true]} ) ) (AndOr OP_OR_IF (= scope= flags=0 words=[] bindings=[('healthy', {[ComSub (Pipeline (Com {[LIT_CHARS echo]} {[DQ [VarSub cs_status]]}) (Com {[LIT_CHARS grep]} {[LIT_CHARS -c]} {[SQ ]}) )]})]) (Com {[LIT_CHARS true]} ) ) (If (DParen {A2 AS_OP_GREAT {A Atom NODE_ARITH_WORD {[VarSub componentstatuses]}} {A Atom NODE_ARITH_WORD {[VarSub healthy]}}}) (If (DParen {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub attempt]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 5]}}}) (List (Com {[LIT_CHARS echo]} {[LIT_CHARS -e]} {[DQ [VarSub color_yellow][LIT_CHARS "Cluster not working yet."][VarSub color_norm]]} ) (= scope= flags=0 words=[] bindings=[('attempt', {[ArithSub {A2 AS_OP_PLUS {A Atom NODE_ARITH_WORD {[VarSub attempt]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}}]})]) (Com {[LIT_CHARS sleep]} {[LIT_CHARS 30]} ) ) (ElseTrue) (List (Com {[LIT_CHARS echo]} {[LIT_CHARS -e]} {[DQ [LIT_CHARS " "][VarSub color_yellow][LIT_CHARS "Validate output:"][VarSub color_norm]]} ) (Com {[LIT_CHARS kubectl_retry]} {[LIT_CHARS get]} {[LIT_CHARS cs]} ) (Com {[LIT_CHARS echo]} {[LIT_CHARS -e]} {[DQ [VarSub color_red][LIT_CHARS "Validation returned one or more failed components. Cluster is probably broken."][VarSub color_norm]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (ElseTrue) (Com {[LIT_CHARS break]} ) ) ) ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "Validate output:"]]} ) (Com {[LIT_CHARS kubectl_retry]} {[LIT_CHARS get]} {[LIT_CHARS cs]} ) (If (Com {[LIT_DBRACKET_LIKE "["]} {[DQ [VarSub return_value]]} {[LIT_DBRACKET_LIKE "=="]} {[DQ [LIT_CHARS 0]]} {[LIT_DBRACKET_LIKE "]"]} ) (Com {[LIT_CHARS echo]} {[LIT_CHARS -e]} {[DQ [VarSub color_green][LIT_CHARS "Cluster validation succeeded"][VarSub color_norm]]} ) (ElseTrue) (Com {[LIT_CHARS echo]} {[LIT_CHARS -e]} {[DQ [VarSub color_yellow][LIT_CHARS "Cluster validation encountered some problems, but cluster should be in working order"][VarSub color_norm]]} ) ) (Com {[LIT_CHARS exit]} {[DQ [VarSub return_value]]} ) )