(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 (Lit_Other '\\') ('033[0;31m'))} spids: [90] ) ] spids: [86] ) (Assignment keyword: Assign_Declare flags: [-r] pairs: [ (assign_pair lhs: (LhsName name:GREEN) op: Equal rhs: {(DQ (Lit_Other '\\') ('033[0;32m'))} spids: [100] ) ] spids: [96] ) (Assignment keyword: Assign_Declare flags: [-r] pairs: [ (assign_pair lhs: (LhsName name:YELLOW) op: Equal rhs: {(DQ (Lit_Other '\\') ('033[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: [16777215 247] ) ] else_action: [ (C {(echo_red)} {(DQ (FAILED))}) (SimpleCommand words: [{(echo)} {($ VSub_Name '$output')}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[271])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(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!'))} ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 325] ) ] spids: [16777215 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 ops: [Op_DPipe] children: [ (SimpleCommand redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(/dev/null)} spids: [377] ) ] ) (C {(sudo)} {(mkdir)} {(-p)} {(DQ (${ VSub_Name dest_dir))}) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sudo) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr ops: [Op_DPipe] children: [ (C {(test)} {(-w)} {(DQ (${ VSub_Name dest_dir))}) (C {(echo)} {(DQ ('sudo -E'))}) ] ) ] ) left_token: <Left_CommandSub '$('> spids: [396 414] ) } spids: [395] ) ] spids: [395] ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: 16777215 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: T spids: [419] ) ] ) (SimpleCommand words: [{(${ VSub_Name sudo)} {(tee)} {(DQ (${ VSub_Name destination))}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(/dev/null)} spids: [436] ) ] ) ] negated: F ) ] spids: [297] ) spids: [291 296] ) (FuncDef name: create_cluster body: (BraceGroup children: [ (C {(echo)} {(DQ ('Creating a local cluster:'))}) (C {(echo)} {(-e)} {(-n)} {(DQ (Lit_Other '\\') ('tStarting 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 (Lit_Other '\\') ('tWaiting 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: [608] ) ] ) (C {(grep)} {(DQ (Running))}) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [584 624] ) } spids: [583] ) ] spids: [581] ) (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: [16777215 646] ) ] spids: [16777215 652] ) (C {(echo)} {(-n)} {(DQ (.))}) (C {(sleep)} {(1)}) ] spids: [578 669] ) ) (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: [460] ) spids: [456 459] ) (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: [721] ) ] spids: [717] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(wget)})]) left_token: <Left_CommandSub '$('> spids: [731 735] ) } ) ) terminator: <Op_Semi ';'> ) ] action: [(C {(wget)} {(-qO-)} {(${ VSub_Name latest_url)})] spids: [16777215 740] ) (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(curl)})]) left_token: <Left_CommandSub '$('> spids: [756 760] ) } ) ) terminator: <Op_Semi ';'> ) ] action: [(C {(curl)} {(-Ss)} {(${ VSub_Name latest_url)})] spids: [752 765] ) ] else_action: [ (C {(echo_red)} {(DQ ("Couldn't find curl or wget. Bailing out."))}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(4)}) ] spids: [777 792] ) ] spids: [714] ) spids: [710 713] ) (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: [798 800] ) } spids: [797] ) ] spids: [797] ) (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: [803 809] ) } spids: [802] ) ] spids: [802] ) (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: [813 815] ) } spids: [812] ) ] spids: [812] ) (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: [839] ) ] spids: [839] ) ] spids: [16777215 836] ) (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: [866] ) ] spids: [866] ) ] spids: [844 863] ) ] 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.'))}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)}) ] spids: [871 903] ) (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: [907 911] ) } spids: [906] ) ] spids: [906] ) (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:[935])] spids: [935] ) ] spids: [16777215 932] ) (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:[962])] spids: [962] ) ] spids: [940 959] ) (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:[989])] spids: [989] ) ] spids: [967 986] ) (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:[1016])] spids: [1016] ) ] spids: [994 1013] ) ] 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.'))}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(3)}) ] spids: [1021 1053] ) (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: [1056] ) ] spids: [1056] ) (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: F ) ] ) left_token: <Left_CommandSub '$('> spids: [1078 1096] ) } 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: [1121 1125] ) } ) ) terminator: <Op_Semi ';'> ) ] action: [(C {(run)} {(DQ ('wget ') (${ VSub_Name kubectl_url))})] spids: [16777215 1130] ) (if_arm cond: [ (Sentence child: (DBracket expr: (WordTest w: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(curl)})]) left_token: <Left_CommandSub '$('> spids: [1147 1151] ) } ) ) terminator: <Op_Semi ';'> ) ] action: [(C {(run)} {(DQ ('curl -OL ') (${ VSub_Name kubectl_url))})] spids: [1143 1156] ) ] else_action: [ (C {(echo_red)} {(DQ ("Couldn't find curl or wget. Bailing out."))}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [1169 1184] ) (C {(chmod)} {(a) (Lit_Other '+') (x)} {(kubectl)}) (C {(echo)} {(DQ )}) ] spids: [16777215 1105] ) ] else_action: [(C {(echo)} {(DQ ('Detected existing kubectl binary. Skipping download.'))})] spids: [1201 1218] ) (C {(create_cluster)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('To list the nodes in your cluster run'))}) (C {(echo_yellow)} {(DQ (Lit_Other '\\') ('tkubectl -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 (Lit_Other '\\') ('tkubectl -s http://') (${ VSub_Name KUBE_HOST) (':8080 run nginx --image=nginx --port=80') ) } ) ] )