(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 bracket_op=(Index {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}})]]})] [LIT_CHARS /../..]})]) (Com {[LIT_CHARS source]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/photon-controller/config-common.sh]]} ) (Com {[LIT_CHARS source]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/photon-controller/][VarSub KUBE_CONFIG_FILE test_op=VS_TEST_HYPHEN {[DQ [LIT_CHARS config-default.sh]]}]]} ) (Com {[LIT_CHARS source]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/common.sh]]} ) (= scope= flags=2 words=[] bindings=[('PHOTON', {[DQ [LIT_CHARS "photon -n"]]})]) (= scope= flags=2 words=[] bindings=[('MASTER_NAME', {[DQ [VarSub INSTANCE_PREFIX][LIT_CHARS -master]]})]) (= scope= flags=2 words=[] bindings=[('NODE_NAMES', {[Array {[ComSub (Com {[LIT_CHARS eval]} {[LIT_CHARS echo]} {[DQ [VarSub INSTANCE_PREFIX]] [LIT_CHARS -node-] [LIT_LBRACE "{"] [LIT_CHARS 1..] [DQ [VarSub NUM_NODES]] [LIT_RBRACE "}"]})]}]})]) (FunctionDef detect-master [] (List (= scope= flags=0 words=[] bindings=[('silent', {[VarSub 1 test_op=VS_TEST_COLON_HYPHEN {[DQ ]}]})]) (= scope= flags=0 words=[] bindings=[('tenant_args', {[DQ [LIT_CHARS "--tenant "][VarSub PHOTON_TENANT][LIT_CHARS " --project "][VarSub PHOTON_PROJECT]]})]) (= scope= flags=0 words=[] bindings=[('KUBE_MASTER', {[VarSub MASTER_NAME]})]) (= scope= flags=0 words=[] bindings=[('KUBE_MASTER_ID', {[VarSub KUBE_MASTER_ID test_op=VS_TEST_COLON_HYPHEN {[DQ ]}]})]) (= scope= flags=0 words=[] bindings=[('KUBE_MASTER_IP', {[VarSub KUBE_MASTER_IP test_op=VS_TEST_COLON_HYPHEN {[DQ ]}]})]) (Com {[LIT_CHARS set]} {[LIT_OTHER "+"] [LIT_CHARS o]} {[LIT_CHARS pipefail]} ) (If (DBracket {B1 UNARY_STRING_z {[VarSub KUBE_MASTER_ID]}}) (= scope= flags=0 words=[] bindings=[('KUBE_MASTER_ID', {[ComSub (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS vm]} {[LIT_CHARS list]} {[VarSub tenant_args]}) (Com {[LIT_CHARS grep]} {[SQ ] [DQ [LIT_CHARS kubernetes-master]] [SQ ]}) (Com {[LIT_CHARS awk]} {[SQ ]}) )]})]) ) (If (DBracket {B1 UNARY_STRING_z {[VarSub KUBE_MASTER_ID]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Could not find Kubernetes master node ID. Make sure you've launched a cluster with kube-up.sh"]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (If (DBracket {B1 UNARY_STRING_z {[DQ [VarSub KUBE_MASTER_IP test_op=VS_TEST_HYPHEN {}]]}}) (= scope= flags=0 words=[] bindings=[('KUBE_MASTER_IP', {[ComSub (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS vm]} {[LIT_CHARS networks]} {[DQ [VarSub KUBE_MASTER_ID]]}) (Com {[LIT_CHARS grep]} {[LIT_CHARS -i]} {[SQ ] [DQ [LIT_CHARS "00:0C:29"]]}) (Com {[LIT_CHARS grep]} {[LIT_CHARS -E]} {[SQ ]}) (Com {[LIT_CHARS head]} {[LIT_CHARS -1]}) (Com {[LIT_CHARS awk]} {[LIT_CHARS -F] [SQ ]} {[SQ ]}) )]})]) ) (If (DBracket {B1 UNARY_STRING_z {[DQ [VarSub KUBE_MASTER_IP test_op=VS_TEST_HYPHEN {}]]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Could not find Kubernetes master node IP. Make sure you've launched a cluster with 'kube-up.sh'"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (If (DBracket {B1 UNARY_STRING_z {[VarSub silent]}}) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Master: "][VarSub KUBE_MASTER][LIT_CHARS " ("][VarSub KUBE_MASTER_IP][LIT_CHARS ")"]]} ) ) (Com {[LIT_CHARS set]} {[LIT_CHARS -o]} {[LIT_CHARS pipefail]} ) ) ) (FunctionDef detect-nodes [] (List (= scope= flags=0 words=[] bindings=[('silent', {[VarSub 1 test_op=VS_TEST_COLON_HYPHEN {[DQ ]}]})]) (= scope= flags=0 words=[] bindings=[('failure', {[LIT_CHARS 0]})]) (= scope= flags=0 words=[] bindings=[('tenant_args', {[DQ [LIT_CHARS "--tenant "][VarSub PHOTON_TENANT][LIT_CHARS " --project "][VarSub PHOTON_PROJECT]]})]) (= scope= flags=0 words=[] bindings=[('KUBE_NODE_IP_ADDRESSES', {[Array ]})]) (= scope= flags=0 words=[] bindings=[('KUBE_NODE_IDS', {[Array ]})]) (Com {[LIT_CHARS set]} {[LIT_OTHER "+"] [LIT_CHARS o]} {[LIT_CHARS pipefail]} ) (ForExpr {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub i]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}} {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub i]}} {A Atom NODE_ARITH_WORD {[VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_AT "@"}}) transform_ops=[(#len)]]}}} {A1 AS_OP_DPLUS {A Atom NODE_ARITH_WORD {[VarSub i]}} } (List (= scope= flags=0 words=[{[LIT_CHARS node_id]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('node_id', {[ComSub (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS vm]} {[LIT_CHARS list]} {[VarSub tenant_args]}) (Com {[LIT_CHARS grep]} {[SQ ] [DQ [VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})]] [SQ ]}) (Com {[LIT_CHARS awk]} {[SQ ]}) )]})]) (If (DBracket {B1 UNARY_STRING_z {[VarSub node_id]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Could not find "][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})]]} ) (= scope= flags=0 words=[] bindings=[('failure', {[LIT_CHARS 1]})]) ) ) (= scope= flags=0 words=[] bindings=[('KUBE_NODE_IDS+', {[Array {[DQ [VarSub node_id]]}]})]) (= scope= flags=0 words=[] bindings=[('node_ip', {[ComSub (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS vm]} {[LIT_CHARS networks]} {[DQ [VarSub node_id]]}) (Com {[LIT_CHARS grep]} {[LIT_CHARS -i]} {[SQ ] [DQ [LIT_CHARS "00:0C:29"]]}) (Com {[LIT_CHARS grep]} {[LIT_CHARS -E]} {[SQ ]}) (Com {[LIT_CHARS head]} {[LIT_CHARS -1]}) (Com {[LIT_CHARS awk]} {[LIT_CHARS -F] [SQ ]} {[SQ ]}) )]})]) (= scope= flags=0 words=[] bindings=[('KUBE_NODE_IP_ADDRESSES+', {[Array {[DQ [VarSub node_ip]]}]})]) (If (DBracket {B1 UNARY_STRING_z {[VarSub silent]}}) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Node: "][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})][LIT_CHARS " ("][VarSub KUBE_NODE_IP_ADDRESSES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})][LIT_CHARS ")"]]} ) ) ) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub failure]} {[LIT_CHARS 0]}}) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) (Com {[LIT_CHARS set]} {[LIT_CHARS -o]} {[LIT_CHARS pipefail]} ) ) ) (FunctionDef detect-node-names [] (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "TODO: detect-node-names"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) ) (FunctionDef verify-prereqs [] (List (Com {[LIT_CHARS verify-cmd-in-path]} {[LIT_CHARS photon]} ) (Com {[LIT_CHARS verify-cmd-in-path]} {[LIT_CHARS ssh]} ) (Com {[LIT_CHARS verify-cmd-in-path]} {[LIT_CHARS scp]} ) (Com {[LIT_CHARS verify-cmd-in-path]} {[LIT_CHARS ssh-add]} ) (Com {[LIT_CHARS verify-cmd-in-path]} {[LIT_CHARS openssl]} ) (Com {[LIT_CHARS verify-cmd-in-path]} {[LIT_CHARS mkisofs]} ) ) ) (FunctionDef kube-up [] (List (Com {[LIT_CHARS verify-prereqs]} ) (Com {[LIT_CHARS verify-ssh-prereqs]} ) (Com {[LIT_CHARS verify-photon-config]} ) (Com {[LIT_CHARS ensure-temp-dir]} ) (Com {[LIT_CHARS find-release-tars]} ) (Com {[LIT_CHARS find-image-id]} ) (Com {[LIT_CHARS load-or-gen-kube-basicauth]} ) (Com {[LIT_CHARS gen-cloud-init-iso]} ) (Com {[LIT_CHARS gen-master-start]} ) (Com {[LIT_CHARS create-master-vm]} ) (Com {[LIT_CHARS install-salt-on-master]} ) (Com {[LIT_CHARS gen-node-start]} ) (Com {[LIT_CHARS install-salt-on-nodes]} ) (Com {[LIT_CHARS detect-nodes]} {[LIT_CHARS -s]} ) (Com {[LIT_CHARS install-kubernetes-on-master]} ) (Com {[LIT_CHARS install-kubernetes-on-nodes]} ) (Com {[LIT_CHARS wait-master-api]} ) (Com {[LIT_CHARS wait-node-apis]} ) (Com {[LIT_CHARS setup-pod-routes]} ) (Com {[LIT_CHARS copy-kube-certs]} ) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Creating kubeconfig..."]]} ) (Com {[LIT_CHARS create-kubeconfig]} ) ) ) (FunctionDef kube-down [] (List (Com {[LIT_CHARS detect-master]} ) (Com {[LIT_CHARS detect-nodes]} ) (Com {[LIT_CHARS pc-delete-vm]} {[DQ [VarSub KUBE_MASTER]]} {[DQ [VarSub KUBE_MASTER_ID]]} ) (ForExpr {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub node]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}} {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub node]}} {A Atom NODE_ARITH_WORD {[VarSub KUBE_NODE_IDS bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_AT "@"}}) transform_ops=[(#len)]]}}} {A1 AS_OP_DPLUS {A Atom NODE_ARITH_WORD {[VarSub node]}} } (Com {[LIT_CHARS pc-delete-vm]} {[DQ [VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})]]} {[DQ [VarSub KUBE_NODE_IDS bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})]]} ) ) ) ) (FunctionDef kube-push [] (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "TODO: kube-push"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) ) (FunctionDef prepare-push [] (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "TODO: prepare-push"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) ) (FunctionDef push-master [] (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "TODO: push-master"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) ) (FunctionDef push-node [] (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "TODO: push-node"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) ) (FunctionDef test-build-release [] (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "TODO: test-build-release"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) ) (FunctionDef test-setup [] (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "TODO: test-setup"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) ) (FunctionDef test-teardown [] (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "TODO: test-teardown"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) ) (FunctionDef pc-create-vm [] (List (= scope= flags=0 words=[] bindings=[('vm_name', {[DQ [VarSub 1]]})]) (= scope= flags=0 words=[] bindings=[('vm_flavor', {[DQ [VarSub 2]]})]) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (= scope= flags=0 words=[] bindings=[('i', {[LIT_CHARS 0]})]) (= scope= flags=0 words=[] bindings=[('tenant_args', {[DQ [LIT_CHARS "--tenant "][VarSub PHOTON_TENANT][LIT_CHARS " --project "][VarSub PHOTON_PROJECT]]})]) (= scope= flags=0 words=[] bindings=[('vm_args', {[DQ [LIT_CHARS "--name "][VarSub vm_name][LIT_CHARS " --image "][VarSub PHOTON_IMAGE_ID][LIT_CHARS " --flavor "][VarSub vm_flavor]]})]) (= scope= flags=0 words=[] bindings=[('disk_args', {[DQ [LIT_CHARS "disk-1 "][VarSub PHOTON_DISK_FLAVOR][LIT_CHARS " boot=true"]]})]) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (= scope= flags=0 words=[] bindings=[('_VM_ID', {[ComSub (Com redirects=[(DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2)]{[VarSub PHOTON]} {[LIT_CHARS vm]} {[LIT_CHARS create]} {[VarSub tenant_args]} {[VarSub vm_args]} {[LIT_CHARS --disks]} {[DQ [VarSub disk_args]]})]})]) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Failed to create VM. Error output:"]]} ) (Com {[LIT_CHARS echo]} {[DQ [VarSub _VM_ID]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Created VM "][VarSub vm_name][LIT_CHARS ": "][VarSub _VM_ID]]} ) (Com {[LIT_CHARS run-cmd]} {[DQ [VarSub PHOTON][LIT_CHARS " vm attach-iso -p "][VarSub KUBE_TEMP][LIT_CHARS "/cloud-init.iso "][VarSub _VM_ID]]} ) (Com {[LIT_CHARS run-cmd]} {[DQ [VarSub PHOTON][LIT_CHARS " vm start "][VarSub _VM_ID]]} ) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Started VM "][VarSub vm_name][LIT_CHARS ", waiting for network address..."]]} ) (= scope= flags=0 words=[] bindings=[('have_network', {[LIT_CHARS 0]})]) (For i [{[LIT_LBRACE "{"] [LIT_CHARS 1..120] [LIT_RBRACE "}"]}]) (List (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (= scope= flags=0 words=[] bindings=[('networks', {[ComSub (Com {[VarSub PHOTON]} {[LIT_CHARS vm]} {[LIT_CHARS networks]} {[DQ [VarSub _VM_ID]]})]})]) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "'"][VarSub PHOTON][LIT_CHARS " vm networks "][VarSub _VM_ID][LIT_CHARS "' failed. Error output: "]]} ) (Com {[LIT_CHARS echo]} {[DQ [VarSub networks]]} ) ) ) (AndOr OP_OR_IF (= scope= flags=0 words=[] bindings=[('networks', {[ComSub (Pipeline (Com {[LIT_CHARS echo]} {[DQ [VarSub networks]]}) (Com {[LIT_CHARS grep]} {[LIT_CHARS True]}) )]})]) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_EQ {[VarSub rc]} {[LIT_CHARS 0]}}) (List (= scope= flags=0 words=[] bindings=[('have_network', {[LIT_CHARS 1]})]) (Com {[LIT_CHARS break]} ) ) ) (Com {[LIT_CHARS sleep]} {[LIT_CHARS 1]} ) ) ) (If (DBracket {B2 BINARY_INT_EQ {[VarSub have_network]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "VM "][VarSub vm_name][LIT_CHARS " failed to start up: no IP was found"]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (= scope= flags=0 words=[] bindings=[('_VM_IP', {[ComSub (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS vm]} {[LIT_CHARS networks]} {[DQ [VarSub _VM_ID]]}) (Com {[LIT_CHARS head]} {[LIT_CHARS -1]}) (Com {[LIT_CHARS awk]} {[LIT_CHARS -F] [SQ ]} {[SQ ]}) )]})]) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "VM "][VarSub vm_name][LIT_CHARS " has IP: "][VarSub _VM_IP]]} ) ) ) (FunctionDef pc-delete-vm [] (List (= scope= flags=0 words=[] bindings=[('vm_name', {[DQ [VarSub 1]]})]) (= scope= flags=0 words=[] bindings=[('vm_id', {[DQ [VarSub 2]]})]) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Deleting VM "][VarSub vm_name]]} ) (Com {[LIT_CHARS set]} {[LIT_OTHER "+"] [LIT_CHARS o]} {[LIT_CHARS pipefail]} ) (AndOr OP_OR_IF (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS vm]} {[LIT_CHARS show]} {[DQ [VarSub vm_id]]} ) (Com {[LIT_CHARS head]} {[LIT_CHARS -1]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS STARTED]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (Com {[LIT_CHARS set]} {[LIT_OTHER "+"] [LIT_CHARS o]} {[LIT_CHARS pipefail]} ) (If (DBracket {B2 BINARY_INT_EQ {[VarSub rc]} {[LIT_CHARS 0]}}) (List (AndOr OP_OR_IF (Com {[VarSub PHOTON]} {[LIT_CHARS vm]} {[LIT_CHARS stop]} {[DQ [VarSub vm_id]]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Error: could not stop "][VarSub vm_name][LIT_CHARS " ("][VarSub vm_id][LIT_CHARS ")"]]} ) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Please investigate and stop manually"]]} ) (Com {[LIT_CHARS return]} ) ) ) ) ) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (Com {[VarSub PHOTON]} {[LIT_CHARS vm]} {[LIT_CHARS delete]} {[DQ [VarSub vm_id]]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Error: could not delete "][VarSub vm_name][LIT_CHARS " ("][VarSub vm_id][LIT_CHARS ")"]]} ) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Please investigate and delete manually"]]} ) ) ) ) ) (FunctionDef find-image-id [] (List (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (= scope= flags=0 words=[] bindings=[('PHOTON_IMAGE_ID', {[ComSub (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS image]} {[LIT_CHARS list]}) (Com {[LIT_CHARS grep]} {[SQ ] [DQ [VarSub PHOTON_IMAGE]] [SQ ]}) (Com {[LIT_CHARS head]} {[LIT_CHARS -1]}) (Com {[LIT_CHARS grep]} {[LIT_CHARS READY]}) (Com {[LIT_CHARS awk]} {[LIT_CHARS -F] [SQ ]} {[SQ ]}) )]})]) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Cannot find image "][\ LIT_ESCAPED_CHAR "\\\""][VarSub PHOTON_IMAGE][\ LIT_ESCAPED_CHAR "\\\""]]} ) (= scope= flags=0 words=[] bindings=[('fail', {[LIT_CHARS 1]})]) ) ) ) ) (FunctionDef gen-cloud-init-iso [] (List (= scope= flags=0 words=[{[LIT_CHARS password_hash]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('password_hash', {[ComSub (Com {[LIT_CHARS openssl]} {[LIT_CHARS passwd]} {[LIT_CHARS -1]} {[DQ [VarSub KUBE_PASSWORD]]})]})]) (= scope= flags=0 words=[{[LIT_CHARS ssh_key]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('ssh_key', {[ComSub (Pipeline (Com {[LIT_CHARS ssh-add]} {[LIT_CHARS -L]}) (Com {[LIT_CHARS head]} {[LIT_CHARS -1]}) )]})]) (Subshell (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "#cloud-config"]]} ) (Com {[LIT_CHARS echo]} {[DQ ]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "groups:"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " - "][VarSub VM_USER]]} ) (Com {[LIT_CHARS echo]} {[DQ ]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "users:"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " - name: "][VarSub VM_USER]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " gecos: Kubernetes"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " primary-group: "][VarSub VM_USER]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " lock-passwd: false"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " passwd: "][VarSub password_hash]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " ssh-authorized-keys: "]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " - "][VarSub ssh_key]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " sudo: ALL=(ALL) NOPASSWD:ALL"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " shell: /bin/bash"]]} ) (Com {[LIT_CHARS echo]} {[DQ ]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "hostname:"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS " - hostname: kube"]]} ) ) ) (Com {[LIT_CHARS run-cmd]} {[DQ [LIT_CHARS "mkisofs -rock -o "][VarSub KUBE_TEMP][LIT_CHARS "/cloud-init.iso "][VarSub KUBE_TEMP][LIT_CHARS /user-data.txt]]} ) ) ) (FunctionDef gen-master-start [] (List (Com {[LIT_CHARS python]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /third_party/htpasswd/htpasswd.py]]} {[LIT_CHARS -b]} {[LIT_CHARS -c]} {[DQ [VarSub KUBE_TEMP][LIT_CHARS /htpasswd]]} {[DQ [VarSub KUBE_USER]]} {[DQ [VarSub KUBE_PASSWORD]]} ) (= scope= flags=0 words=[{[LIT_CHARS htpasswd]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('htpasswd', {[ComSub (Com {[LIT_CHARS cat]} {[DQ [VarSub KUBE_TEMP][LIT_CHARS /htpasswd]]})]})]) (= scope= flags=0 words=[{[LIT_CHARS octets]}] bindings=[]) (= scope= flags=0 words=[{[LIT_CHARS service_ip]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('octets', {[Array {[ComSub (Pipeline (Com {[LIT_CHARS echo]} {[DQ [VarSub SERVICE_CLUSTER_IP_RANGE]]}) (Com {[LIT_CHARS sed]} {[LIT_CHARS -e]} {[SQ ]} {[LIT_CHARS -e]} {[SQ ]}) )]}]})]) (DParen {A2 AS_OP_PLUS_EQUAL {A2 AS_OP_LBRACKET {A Atom NODE_ARITH_WORD {[VarSub octets]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 3]}}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}}) (= scope= flags=0 words=[] bindings=[('service_ip', {[ComSub (Pipeline (Com {[LIT_CHARS echo]} {[DQ [VarSub octets bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_STAR "*"}})]]}) (Com {[LIT_CHARS sed]} {[SQ ]}) )]})]) (= scope= flags=0 words=[] bindings=[('MASTER_EXTRA_SANS', {[DQ [LIT_CHARS "IP:"][VarSub service_ip][LIT_CHARS ",DNS:"][VarSub MASTER_NAME][LIT_CHARS ","][VarSub MASTER_EXTRA_SANS]]})]) (Subshell (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "#! /bin/bash"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly MY_NAME="][VarSub MASTER_NAME]]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -v]} {[DQ [LIT_CHARS "^#"]]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/photon-controller/templates/hostname.sh]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "cd /home/kube/cache/kubernetes-install"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly MASTER_NAME='"][VarSub MASTER_NAME][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly MASTER_IP_RANGE='"][VarSub MASTER_IP_RANGE][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly INSTANCE_PREFIX='"][VarSub INSTANCE_PREFIX][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly NODE_INSTANCE_PREFIX='"][VarSub INSTANCE_PREFIX][LIT_CHARS "-node'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly NODE_IP_RANGES='"][VarSub NODE_IP_RANGES][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly SERVICE_CLUSTER_IP_RANGE='"][VarSub SERVICE_CLUSTER_IP_RANGE][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly ENABLE_NODE_LOGGING='"][VarSub ENABLE_NODE_LOGGING test_op=VS_TEST_COLON_HYPHEN {[LIT_CHARS false]}][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly LOGGING_DESTINATION='"][VarSub LOGGING_DESTINATION test_op=VS_TEST_COLON_HYPHEN {}][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly ENABLE_CLUSTER_DNS='"][VarSub ENABLE_CLUSTER_DNS test_op=VS_TEST_COLON_HYPHEN {[LIT_CHARS false]}][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly ENABLE_CLUSTER_UI='"][VarSub ENABLE_CLUSTER_UI test_op=VS_TEST_COLON_HYPHEN {[LIT_CHARS false]}][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly DNS_SERVER_IP='"][VarSub DNS_SERVER_IP test_op=VS_TEST_COLON_HYPHEN {}][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly DNS_DOMAIN='"][VarSub DNS_DOMAIN test_op=VS_TEST_COLON_HYPHEN {}][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly KUBE_USER='"][VarSub KUBE_USER test_op=VS_TEST_COLON_HYPHEN {}][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly KUBE_PASSWORD='"][VarSub KUBE_PASSWORD test_op=VS_TEST_COLON_HYPHEN {}][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly SERVER_BINARY_TAR='"][VarSub SERVER_BINARY_TAR transform_ops=[VS_UNARY_DPOUND {[LIT_CHARS "*"] [LIT_SLASH /]}]][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly SALT_TAR='"][VarSub SALT_TAR transform_ops=[VS_UNARY_DPOUND {[LIT_CHARS "*"] [LIT_SLASH /]}]][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly MASTER_HTPASSWD='"][VarSub htpasswd][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly E2E_STORAGE_TEST_ENVIRONMENT='"][VarSub E2E_STORAGE_TEST_ENVIRONMENT test_op=VS_TEST_COLON_HYPHEN {}][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly MASTER_EXTRA_SANS='"][VarSub MASTER_EXTRA_SANS test_op=VS_TEST_COLON_HYPHEN {}][LIT_CHARS "'"]]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -v]} {[DQ [LIT_CHARS "^#"]]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/photon-controller/templates/create-dynamic-salt-files.sh]]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -v]} {[DQ [LIT_CHARS "^#"]]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/photon-controller/templates/install-release.sh]]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -v]} {[DQ [LIT_CHARS "^#"]]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/photon-controller/templates/salt-master.sh]]} ) ) ) ) ) (FunctionDef gen-node-start [] (List (= scope= flags=0 words=[{[LIT_CHARS i]}] bindings=[]) (ForExpr {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub i]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}} {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub i]}} {A Atom NODE_ARITH_WORD {[VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_AT "@"}}) transform_ops=[(#len)]]}}} {A1 AS_OP_DPLUS {A Atom NODE_ARITH_WORD {[VarSub i]}} } (Subshell (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "#! /bin/bash"]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "readonly MY_NAME="][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})]]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -v]} {[DQ [LIT_CHARS "^#"]]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/photon-controller/templates/hostname.sh]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "KUBE_MASTER="][VarSub KUBE_MASTER]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "KUBE_MASTER_IP="][VarSub KUBE_MASTER_IP]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "NODE_IP_RANGE="][VarSub NODE_IP_RANGES]]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -v]} {[DQ [LIT_CHARS "^#"]]} {[DQ [VarSub KUBE_ROOT][LIT_CHARS /cluster/photon-controller/templates/salt-minion.sh]]} ) ) ) ) ) ) (FunctionDef gen-master-salt [] (Com {[LIT_CHARS gen-salt]} {[DQ [LIT_CHARS kubernetes-master]]} ) ) (FunctionDef gen-node-salt [] (List (= scope= flags=0 words=[{[LIT_CHARS i]}] bindings=[]) (ForExpr {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub i]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}} {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub i]}} {A Atom NODE_ARITH_WORD {[VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_AT "@"}}) transform_ops=[(#len)]]}}} {A1 AS_OP_DPLUS {A Atom NODE_ARITH_WORD {[VarSub i]}} } (Com {[LIT_CHARS gen-salt]} {[DQ [VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})]]} ) ) ) ) (FunctionDef gen-salt [] (List (= scope= flags=0 words=[] bindings=[('node_name', {[VarSub 1]})]) (Subshell (List (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "node="][VarSub node_name]]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ > $log">]} ) (Com {[LIT_CHARS echo]} {[SQ ${out}">]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ > ${log}">]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ > ${log}">]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) ) ) ) ) (FunctionDef gen-add-route [] (List (= scope= flags=0 words=[] bindings=[('route', {[VarSub 1]})]) (= scope= flags=0 words=[] bindings=[('gateway', {[VarSub 2]})]) (Subshell (List (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "sudo route add -net "][VarSub route][LIT_CHARS " gw "][VarSub gateway]]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} ) (Com {[LIT_CHARS echo]} {[SQ ]} {[DQ [VarSub route][LIT_CHARS " gw "][VarSub gateway][LIT_CHARS "|"]] [SQ ]} ) ) ) ) ) (FunctionDef create-master-vm [] (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Starting master VM..."]]} ) (Com {[LIT_CHARS pc-create-vm]} {[DQ [VarSub MASTER_NAME]]} {[DQ [VarSub PHOTON_MASTER_FLAVOR]]} ) (= scope= flags=0 words=[] bindings=[('KUBE_MASTER', {[VarSub MASTER_NAME]})]) (= scope= flags=0 words=[] bindings=[('KUBE_MASTER_ID', {[VarSub _VM_ID]})]) (= scope= flags=0 words=[] bindings=[('KUBE_MASTER_IP', {[VarSub _VM_IP]})]) ) ) (FunctionDef install-salt-on-master [] (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Installing salt on master..."]]} ) (Com {[LIT_CHARS upload-server-tars]} {[DQ [VarSub MASTER_NAME]]} {[DQ [VarSub KUBE_MASTER_IP]]} ) (Com {[LIT_CHARS run-script-remotely]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [VarSub KUBE_TEMP][LIT_CHARS /master-start.sh]]} ) ) ) (FunctionDef install-salt-on-nodes [] (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Creating nodes and installing salt on them..."]]} ) (= scope= flags=0 words=[{[LIT_CHARS node]}] bindings=[]) (ForExpr {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub node]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}} {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub node]}} {A Atom NODE_ARITH_WORD {[VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_AT "@"}}) transform_ops=[(#len)]]}}} {A1 AS_OP_DPLUS {A Atom NODE_ARITH_WORD {[VarSub node]}} } (Fork (Subshell (List (Com {[LIT_CHARS pc-create-vm]} {[DQ [VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})]]} {[DQ [VarSub PHOTON_NODE_FLAVOR]]} ) (Com {[LIT_CHARS run-script-remotely]} {[DQ [VarSub _VM_IP]]} {[DQ [VarSub KUBE_TEMP][LIT_CHARS /node-start-][VarSub node][LIT_CHARS .sh]]} ) ) ) ) ) (= scope= flags=0 words=[] bindings=[('fail', {[LIT_CHARS 0]})]) (= scope= flags=0 words=[{[LIT_CHARS job]}] bindings=[]) (For job [{[ComSub (Com {[LIT_CHARS jobs]} {[LIT_CHARS -p]})]}]) (AndOr OP_OR_IF (Com {[LIT_CHARS wait]} {[DQ [VarSub job]]} ) (= scope= flags=0 words=[] bindings=[('fail', {[ArithSub {A2 AS_OP_PLUS {A Atom NODE_ARITH_WORD {[VarSub fail]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}}]})]) ) ) (If (DParen {A2 AS_OP_NEQUAL {A Atom NODE_ARITH_WORD {[VarSub fail]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Failed to start "][VarSub fail][LIT_CHARS /][VarSub NUM_NODES][LIT_CHARS " nodes"]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) ) ) (FunctionDef install-kubernetes-on-master [] (List (Com {[LIT_CHARS try-until-success-ssh]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [LIT_CHARS "Waiting for salt-master to start on "][VarSub KUBE_MASTER]]} {[DQ [LIT_CHARS "pgrep salt-master"]]} ) (Com {[LIT_CHARS gen-master-salt]} ) (Com {[LIT_CHARS copy-file-to-vm]} {[DQ [VarSub _VM_IP]]} {[DQ [VarSub KUBE_TEMP][LIT_CHARS /kubernetes-master-salt.sh]]} {[DQ [LIT_CHARS /tmp/kubernetes-master-salt.sh]]} ) (Com {[LIT_CHARS try-until-success-ssh]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [LIT_CHARS "Installing Kubernetes on "][VarSub KUBE_MASTER][LIT_CHARS " via salt"]]} {[DQ [LIT_CHARS "sudo /bin/bash /tmp/kubernetes-master-salt.sh"]]} ) ) ) (FunctionDef install-kubernetes-on-nodes [] (List (Com {[LIT_CHARS gen-node-salt]} ) (= scope= flags=0 words=[{[LIT_CHARS node]}] bindings=[]) (ForExpr {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub node]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}} {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub node]}} {A Atom NODE_ARITH_WORD {[VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_AT "@"}}) transform_ops=[(#len)]]}}} {A1 AS_OP_DPLUS {A Atom NODE_ARITH_WORD {[VarSub node]}} } (Fork (Subshell (List (Com {[LIT_CHARS copy-file-to-vm]} {[DQ [VarSub _VM_IP]]} {[DQ [VarSub KUBE_TEMP][LIT_CHARS /][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})][LIT_CHARS -salt.sh]]} {[DQ [LIT_CHARS /tmp/][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})][LIT_CHARS -salt.sh]]} ) (Com {[LIT_CHARS try-until-success-ssh]} {[DQ [VarSub KUBE_NODE_IP_ADDRESSES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})]]} {[DQ [LIT_CHARS "Waiting for salt-master to start on "][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})]]} {[DQ [LIT_CHARS "pgrep salt-minion"]]} ) (Com {[LIT_CHARS try-until-success-ssh]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [LIT_CHARS "Installing Kubernetes on "][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})][LIT_CHARS " via salt"]]} {[DQ [LIT_CHARS "sudo /bin/bash /tmp/"][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})][LIT_CHARS -salt.sh]]} ) ) ) ) ) (= scope= flags=0 words=[] bindings=[('fail', {[LIT_CHARS 0]})]) (= scope= flags=0 words=[{[LIT_CHARS job]}] bindings=[]) (For job [{[ComSub (Com {[LIT_CHARS jobs]} {[LIT_CHARS -p]})]}]) (AndOr OP_OR_IF (Com {[LIT_CHARS wait]} {[DQ [VarSub job]]} ) (= scope= flags=0 words=[] bindings=[('fail', {[ArithSub {A2 AS_OP_PLUS {A Atom NODE_ARITH_WORD {[VarSub fail]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 1]}}}]})]) ) ) (If (DParen {A2 AS_OP_NEQUAL {A Atom NODE_ARITH_WORD {[VarSub fail]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Failed to start install Kubernetes on "][VarSub fail][LIT_CHARS " out of "][VarSub NUM_NODES][LIT_CHARS " nodess"]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) ) ) (FunctionDef upload-server-tars [] (List (= scope= flags=0 words=[] bindings=[('vm_name', {[VarSub 1]})]) (= scope= flags=0 words=[] bindings=[('vm_ip', {[VarSub 2]})]) (Com {[LIT_CHARS run-ssh-cmd]} {[DQ [VarSub vm_ip]]} {[DQ [LIT_CHARS "mkdir -p /home/kube/cache/kubernetes-install"]]} ) (= scope= flags=0 words=[{[LIT_CHARS tar]}] bindings=[]) (For tar [{[DQ [VarSub SERVER_BINARY_TAR]]}, {[DQ [VarSub SALT_TAR]]}]) (List (= scope= flags=0 words=[{[LIT_CHARS base_tar]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('base_tar', {[ComSub (Com {[LIT_CHARS basename]} {[DQ [VarSub tar]]})]})]) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Uploading "][VarSub base_tar][LIT_CHARS " to "][VarSub vm_name][LIT_CHARS ...]]} ) (Com {[LIT_CHARS copy-file-to-vm]} {[DQ [VarSub vm_ip]]} {[DQ [VarSub tar]]} {[DQ [LIT_CHARS /home/kube/cache/kubernetes-install/][VarSub tar transform_ops=[VS_UNARY_DPOUND {[LIT_CHARS "*"] [LIT_SLASH /]}]]]} ) ) ) ) ) (FunctionDef wait-master-api [] (List (= scope= flags=0 words=[] bindings=[('curl_creds', {[DQ [LIT_CHARS "--insecure --user "][VarSub KUBE_USER][LIT_CHARS ":"][VarSub KUBE_PASSWORD]]})]) (= scope= flags=0 words=[] bindings=[('curl_output', {[DQ [LIT_CHARS "--fail --output /dev/null --silent"]]})]) (= scope= flags=0 words=[] bindings=[('curl_net', {[DQ [LIT_CHARS "--max-time 1"]]})]) (Com {[LIT_CHARS try-until-success]} {[DQ [LIT_CHARS "Waiting for Kubernetes API on "][VarSub KUBE_MASTER]]} {[DQ [LIT_CHARS "curl "][VarSub curl_creds][LIT_CHARS " "][VarSub curl_output][LIT_CHARS " "][VarSub curl_net][LIT_CHARS " https://"][VarSub KUBE_MASTER_IP][LIT_CHARS /healthz]]} ) ) ) (FunctionDef wait-node-apis [] (List (= scope= flags=0 words=[] bindings=[('curl_output', {[DQ [LIT_CHARS "--fail --output /dev/null --silent"]]})]) (= scope= flags=0 words=[] bindings=[('curl_net', {[DQ [LIT_CHARS "--max-time 1"]]})]) (ForExpr {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub i]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}} {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub i]}} {A Atom NODE_ARITH_WORD {[VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_AT "@"}}) transform_ops=[(#len)]]}}} {A1 AS_OP_DPLUS {A Atom NODE_ARITH_WORD {[VarSub i]}} } (Com {[LIT_CHARS try-until-success]} {[DQ [LIT_CHARS "Waiting for Kubernetes API on "][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})][LIT_CHARS ...]]} {[DQ [LIT_CHARS "curl "][VarSub curl_output][LIT_CHARS " "][VarSub curl_net][LIT_CHARS " http://"][VarSub KUBE_NODE_IP_ADDRESSES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})][LIT_CHARS ":10250/healthz"]]} ) ) ) ) (FunctionDef setup-pod-routes [] (List (= scope= flags=0 words=[{[LIT_CHARS node]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('KUBE_NODE_BRIDGE_NETWORK', {[Array ]})]) (ForExpr {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub node]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}} {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub node]}} {A Atom NODE_ARITH_WORD {[VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_AT "@"}}) transform_ops=[(#len)]]}}} {A1 AS_OP_DPLUS {A Atom NODE_ARITH_WORD {[VarSub node]}} } (List (Com {[LIT_CHARS try-until-success-ssh]} {[DQ [VarSub KUBE_NODE_IP_ADDRESSES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})]]} {[DQ [LIT_CHARS "Waiting for cbr0 bridge on "][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})][LIT_CHARS " to have an address"]]} {[SQ ]} ) (Com {[LIT_CHARS try-until-success-ssh]} {[DQ [VarSub KUBE_NODE_IP_ADDRESSES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})]]} {[DQ [LIT_CHARS "Waiting for cbr0 bridge on "][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})][LIT_CHARS " to have correct address"]]} {[SQ ]} ) (Com {[LIT_CHARS run-ssh-cmd]} {[DQ [VarSub KUBE_NODE_IP_ADDRESSES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})]]} {[SQ ]} ) (= scope= flags=0 words=[] bindings=[('KUBE_NODE_BRIDGE_NETWORK+', {[Array {[VarSub _OUTPUT]}]})]) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "cbr0 on "][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub node]}})][LIT_CHARS " is "][VarSub _OUTPUT]]} ) ) ) (= scope= flags=0 words=[{[LIT_CHARS i]}] bindings=[]) (= scope= flags=0 words=[{[LIT_CHARS j]}] bindings=[]) (ForExpr {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub i]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}} {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub i]}} {A Atom NODE_ARITH_WORD {[VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_AT "@"}}) transform_ops=[(#len)]]}}} {A1 AS_OP_DPLUS {A Atom NODE_ARITH_WORD {[VarSub i]}} } (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Configuring pod routes on "][VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})][LIT_CHARS ...]]} ) (Com {[LIT_CHARS gen-add-route]} {[DQ [VarSub KUBE_NODE_BRIDGE_NETWORK bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})]]} {[DQ [VarSub KUBE_NODE_IP_ADDRESSES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})]]} ) (Com {[LIT_CHARS run-script-remotely]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [VarSub KUBE_TEMP][LIT_CHARS /add-route.sh]]} ) (ForExpr {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub j]}} {A Atom NODE_ARITH_WORD {[AS_NUM_LITERAL 0]}}} {A2 AS_OP_LESS {A Atom NODE_ARITH_WORD {[VarSub j]}} {A Atom NODE_ARITH_WORD {[VarSub NODE_NAMES bracket_op=(Index {A Atom NODE_ARITH_WORD {AS_OP_AT "@"}}) transform_ops=[(#len)]]}}} {A1 AS_OP_DPLUS {A Atom NODE_ARITH_WORD {[VarSub j]}} } (If (DBracket {B2 BINARY_STRING_NOT_EQUAL {[DQ [VarSub i]]} {[DQ [VarSub j]]}}) (List (Com {[LIT_CHARS gen-add-route]} {[DQ [VarSub KUBE_NODE_BRIDGE_NETWORK bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub j]}})]]} {[DQ [VarSub KUBE_NODE_IP_ADDRESSES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub j]}})]]} ) (Com {[LIT_CHARS run-script-remotely]} {[DQ [VarSub KUBE_NODE_IP_ADDRESSES bracket_op=(Index {A Atom NODE_ARITH_WORD {[VarSub i]}})]]} {[DQ [VarSub KUBE_TEMP][LIT_CHARS /add-route.sh]]} ) ) ) ) ) ) ) ) (FunctionDef copy-kube-certs [] (List (= scope= flags=0 words=[] bindings=[('cert', {[DQ [LIT_CHARS kubecfg.crt]]})]) (= scope= flags=0 words=[] bindings=[('key', {[DQ [LIT_CHARS kubecfg.key]]})]) (= scope= flags=0 words=[] bindings=[('ca', {[DQ [LIT_CHARS ca.crt]]})]) (= scope= flags=0 words=[] bindings=[('cert_dir', {[DQ [LIT_CHARS /srv/kubernetes]]})]) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Copying credentials from "][VarSub KUBE_MASTER]]} ) (= scope= flags=1 words=[] bindings=[('KUBE_CERT', {[DQ [VarSub KUBE_TEMP][LIT_CHARS /][VarSub cert]]})]) (= scope= flags=1 words=[] bindings=[('KUBE_KEY', {[DQ [VarSub KUBE_TEMP][LIT_CHARS /][VarSub key]]})]) (= scope= flags=1 words=[] bindings=[('CA_CERT', {[DQ [VarSub KUBE_TEMP][LIT_CHARS /][VarSub ca]]})]) (= scope= flags=1 words=[] bindings=[('CONTEXT', {[DQ [LIT_CHARS photon-][VarSub INSTANCE_PREFIX]]})]) (Com {[LIT_CHARS run-ssh-cmd]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [LIT_CHARS "sudo chmod 644 "][VarSub cert_dir][LIT_CHARS /][VarSub cert]]} ) (Com {[LIT_CHARS run-ssh-cmd]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [LIT_CHARS "sudo chmod 644 "][VarSub cert_dir][LIT_CHARS /][VarSub key]]} ) (Com {[LIT_CHARS run-ssh-cmd]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [LIT_CHARS "sudo chmod 644 "][VarSub cert_dir][LIT_CHARS /][VarSub ca]]} ) (Com {[LIT_CHARS copy-file-from-vm]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [VarSub cert_dir][LIT_CHARS /][VarSub cert]]} {[DQ [VarSub KUBE_CERT]]} ) (Com {[LIT_CHARS copy-file-from-vm]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [VarSub cert_dir][LIT_CHARS /][VarSub key]]} {[DQ [VarSub KUBE_KEY]]} ) (Com {[LIT_CHARS copy-file-from-vm]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [VarSub cert_dir][LIT_CHARS /][VarSub ca]]} {[DQ [VarSub CA_CERT]]} ) (Com {[LIT_CHARS run-ssh-cmd]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [LIT_CHARS "sudo chmod 600 "][VarSub cert_dir][LIT_CHARS /][VarSub cert]]} ) (Com {[LIT_CHARS run-ssh-cmd]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [LIT_CHARS "sudo chmod 600 "][VarSub cert_dir][LIT_CHARS /][VarSub key]]} ) (Com {[LIT_CHARS run-ssh-cmd]} {[DQ [VarSub KUBE_MASTER_IP]]} {[DQ [LIT_CHARS "sudo chmod 600 "][VarSub cert_dir][LIT_CHARS /][VarSub ca]]} ) ) ) (FunctionDef run-script-remotely [] (List (= scope= flags=0 words=[] bindings=[('vm_ip', {[VarSub 1]})]) (= scope= flags=0 words=[] bindings=[('local_file', {[DQ [VarSub 2]]})]) (= scope= flags=0 words=[{[LIT_CHARS base_file]}] bindings=[]) (= scope= flags=0 words=[{[LIT_CHARS remote_file]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('base_file', {[ComSub (Com {[LIT_CHARS basename]} {[DQ [VarSub local_file]]})]})]) (= scope= flags=0 words=[] bindings=[('remote_file', {[DQ [LIT_CHARS /tmp/][VarSub base_file]]})]) (Com {[LIT_CHARS copy-file-to-vm]} {[DQ [VarSub vm_ip]]} {[DQ [VarSub local_file]]} {[DQ [VarSub remote_file]]} ) (Com {[LIT_CHARS run-ssh-cmd]} {[DQ [VarSub vm_ip]]} {[DQ [LIT_CHARS "chmod 700 "][VarSub remote_file]]} ) (Com {[LIT_CHARS run-ssh-cmd]} {[DQ [VarSub vm_ip]]} {[DQ [LIT_CHARS "nohup sudo "][VarSub remote_file][LIT_CHARS " < /dev/null 1> "][VarSub remote_file][LIT_CHARS ".out 2>&1 &"]]} ) ) ) (FunctionDef run-ssh-cmd [] (List (= scope= flags=0 words=[] bindings=[('ignore_failure', {[DQ ]})]) (If (DBracket {B2 BINARY_STRING_EQUAL {[DQ [VarSub 1]]} {[DQ [LIT_CHARS -i]]}}) (List (= scope= flags=0 words=[] bindings=[('ignore_failure', {[DQ [LIT_CHARS -i]]})]) (Com {[LIT_CHARS shift]} ) ) ) (= scope= flags=0 words=[] bindings=[('vm_ip', {[VarSub 1]})]) (Com {[LIT_CHARS shift]} ) (= scope= flags=0 words=[] bindings=[('cmd', {[VarSub 1]})]) (Com {[LIT_CHARS run-cmd]} {[VarSub ignore_failure]} {[DQ [LIT_CHARS "ssh "][VarSub SSH_OPTS][LIT_CHARS " "][VarSub VM_USER][LIT_CHARS "@"][VarSub vm_ip][LIT_CHARS " "][VarSub 1]]} ) ) ) (FunctionDef copy-file-to-vm [] (List (= scope= flags=0 words=[] bindings=[('vm_ip', {[VarSub 1]})]) (= scope= flags=0 words=[] bindings=[('local_file', {[VarSub 2]})]) (= scope= flags=0 words=[] bindings=[('remote_file', {[VarSub 3]})]) (Com {[LIT_CHARS run-cmd]} {[DQ [LIT_CHARS "scp "][VarSub SSH_OPTS][LIT_CHARS " "][VarSub local_file][LIT_CHARS " "][VarSub VM_USER][LIT_CHARS "@"][VarSub vm_ip][LIT_CHARS ":"][VarSub remote_file]]} ) ) ) (FunctionDef copy-file-from-vm [] (List (= scope= flags=0 words=[] bindings=[('vm_ip', {[VarSub 1]})]) (= scope= flags=0 words=[] bindings=[('remote_file', {[VarSub 2]})]) (= scope= flags=0 words=[] bindings=[('local_file', {[VarSub 3]})]) (Com {[LIT_CHARS run-cmd]} {[DQ [LIT_CHARS "scp "][VarSub SSH_OPTS][LIT_CHARS " "][VarSub VM_USER][LIT_CHARS "@"][VarSub vm_ip][LIT_CHARS ":"][VarSub remote_file][LIT_CHARS " "][VarSub local_file]]} ) ) ) (FunctionDef run-cmd [] (List (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (= scope= flags=0 words=[] bindings=[('ignore_failure', {[DQ ]})]) (If (DBracket {B2 BINARY_STRING_EQUAL {[DQ [VarSub 1]]} {[DQ [LIT_CHARS -i]]}}) (List (= scope= flags=0 words=[] bindings=[('ignore_failure', {[VarSub 1]})]) (Com {[LIT_CHARS shift]} ) ) ) (= scope= flags=0 words=[] bindings=[('cmd', {[VarSub 1]})]) (= scope= flags=0 words=[{[LIT_CHARS output]}] bindings=[]) (AndOr OP_OR_IF (= scope= flags=0 words=[] bindings=[('output', {[ComSub (Com redirects=[(DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2)]{[VarSub cmd]})]})]) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (If (DBracket {B1 UNARY_STRING_z {[DQ [VarSub ignore_failure]]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Failed to run command: "][VarSub cmd][LIT_CHARS " Output:"]]} ) (Com {[LIT_CHARS echo]} {[DQ [VarSub output]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) ) (= scope= flags=0 words=[] bindings=[('_OUTPUT', {[VarSub output]})]) (Com {[LIT_CHARS return]} {[VarSub rc]} ) ) ) (FunctionDef verify-ssh-prereqs [] (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Validating SSH configuration..."]]} ) (= scope= flags=0 words=[{[LIT_CHARS rc]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (Com {[LIT_CHARS ssh-add]} {[LIT_CHARS -L]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 2), > ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_EQ {[DQ [VarSub rc]]} {[LIT_CHARS 2]}}) (List (Com {[LIT_CHARS eval]} {[DQ [ComSub (Com {[LIT_CHARS ssh-agent]})]]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), > ) (Com {[LIT_CHARS trap-add]} {[DQ [LIT_CHARS "kill "][VarSub SSH_AGENT_PID]]} {[LIT_CHARS EXIT]} ) ) ) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (Com {[LIT_CHARS ssh-add]} {[LIT_CHARS -L]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 2), > ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_EQ {[DQ [VarSub rc]]} {[LIT_CHARS 1]}}) (AndOr OP_OR_IF (Com {[LIT_CHARS ssh-add]} ) (Com {[LIT_CHARS true]} ) ) ) (If (Pipeline! (Com {[LIT_CHARS ssh-add]} {[LIT_CHARS -L]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 2), > ) ) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Could not find or add an SSH identity."]]} ) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Please start ssh-agent, add your identity, and retry."]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) ) ) (FunctionDef verify-photon-config [] (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [LIT_CHARS "Validating Photon configuration..."]]} ) (Com {[LIT_CHARS set]} {[LIT_OTHER "+"] [LIT_CHARS o]} {[LIT_CHARS pipefail]} ) (Com {[LIT_CHARS verify-photon-flavors]} ) (Com {[LIT_CHARS verify-photon-image]} ) (Com {[LIT_CHARS verify-photon-tenant]} ) (Com {[LIT_CHARS set]} {[LIT_CHARS -o]} {[LIT_CHARS pipefail]} ) ) ) (FunctionDef verify-photon-flavors [] (List (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS flavor]} {[LIT_CHARS list]} ) (Com {[LIT_CHARS awk]} {[LIT_CHARS -F] [SQ ]} {[SQ ]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -q]} {[DQ [LIT_CHARS "^"][VarSub PHOTON_MASTER_FLAVOR][LIT_OTHER "$"]]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "ERROR: Cannot find VM flavor named "][VarSub PHOTON_MASTER_FLAVOR]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (If (DBracket {B2 BINARY_STRING_NOT_EQUAL {[DQ [VarSub PHOTON_MASTER_FLAVOR]]} {[DQ [VarSub PHOTON_NODE_FLAVOR]]}}) (List (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS flavor]} {[LIT_CHARS list]} ) (Com {[LIT_CHARS awk]} {[LIT_CHARS -F] [SQ ]} {[SQ ]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -q]} {[DQ [LIT_CHARS "^"][VarSub PHOTON_NODE_FLAVOR][LIT_OTHER "$"]]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "ERROR: Cannot find VM flavor named "][VarSub PHOTON_NODE_FLAVOR]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) ) ) (AndOr OP_OR_IF (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS flavor]} {[LIT_CHARS list]} ) (Com {[LIT_CHARS awk]} {[LIT_CHARS -F] [SQ ]} {[SQ ]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -q]} {[DQ [LIT_CHARS "^"][VarSub PHOTON_DISK_FLAVOR][LIT_OTHER "$"]]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "ERROR: Cannot find disk flavor named "][VarSub PHOTON_DISK_FLAVOR]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) ) ) (FunctionDef verify-photon-image [] (List (= scope= flags=0 words=[{[LIT_CHARS rc]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS image]} {[LIT_CHARS list]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -q]} {[SQ ] [DQ [VarSub PHOTON_IMAGE]] [SQ ]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "ERROR: Cannot find image "][\ LIT_ESCAPED_CHAR "\\\""][VarSub PHOTON_IMAGE][\ LIT_ESCAPED_CHAR "\\\""]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS image]} {[LIT_CHARS list]} ) (Com {[LIT_CHARS grep]} {[SQ ] [DQ [VarSub PHOTON_IMAGE]] [SQ ]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS ERROR]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_EQ {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "Warning: You have at least one "][VarSub PHOTON_IMAGE][LIT_CHARS " image in the ERROR state. You may want to investigate."]]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "Images in the ERROR state will be ignored."]]} ) ) ) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (= scope= flags=0 words=[] bindings=[('num_images', {[ComSub (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS image]} {[LIT_CHARS list]}) (Com {[LIT_CHARS grep]} {[SQ ] [DQ [VarSub PHOTON_IMAGE]] [SQ ]}) (Com {[LIT_CHARS grep]} {[LIT_CHARS -c]} {[LIT_CHARS READY]}) )]})]) (If (DBracket {B2 BINARY_INT_GT {[DQ [VarSub num_images]]} {[LIT_CHARS 1]}}) (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "ERROR: You have more than one READY "][VarSub PHOTON_IMAGE][LIT_CHARS " image. Ensure there is only one"]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) ) ) (FunctionDef verify-photon-tenant [] (List (= scope= flags=0 words=[{[LIT_CHARS rc]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS tenant]} {[LIT_CHARS list]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -q]} {[SQ ] [DQ [VarSub PHOTON_TENANT]]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "ERROR: Cannot find tenant "][\ LIT_ESCAPED_CHAR "\\\""][VarSub PHOTON_TENANT][\ LIT_ESCAPED_CHAR "\\\""]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (AndOr OP_OR_IF (Pipeline (Com {[VarSub PHOTON]} {[LIT_CHARS project]} {[LIT_CHARS list]} {[LIT_CHARS --tenant]} {[DQ [VarSub PHOTON_TENANT]]} ) (Com {[LIT_CHARS grep]} {[LIT_CHARS -q]} {[SQ ] [DQ [VarSub PHOTON_PROJECT]] [SQ ]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) ) (= scope= flags=0 words=[] bindings=[('rc', {[VarSub ?]})]) ) (If (DBracket {B2 BINARY_INT_NE {[VarSub rc]} {[LIT_CHARS 0]}}) (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "ERROR: Cannot find project "][\ LIT_ESCAPED_CHAR "\\\""][VarSub PHOTON_PROJECT][\ LIT_ESCAPED_CHAR "\\\""]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) ) ) (FunctionDef verify-cmd-in-path [] (List (= scope= flags=0 words=[] bindings=[('cmd', {[VarSub 1]})]) (AndOr OP_OR_IF (Com {[LIT_CHARS which]} {[DQ [VarSub cmd]]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), > ) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Can't find "][VarSub cmd][LIT_CHARS " in PATH, please install and retry."]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) ) ) (FunctionDef ensure-temp-dir [] (If (DBracket {B1 UNARY_STRING_z {[VarSub KUBE_TEMP test_op=VS_TEST_HYPHEN {}]}}) (List (= scope= flags=0 words=[] bindings=[('KUBE_TEMP', {[ComSub (Com {[LIT_CHARS mktemp]} {[LIT_CHARS -d]} {[LIT_CHARS -t]} {[LIT_CHARS kubernetes.XXXXXX]})]})]) (Com {[LIT_CHARS trap-add]} {[DQ [LIT_CHARS "rm -rf '"][VarSub KUBE_TEMP][LIT_CHARS "'"]]} {[LIT_CHARS EXIT]} ) ) ) ) (FunctionDef try-until-success-ssh [] (List (= scope= flags=0 words=[] bindings=[('vm_ip', {[VarSub 1]})]) (= scope= flags=0 words=[] bindings=[('cmd_description', {[VarSub 2]})]) (= scope= flags=0 words=[] bindings=[('cmd', {[VarSub 3]})]) (= scope= flags=0 words=[] bindings=[('timeout', {[LIT_CHARS 600]})]) (= scope= flags=0 words=[] bindings=[('sleep_time', {[LIT_CHARS 5]})]) (= scope= flags=0 words=[{[LIT_CHARS max_attempts]}] bindings=[]) (DParen {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub max_attempts]}} {A2 AS_OP_SLASH {A Atom NODE_ARITH_WORD {[VarSub timeout]}} {A Atom NODE_ARITH_WORD {[VarSub sleep_time]}}}}) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [VarSub cmd_description][LIT_CHARS " for up to 10 minutes..."]]} ) (= scope= flags=0 words=[] bindings=[('attempt', {[LIT_CHARS 0]})]) (While (Com {[LIT_CHARS true]} ) (List (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (Com {[LIT_CHARS run-ssh-cmd]} {[LIT_CHARS -i]} {[DQ [VarSub vm_ip]]} {[DQ [VarSub cmd]]} ) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 1]})]) ) (If (DBracket {B2 BINARY_STRING_NOT_EQUAL {[VarSub rc]} {[LIT_CHARS 0]}}) (If (DParen {A2 AS_OP_DEQUAL {A Atom NODE_ARITH_WORD {[VarSub attempt]}} {A Atom NODE_ARITH_WORD {[VarSub max_attempts]}}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Failed, cannot proceed: you may need to retry to log into the VM to debug"]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (ElseTrue) (Com {[LIT_CHARS break]} ) ) (= 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]} {[VarSub sleep_time]} ) ) ) ) ) (FunctionDef try-until-success [] (List (= scope= flags=0 words=[] bindings=[('cmd_description', {[VarSub 1]})]) (= scope= flags=0 words=[] bindings=[('cmd', {[VarSub 2]})]) (= scope= flags=0 words=[] bindings=[('timeout', {[LIT_CHARS 600]})]) (= scope= flags=0 words=[] bindings=[('sleep_time', {[LIT_CHARS 5]})]) (= scope= flags=0 words=[{[LIT_CHARS max_attempts]}] bindings=[]) (DParen {A2 AS_OP_EQUAL {A Atom NODE_ARITH_WORD {[VarSub max_attempts]}} {A2 AS_OP_SLASH {A Atom NODE_ARITH_WORD {[VarSub timeout]}} {A Atom NODE_ARITH_WORD {[VarSub sleep_time]}}}}) (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS status]} {[DQ [VarSub cmd_description][LIT_CHARS " for up to 10 minutes..."]]} ) (= scope= flags=0 words=[] bindings=[('attempt', {[LIT_CHARS 0]})]) (While (Com {[LIT_CHARS true]} ) (List (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 0]})]) (AndOr OP_OR_IF (Com {[LIT_CHARS run-cmd]} {[LIT_CHARS -i]} {[DQ [VarSub cmd]]} ) (= scope= flags=0 words=[] bindings=[('rc', {[LIT_CHARS 1]})]) ) (If (DBracket {B2 BINARY_STRING_NOT_EQUAL {[VarSub rc]} {[LIT_CHARS 0]}}) (If (DParen {A2 AS_OP_DEQUAL {A Atom NODE_ARITH_WORD {[VarSub attempt]}} {A Atom NODE_ARITH_WORD {[VarSub max_attempts]}}}) (List (Com {[LIT_CHARS kube] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS log] [LIT_OTHER ":"] [LIT_OTHER ":"] [LIT_CHARS error]} {[DQ [LIT_CHARS "Failed, cannot proceed"]]} ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (ElseTrue) (Com {[LIT_CHARS break]} ) ) (= 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]} {[VarSub sleep_time]} ) ) ) ) ) (FunctionDef trap-add [] (List (= scope= flags=0 words=[] bindings=[('handler', {[DQ [VarSub 1]]})]) (= scope= flags=0 words=[] bindings=[('signal', {[DQ [VarSub 2 test_op=VS_TEST_HYPHEN {[LIT_CHARS EXIT]}]]})]) (= scope= flags=0 words=[{[LIT_CHARS cur]}] bindings=[]) (= scope= flags=0 words=[] bindings=[('cur', {[DQ [ComSub (Com {[LIT_CHARS eval]} {[DQ [LIT_CHARS "sh -c 'echo "][\ LIT_ESCAPED_CHAR "\\$"][LIT_CHARS "3' -- "][ComSub (Com {[LIT_CHARS trap]} {[LIT_CHARS -p]} {[VarSub signal]})]]})]]})]) (If (DBracket {B1 UNARY_STRING_n {[DQ [VarSub cur]]}}) (= scope= flags=0 words=[] bindings=[('handler', {[DQ [VarSub cur][LIT_CHARS "; "][VarSub handler]]})]) ) (Com {[LIT_CHARS trap]} {[DQ [VarSub handler]]} {[VarSub signal]} ) ) ) )