(CommandList children: [ (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/gce/gci/helper.sh))}) (FuncDef name: create-master-instance body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:address) op:Equal rhs:{(DQ )} spids:[105])] spids: [103] ) (AndOr children: [ (DBracket expr: (BoolUnary op_id: BoolUnary_n child: { (BracedVarSub token: <VSub_Number 1> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{}) spids: [114 117] ) } ) ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:address) op: Equal rhs: {(DQ (${ VSub_Number 1))} spids: [123] ) ] spids: [123] ) ] op_id: Op_DAmp ) (C {(write-master-env)}) (C {(ensure-gci-metadata-files)}) (C {(create-master-instance-internal)} {(DQ (${ VSub_Name MASTER_NAME))} {(DQ (${ VSub_Name address))} ) ] spids: [100] ) spids: [96 99] ) (FuncDef name: replicate-master-instance body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:existing_master_zone) op: Equal rhs: {(DQ (${ VSub_Number 1))} spids: [166] ) ] spids: [164] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:existing_master_name) op: Equal rhs: {(DQ (${ VSub_Number 2))} spids: [176] ) ] spids: [174] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:existing_master_replicas) op: Equal rhs: {(DQ (${ VSub_Number 3))} spids: [186] ) ] spids: [184] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:kube_env) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(get-metadata)} {(DQ (${ VSub_Name existing_master_zone))} {(DQ (${ VSub_Name existing_master_name))} {(kube-env)} ) ] ) left_token: <Left_CommandSub "$("> spids: [199 215] ) ) } spids: [197] ) ] spids: [195] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kube_env) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name kube_env))}) (C {(grep)} {(-v)} {(DQ (INITIAL_ETCD_CLUSTER))}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [225 243] ) ) } spids: [223] ) ] spids: [223] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kube_env) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(echo)} {(-e)} { (DQ (${ VSub_Name kube_env) (EscapedLiteralPart token: <Lit_EscapedChar "\\n"> ) ("INITIAL_ETCD_CLUSTER: '") (${ VSub_Name existing_master_replicas) (",") (${ VSub_Name REPLICA_NAME) ("'") ) } ) ] ) left_token: <Left_CommandSub "$("> spids: [249 269] ) ) } spids: [247] ) ] spids: [247] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kube_env) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name kube_env))}) (C {(grep)} {(-v)} {(DQ (INITIAL_ETCD_CLUSTER_STATE))}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [280 298] ) ) } spids: [278] ) ] spids: [278] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kube_env) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(echo)} {(-e)} { (DQ (${ VSub_Name kube_env) (EscapedLiteralPart token: <Lit_EscapedChar "\\n"> ) ("INITIAL_ETCD_CLUSTER_STATE: 'existing'") ) } ) ] ) left_token: <Left_CommandSub "$("> spids: [304 316] ) ) } spids: [302] ) ] spids: [302] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ETCD_CA_KEY) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name kube_env))}) (C {(grep)} {(DQ (ETCD_CA_KEY))}) (C {(sed)} {(DQ ("s/^.*: '//"))}) (C {(sed)} {(DQ ("s/'") (Lit_Other "$") (//))}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [323 357] ) ) } spids: [321] ) ] spids: [321] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ETCD_CA_CERT) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name kube_env))}) (C {(grep)} {(DQ (ETCD_CA_CERT))}) (C {(sed)} {(DQ ("s/^.*: '//"))}) (C {(sed)} {(DQ ("s/'") (Lit_Other "$") (//))}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [363 397] ) ) } spids: [361] ) ] spids: [361] ) (C {(create-etcd-certs)} {(DQ (${ VSub_Name REPLICA_NAME))} {(DQ (${ VSub_Name ETCD_CA_CERT))} {(DQ (${ VSub_Name ETCD_CA_KEY))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kube_env) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name kube_env))}) (C {(grep)} {(-v)} {(DQ (ETCD_PEER_KEY))}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [425 443] ) ) } spids: [423] ) ] spids: [423] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kube_env) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(echo)} {(-e)} { (DQ (${ VSub_Name kube_env) (EscapedLiteralPart token: <Lit_EscapedChar "\\n"> ) ("ETCD_PEER_KEY: '") (${ VSub_Name ETCD_PEER_KEY_BASE64) ("'") ) } ) ] ) left_token: <Left_CommandSub "$("> spids: [449 465] ) ) } spids: [447] ) ] spids: [447] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kube_env) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name kube_env))}) (C {(grep)} {(-v)} {(DQ (ETCD_PEER_CERT))}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [471 489] ) ) } spids: [469] ) ] spids: [469] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kube_env) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(echo)} {(-e)} { (DQ (${ VSub_Name kube_env) (EscapedLiteralPart token: <Lit_EscapedChar "\\n"> ) ("ETCD_PEER_CERT: '") (${ VSub_Name ETCD_PEER_CERT_BASE64) ("'") ) } ) ] ) left_token: <Left_CommandSub "$("> spids: [495 511] ) ) } spids: [493] ) ] spids: [493] ) (SimpleCommand words: [{(echo)} {(DQ (${ VSub_Name kube_env))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name KUBE_TEMP) (/master-kube-env.yaml)} spids: [524] ) ] ) (SimpleCommand words: [ {(get-metadata)} {(DQ (${ VSub_Name existing_master_zone))} {(DQ (${ VSub_Name existing_master_name))} {(cluster-name)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name KUBE_TEMP) (/cluster-name.txt))} spids: [548] ) ] ) (SimpleCommand words: [ {(get-metadata)} {(DQ (${ VSub_Name existing_master_zone))} {(DQ (${ VSub_Name existing_master_name))} {(gci-update-strategy)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name KUBE_TEMP) (/gci-update.txt))} spids: [574] ) ] ) (SimpleCommand words: [ {(get-metadata)} {(DQ (${ VSub_Name existing_master_zone))} {(DQ (${ VSub_Name existing_master_name))} {(gci-ensure-gke-docker)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name KUBE_TEMP) (/gci-ensure-gke-docker.txt))} spids: [600] ) ] ) (SimpleCommand words: [ {(get-metadata)} {(DQ (${ VSub_Name existing_master_zone))} {(DQ (${ VSub_Name existing_master_name))} {(gci-docker-version)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name KUBE_TEMP) (/gci-docker-version.txt))} spids: [626] ) ] ) (SimpleCommand words: [ {(get-metadata)} {(DQ (${ VSub_Name existing_master_zone))} {(DQ (${ VSub_Name existing_master_name))} {(kube-master-certs)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name KUBE_TEMP) (/kube-master-certs.yaml))} spids: [652] ) ] ) (C {(create-master-instance-internal)} {(DQ (${ VSub_Name REPLICA_NAME))}) ] spids: [161] ) spids: [155 160] ) (FuncDef name: create-master-instance-internal body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:gcloud) op: Equal rhs: {(DQ (gcloud))} spids: [686] ) ] spids: [684] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:retries) op:Equal rhs:{(5)} spids:[694])] spids: [692] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (DQ (BracedVarSub token: <VSub_Name ENABLE_IP_ALIASES> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [703 706] ) ) } right: {(SQ <true>)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:gcloud) op: Equal rhs: {(DQ ("gcloud beta"))} spids: [721] ) ] spids: [721] ) ] spids: [-1 718] ) ] spids: [-1 727] ) (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:master_name) op: Equal rhs: {(DQ (${ VSub_Number 1))} spids: [735] ) ] spids: [731] ) (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:address) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 2> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [749 752] ) ) } spids: [747] ) ] spids: [743] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:preemptible_master) op: Equal rhs: {(DQ )} spids: [759] ) ] spids: [757] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (DQ (BracedVarSub token: <VSub_Name PREEMPTIBLE_MASTER> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [769 772] ) ) } right: {(DQ (true))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:preemptible_master) op: Equal rhs: {(DQ ("--preemptible --maintenance-policy TERMINATE"))} spids: [787] ) ] spids: [787] ) ] spids: [-1 784] ) ] spids: [-1 793] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:network) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(make-gcloud-network-argument)} {(DQ (${ VSub_Name NETWORK_PROJECT))} {(DQ (${ VSub_Name REGION))} {(DQ (${ VSub_Name NETWORK))} { (DQ (BracedVarSub token: <VSub_Name SUBNETWORK> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [824 827] ) ) } { (DQ (BracedVarSub token: <VSub_Name address> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [833 836] ) ) } { (DQ (BracedVarSub token: <VSub_Name ENABLE_IP_ALIASES> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [840 843] ) ) } { (DQ (BracedVarSub token: <VSub_Name IP_ALIAS_SIZE> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [847 850] ) ) } ) ] ) left_token: <Left_CommandSub "$("> spids: [800 852] ) } spids: [799] ) ] spids: [797] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:metadata) op: Equal rhs: {(DQ ("kube-env=") (${ VSub_Name KUBE_TEMP) (/master-kube-env.yaml))} spids: [858] ) ] spids: [856] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: Equal rhs: { (DQ (${ VSub_Name metadata) (",user-data=") (${ VSub_Name KUBE_ROOT) (/cluster/gce/gci/master.yaml) ) } spids: [868] ) ] spids: [868] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: Equal rhs: { (DQ (${ VSub_Name metadata) (",configure-sh=") (${ VSub_Name KUBE_ROOT) (/cluster/gce/gci/configure.sh) ) } spids: [881] ) ] spids: [881] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: Equal rhs: { (DQ (${ VSub_Name metadata) (",cluster-name=") (${ VSub_Name KUBE_TEMP) (/cluster-name.txt) ) } spids: [894] ) ] spids: [894] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: Equal rhs: { (DQ (${ VSub_Name metadata) (",gci-update-strategy=") (${ VSub_Name KUBE_TEMP) (/gci-update.txt) ) } spids: [907] ) ] spids: [907] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: Equal rhs: { (DQ (${ VSub_Name metadata) (",gci-ensure-gke-docker=") (${ VSub_Name KUBE_TEMP) (/gci-ensure-gke-docker.txt) ) } spids: [920] ) ] spids: [920] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: Equal rhs: { (DQ (${ VSub_Name metadata) (",gci-docker-version=") (${ VSub_Name KUBE_TEMP) (/gci-docker-version.txt) ) } spids: [933] ) ] spids: [933] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: Equal rhs: { (DQ (${ VSub_Name metadata) (",kube-master-certs=") (${ VSub_Name KUBE_TEMP) (/kube-master-certs.yaml) ) } spids: [946] ) ] spids: [946] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:disk) op: Equal rhs: {(DQ ("name=") (${ VSub_Name master_name) (-pd))} spids: [962] ) ] spids: [960] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:disk) op: Equal rhs: {(DQ (${ VSub_Name disk) (",device-name=master-pd"))} spids: [972] ) ] spids: [972] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:disk) op: Equal rhs: {(DQ (${ VSub_Name disk) (",mode=rw"))} spids: [981] ) ] spids: [981] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:disk) op: Equal rhs: {(DQ (${ VSub_Name disk) (",boot=no"))} spids: [990] ) ] spids: [990] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:disk) op: Equal rhs: {(DQ (${ VSub_Name disk) (",auto-delete=no"))} spids: [999] ) ] spids: [999] ) (ForEach iter_name: attempt iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(seq)} {(1)} {(${ VSub_Name retries)})]) left_token: <Left_CommandSub "$("> spids: [1015 1023] ) } ] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:result) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(${ VSub_Name gcloud)} {(compute)} {(instances)} {(create)} {(DQ (${ VSub_Name master_name))} {(--project)} {(DQ (${ VSub_Name PROJECT))} {(--zone)} {(DQ (${ VSub_Name ZONE))} {(--machine-type)} {(DQ (${ VSub_Name MASTER_SIZE))} {(--image-project) (Lit_Other "=") (DQ (${ VSub_Name MASTER_IMAGE_PROJECT)) } {(--image)} {(DQ (${ VSub_Name MASTER_IMAGE))} {(--tags)} {(DQ (${ VSub_Name MASTER_TAG))} {(--scopes)} { (DQ ( "storage-ro,compute-rw,monitoring,logging-write" ) ) } {(--metadata-from-file)} {(DQ (${ VSub_Name metadata))} {(--disk)} {(DQ (${ VSub_Name disk))} {(--boot-disk-size)} {(DQ (${ VSub_Name MASTER_ROOT_DISK_SIZE))} {(${ VSub_Name preemptible_master)} {(${ VSub_Name network)} ] redirects: [ (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [1159] ) ] ) ] ) left_token: <Left_CommandSub "$("> spids: [1032 1161] ) } spids: [1031] ) ] spids: [1031] ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ (${ VSub_Name result))}] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [1175] ) ] ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(0)} ) ] spids: [-1 1164] ) ] else_action: [ (SimpleCommand words: [{(echo)} {(DQ (${ VSub_Name result))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1195])] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolBinary op_id: BoolBinary_EqualTilde left: {(DQ (${ VSub_Name result))} right: {(DQ ("try again later"))} ) ) ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ( "Failed to create master instance due to non-retryable error" ) ) } ] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [1229] ) ] ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(1)} ) ] spids: [-1 1220] ) ] spids: [-1 1238] ) (C {(sleep)} {(10)}) ] spids: [1184 1246] ) ] spids: [1026 1249] ) spids: [1014 1024] ) (SimpleCommand words: [ {(echo)} { (DQ ("Failed to create master instance despite ") (${ VSub_Name retries) (" attempts") ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1263])] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] spids: [681] ) spids: [675 680] ) (FuncDef name: get-metadata body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:zone) op: Equal rhs: {(DQ (${ VSub_Number 1))} spids: [1285] ) ] spids: [1283] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:name) op: Equal rhs: {(DQ (${ VSub_Number 2))} spids: [1295] ) ] spids: [1293] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:key) op: Equal rhs: {(DQ (${ VSub_Number 3))} spids: [1305] ) ] spids: [1303] ) (SimpleCommand words: [ {(gcloud)} {(compute)} {(ssh)} {(DQ (${ VSub_Name name))} {(--project)} {(DQ (${ VSub_Name PROJECT))} {(--zone)} {(DQ (${ VSub_Name zone))} {(--command)} { (DQ ("curl ") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ("http://metadata.google.internal/computeMetadata/v1/instance/attributes/") (${ VSub_Name key) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (" -H ") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ("Metadata-Flavor: Google") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ) } ] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[1363])] ) ] spids: [1280] ) spids: [1274 1279] ) ] )