(CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_HOST) op: Equal rhs: { (BracedVarSub token: <VSub_Name KUBE_HOST> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(localhost)}) spids: [70 74] ) } spids: [69] ) ] spids: [69] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBELET_KUBECONFIG) op: Equal rhs: { (BracedVarSub token: <VSub_Name KUBELET_KUBECONFIG> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(DQ (/var/run/kubernetes/kubelet.kubeconfig))} ) spids: [77 83] ) } spids: [76] ) ] spids: [76] ) (Assignment keyword: Assign_Declare flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:RED) op: Equal rhs: {(DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\0">) ("33[0;31m"))} spids: [90] ) ] spids: [86] ) (Assignment keyword: Assign_Declare flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:GREEN) op: Equal rhs: {(DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\0">) ("33[0;32m"))} spids: [100] ) ] spids: [96] ) (Assignment keyword: Assign_Declare flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:YELLOW) op: Equal rhs: {(DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\0">) ("33[0;33m"))} spids: [110] ) ] spids: [106] ) (FuncDef name: echo_green body: (BraceGroup children: [ (Sentence child: (C {(echo)} {(-e)} {(DQ (${ VSub_Name GREEN) ($ VSub_Number "$1"))}) terminator: <Op_Semi ";"> ) (C {(tput)} {(sgr0)}) ] spids: [121] ) spids: [117 120] ) (FuncDef name: echo_red body: (BraceGroup children: [ (Sentence child: (C {(echo)} {(-e)} {(DQ (${ VSub_Name RED) ($ VSub_Number "$1"))}) terminator: <Op_Semi ";"> ) (C {(tput)} {(sgr0)}) ] spids: [147] ) spids: [143 146] ) (FuncDef name: echo_yellow body: (BraceGroup children: [ (Sentence child: (C {(echo)} {(-e)} {(DQ (${ VSub_Name YELLOW) ($ VSub_Number "$1"))}) terminator: <Op_Semi ";"> ) (C {(tput)} {(sgr0)}) ] spids: [173] ) spids: [169 172] ) (FuncDef name: run body: (BraceGroup children: [ (C {(set)} {(Lit_Other "+") (o)} {(errexit)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:output) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{($ VSub_Number "$1")}] redirects: [ (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [218] ) ] ) ] ) left_token: <Left_CommandSub "$("> spids: [215 220] ) } spids: [214] ) ] spids: [214] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:exit_code) op: Equal rhs: {($ VSub_QMark "$?")} spids: [223] ) ] spids: [223] ) (C {(set)} {(-o)} {(errexit)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$exit_code")} {(-eq)} {(0)} {(Lit_Other "]")}) terminator: <Op_Semi ";"> ) ] action: [(C {(echo_green)} {(DQ (SUCCESS))})] spids: [-1 247] ) ] else_action: [ (C {(echo_red)} {(DQ (FAILED))}) (SimpleCommand words: [{(echo)} {($ VSub_Name "$output")}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[271])] ) (C {(exit)} {(1)}) ] spids: [257 280] ) ] spids: [199] ) spids: [195 198] ) (FuncDef name: create-kubelet-kubeconfig body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:destination) op: Equal rhs: {(DQ (${ VSub_Number 2))} spids: [302] ) ] spids: [300] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id:BoolUnary_z child:{(DQ (${ VSub_Name destination))}) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(DQ ("Must provide destination path to create Kubelet kubeconfig file!"))} ) (C {(exit)} {(1)}) ] spids: [-1 325] ) ] spids: [-1 340] ) (C {(echo)} {(DQ ("Creating Kubelet kubeconfig file"))}) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:dest_dir) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name destination))})] ) left_token: <Left_CommandSub "$("> spids: [354 362] ) ) } spids: [352] ) ] spids: [350] ) (Sentence child: (C {(mkdir)} {(-p)} {(DQ (${ VSub_Name dest_dir))}) terminator: <Op_Amp "&"> ) (AndOr children: [ (SimpleCommand redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[377])] ) (C {(sudo)} {(mkdir)} {(-p)} {(DQ (${ VSub_Name dest_dir))}) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sudo) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (C {(test)} {(-w)} {(DQ (${ VSub_Name dest_dir))}) (C {(echo)} {(DQ ("sudo -E"))}) ] op_id: Op_DPipe ) ] ) left_token: <Left_CommandSub "$("> spids: [396 414] ) } spids: [395] ) ] spids: [395] ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("apiVersion: v1\n") ("kind: Config\n") ("clusters:\n") (" - cluster:\n") (" server: http://localhost:8080\n") (" name: local\n") ("contexts:\n") (" - context:\n") (" cluster: local\n") (" name: local\n") ("current-context: local\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [419] ) ] ) (SimpleCommand words: [{(${ VSub_Name sudo)} {(tee)} {(DQ (${ VSub_Name destination))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[436])] ) ] negated: False ) ] spids: [297] ) spids: [291 296] ) (FuncDef name: create_cluster body: (BraceGroup children: [ (C {(echo)} {(DQ ("Creating a local cluster:"))}) (C {(echo)} {(-e)} {(-n)} {(DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) ("Starting kubelet..."))} ) (C {(create-kubelet-kubeconfig)} {(DQ (${ VSub_Name KUBELET_KUBECONFIG))}) (C {(run)} { (DQ ("docker run ") (" --volume=/:/rootfs:ro ") (" --volume=/sys:/sys:ro ") (" --volume=/var/lib/docker/:/var/lib/docker:rw ") (" --volume=/var/lib/kubelet/:/var/lib/kubelet:rw ") (" --volume=/var/run:/var/run:rw ") (" --volume=/run/xtables.lock:/run/xtables.lock:rw ") (" --net=host ") (" --pid=host ") (" --privileged=true ") (" -d ") (" gcr.io/google_containers/hyperkube-") (${ VSub_Name arch) (":") (${ VSub_Name release) (" ") (" /hyperkube kubelet ") (" --containerized ") (" --hostname-override=") ) (127.0.0.1) (DQ (" ") (" --address=")) (0.0.0.0) (DQ (" ") (" --kubeconfig=") (${ VSub_Name KUBELET_KUBECONFIG) ("/kubelet.kubeconfig ") (" --pod-manifest-path=/etc/kubernetes/manifests ") (" --allow-privileged=true ") (" --cluster-dns=10.0.0.10 ") (" --cluster-domain=cluster.local ") (" --v=2") ) } ) (C {(echo)} {(-e)} {(-n)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) ("Waiting for master components to start...") ) } ) (While cond: [(Sentence child:(C {(true)}) terminator:<Op_Semi ";">)] body: (DoGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:running_count) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (SimpleCommand words: [ {(kubectl)} {(-s) (Lit_Other "=") (http) (Lit_Other ":") (//) (${ VSub_Name KUBE_HOST) (Lit_Other ":") (8080) } {(get)} {(pods)} {(--no-headers)} {(--namespace) (Lit_Other "=") (kube-system)} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [607] ) ] ) (C {(grep)} {(DQ (Running))}) (C {(wc)} {(-l)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [583 623] ) } spids: [582] ) ] spids: [580] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$running_count"))} {(-ge)} {(3)} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [(ControlFlow token:<ControlFlow_Break break>)] spids: [-1 645] ) ] spids: [-1 651] ) (C {(echo)} {(-n)} {(DQ (.))}) (C {(sleep)} {(1)}) ] spids: [577 668] ) ) (C {(echo_green)} {(DQ (SUCCESS))}) (C {(echo_green)} {(DQ ("Cluster created!"))}) (C {(echo)} {(DQ )}) (C {(kubectl)} {(-s)} {(http) (Lit_Other ":") (//) (${ VSub_Name KUBE_HOST) (Lit_Other ":") (8080)} {(clusterinfo)} ) ] spids: [459] ) spids: [455 458] ) (FuncDef name: get_latest_version_number body: (BraceGroup children: [ (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:latest_url) op: Equal rhs: {(DQ ("https://storage.googleapis.com/kubernetes-release/release/stable.txt"))} spids: [720] ) ] spids: [716] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(wget)})]) left_token: <Left_CommandSub "$("> spids: [730 734] ) } ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(wget)} {(-qO-)} {(${ VSub_Name latest_url)})] spids: [-1 739] ) (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(curl)})]) left_token: <Left_CommandSub "$("> spids: [755 759] ) } ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(curl)} {(-Ss)} {(${ VSub_Name latest_url)})] spids: [751 764] ) ] else_action: [ (C {(echo_red)} {(DQ ("Couldn't find curl or wget. Bailing out."))}) (C {(exit)} {(4)}) ] spids: [776 791] ) ] spids: [713] ) spids: [709 712] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:latest_release) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(get_latest_version_number)})]) left_token: <Left_CommandSub "$("> spids: [797 799] ) } spids: [796] ) ] spids: [796] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:release) op: Equal rhs: { (BracedVarSub token: <VSub_Name KUBE_VERSION> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(${ VSub_Name latest_release)} ) spids: [802 808] ) } spids: [801] ) ] spids: [801] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:uname) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(uname)})]) left_token: <Left_CommandSub "$("> spids: [812 814] ) } spids: [811] ) ] spids: [811] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name uname))} right: {(DQ (Darwin))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:platform) op: Equal rhs: {(DQ (darwin))} spids: [838] ) ] spids: [838] ) ] spids: [-1 835] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name uname))} right: {(DQ (Linux))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:platform) op: Equal rhs: {(DQ (linux))} spids: [865] ) ] spids: [865] ) ] spids: [843 862] ) ] else_action: [ (C {(echo_red)} {(DQ ("Unknown, unsupported platform: (") (${ VSub_Name uname) (")."))}) (C {(echo_red)} {(DQ ("Supported platforms: Linux, Darwin."))}) (C {(echo_red)} {(DQ ("Bailing out."))}) (C {(exit)} {(2)}) ] spids: [870 902] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:machine) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(uname)} {(-m)})]) left_token: <Left_CommandSub "$("> spids: [906 910] ) } spids: [905] ) ] spids: [905] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name machine))} right: {(DQ (x86_64))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (amd64))} spids:[934])] spids: [934] ) ] spids: [-1 931] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name machine))} right: {(DQ (i686))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (386))} spids:[961])] spids: [961] ) ] spids: [939 958] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name machine))} right: {(DQ ("arm*"))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (arm))} spids:[988])] spids: [988] ) ] spids: [966 985] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name machine))} right: {(DQ ("s390x*"))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (s390x))} spids:[1015])] spids: [1015] ) ] spids: [993 1012] ) ] else_action: [ (C {(echo_red)} {(DQ ("Unknown, unsupported architecture (") (${ VSub_Name machine) (")."))}) (C {(echo_red)} {(DQ ("Supported architectures x86_64, i686, arm, s390x."))}) (C {(echo_red)} {(DQ ("Bailing out."))}) (C {(exit)} {(3)}) ] spids: [1020 1052] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kubectl_url) op: Equal rhs: { (DQ ("https://storage.googleapis.com/kubernetes-release/release/") (${ VSub_Name release) (/bin/) (${ VSub_Name platform) (/) (${ VSub_Name arch) (/kubectl) ) } spids: [1055] ) ] spids: [1055] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_lt left: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(ls)} {(.)}) (C {(grep)} {(Lit_Other "^") (kubectl) (Lit_Other "$")}) (C {(wc)} {(-l)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1077 1095] ) } right: {(1)} ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(-n)} {(DQ ("Downloading kubectl binary..."))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(wget)})]) left_token: <Left_CommandSub "$("> spids: [1120 1124] ) } ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(run)} {(DQ ("wget ") (${ VSub_Name kubectl_url))})] spids: [-1 1129] ) (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(curl)})]) left_token: <Left_CommandSub "$("> spids: [1146 1150] ) } ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(run)} {(DQ ("curl -OL ") (${ VSub_Name kubectl_url))})] spids: [1142 1155] ) ] else_action: [ (C {(echo_red)} {(DQ ("Couldn't find curl or wget. Bailing out."))}) (C {(exit)} {(1)}) ] spids: [1168 1183] ) (C {(chmod)} {(a) (Lit_Other "+") (x)} {(kubectl)}) (C {(echo)} {(DQ )}) ] spids: [-1 1104] ) ] else_action: [(C {(echo)} {(DQ ("Detected existing kubectl binary. Skipping download."))})] spids: [1200 1217] ) (C {(create_cluster)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("To list the nodes in your cluster run"))}) (C {(echo_yellow)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) ("kubectl -s=http://") (${ VSub_Name KUBE_HOST) (":8080 get nodes") ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("To run your first pod run"))}) (C {(echo_yellow)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) ("kubectl -s http://") (${ VSub_Name KUBE_HOST) (":8080 run nginx --image=nginx --port=80") ) } ) ] )