(command.CommandList children: [ (C {(Id.KW_Set set)} {(-o)} {(errexit)}) (C {(Id.KW_Set set)} {(-o)} {(nounset)}) (C {(Id.KW_Set set)} {(-o)} {(pipefail)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:KUBE_HOST) op: assign_op.Equal rhs: { (braced_var_sub token: (Token id:Id.VSub_Name val:KUBE_HOST span_id:71) suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:{(localhost)}) ) } spids: [69] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:KUBELET_KUBECONFIG) op: assign_op.Equal rhs: { (braced_var_sub token: (Token id:Id.VSub_Name val:KUBELET_KUBECONFIG span_id:78) suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {(DQ (/var/run/kubernetes/kubelet.kubeconfig))} ) ) } spids: [76] ) ] ) (C {(declare)} {(-r)} {(Id.Lit_VarLike 'RED=') (DQ (Id.Lit_Other '\\') ('033[0;31m'))}) (C {(declare)} {(-r)} {(Id.Lit_VarLike 'GREEN=') (DQ (Id.Lit_Other '\\') ('033[0;32m'))}) (C {(declare)} {(-r)} {(Id.Lit_VarLike 'YELLOW=') (DQ (Id.Lit_Other '\\') ('033[0;33m'))}) (command.ShFunction name: echo_green body: (command.BraceGroup children: [ (command.Sentence child: (C {(echo)} {(-e)} {(DQ (${ Id.VSub_Name GREEN) ($ Id.VSub_Number '$1'))}) terminator: (Token id:Id.Op_Semi val:';' span_id:134) ) (C {(tput)} {(sgr0)}) ] ) ) (command.ShFunction name: echo_red body: (command.BraceGroup children: [ (command.Sentence child: (C {(echo)} {(-e)} {(DQ (${ Id.VSub_Name RED) ($ Id.VSub_Number '$1'))}) terminator: (Token id:Id.Op_Semi val:';' span_id:160) ) (C {(tput)} {(sgr0)}) ] ) ) (command.ShFunction name: echo_yellow body: (command.BraceGroup children: [ (command.Sentence child: (C {(echo)} {(-e)} {(DQ (${ Id.VSub_Name YELLOW) ($ Id.VSub_Number '$1'))}) terminator: (Token id:Id.Op_Semi val:';' span_id:186) ) (C {(tput)} {(sgr0)}) ] ) ) (command.ShFunction name: run body: (command.BraceGroup children: [ (C {(Id.KW_Set set)} {(Id.Lit_Other '+') (o)} {(errexit)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:output) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:215) command_list: (command.CommandList children: [ (command.Simple words: [{($ Id.VSub_Number '$1')}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'2>&' span_id:218) fd: 2 arg_word: {(1)} ) ] ) ] ) ) } spids: [214] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:exit_code) op: assign_op.Equal rhs: {($ Id.VSub_QMark '$?')} spids: [223] ) ] ) (C {(Id.KW_Set set)} {(-o)} {(errexit)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$exit_code')} {(-eq)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:245) ) ] action: [(C {(echo_green)} {(DQ (SUCCESS))})] spids: [234 247] ) ] else_action: [ (C {(echo_red)} {(DQ (FAILED))}) (command.Simple words: [{(echo)} {($ Id.VSub_DollarName '$output')}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:271) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:275) arg_word: {(1)} ) ] ) ] ) ) (command.ShFunction name: create-kubelet-kubeconfig body: (command.BraceGroup children: [ (C {(local)} {(Id.Lit_VarLike 'destination=') (DQ (${ Id.VSub_Number 2))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_z child: {(DQ (${ Id.VSub_Name destination))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:323) ) ] action: [ (C {(echo)} {(DQ ('Must provide destination path to create Kubelet kubeconfig file!'))} ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:335) arg_word: {(1)} ) ] spids: [310 325] ) ] ) (C {(echo)} {(DQ ('Creating Kubelet kubeconfig file'))}) (C {(local)} {(Id.Lit_VarLike 'dest_dir=') (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:354) command_list: (command.CommandList children: [(C {(dirname)} {(DQ (${ Id.VSub_Name destination))})] ) ) ) } ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{(mkdir)} {(-p)} {(DQ (${ Id.VSub_Name dest_dir))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_AndGreat val:'&>' span_id:376) fd: -1 arg_word: {(/dev/null)} ) ] ) (C {(sudo)} {(mkdir)} {(-p)} {(DQ (${ Id.VSub_Name dest_dir))}) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sudo) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:395) command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(test)} {(-w)} {(DQ (${ Id.VSub_Name dest_dir))}) (C {(echo)} {(DQ ('sudo -E'))}) ] ) ] ) ) } spids: [394] ) ] ) (command.Pipeline children: [ (command.Simple words: [{(cat)}] redirects: [ (redir.HereDoc op: (Token id:Id.Redir_DLess val:'<<' span_id:418) fd: -1 here_begin: {(EOF)} here_end_span_id: 451 stdin_parts: [ ('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') ] ) ] ) (command.Simple words: [{(${ Id.VSub_Name sudo)} {(tee)} {(DQ (${ Id.VSub_Name destination))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:435) fd: -1 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) (command.ShFunction name: create_cluster body: (command.BraceGroup children: [ (C {(echo)} {(DQ ('Creating a local cluster:'))}) (C {(echo)} {(-e)} {(-n)} {(DQ (Id.Lit_Other '\\') ('tStarting kubelet...'))}) (C {(create-kubelet-kubeconfig)} {(DQ (${ Id.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-') (${ Id.VSub_Name arch) (':') (${ Id.VSub_Name release) (' ') (' /hyperkube kubelet ') (' --containerized ') (' --hostname-override=') ) (127.0.0.1) (DQ (' ') (' --address=')) (0.0.0.0) (DQ (' ') (' --kubeconfig=') (${ Id.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 (Id.Lit_Other '\\') ('tWaiting for master components to start...'))} ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:573) cond: [ (command.Sentence child: (C {(true)}) terminator: (Token id:Id.Op_Semi val:';' span_id:576) ) ] body: (command.DoGroup children: [ (C {(local)} {(Id.Lit_VarLike 'running_count=') (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:584) command_list: (command.CommandList children: [ (command.Pipeline children: [ (command.Simple words: [ {(kubectl)} {(-s) (Id.Lit_Equals '=') (http) (Id.Lit_Other ':') (//) (${ Id.VSub_Name KUBE_HOST) (Id.Lit_Other ':') (8080) } {(get)} {(pods)} {(--no-headers)} {(--namespace) (Id.Lit_Equals '=') (kube-system)} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:608) fd: 2 arg_word: {(/dev/null)} ) ] ) (C {(grep)} {(DQ (Running))}) (C {(wc)} {(-l)}) ] negated: F ) ] ) ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$running_count'))} {(-ge)} {(3)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:644) ) ] action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:649) ) ] spids: [631 646] ) ] ) (C {(echo)} {(-n)} {(DQ (.))}) (C {(sleep)} {(1)}) ] ) ) (C {(echo_green)} {(DQ (SUCCESS))}) (C {(echo_green)} {(DQ ('Cluster created!'))}) (C {(echo)} {(DQ )}) (C {(kubectl)} {(-s)} {(http) (Id.Lit_Other ':') (//) (${ Id.VSub_Name KUBE_HOST) (Id.Lit_Other ':') (8080)} {(clusterinfo)} ) ] ) ) (command.ShFunction name: get_latest_version_number body: (command.BraceGroup children: [ (C {(local)} {(-r)} {(Id.Lit_VarLike 'latest_url=') (DQ ('https://storage.googleapis.com/kubernetes-release/release/stable.txt')) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.WordTest w: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:731) command_list: (command.CommandList children: [(C {(which)} {(wget)})] ) ) } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:738) ) ] action: [(C {(wget)} {(-qO-)} {(${ Id.VSub_Name latest_url)})] spids: [727 740] ) (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.WordTest w: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:756) command_list: (command.CommandList children: [(C {(which)} {(curl)})] ) ) } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:763) ) ] action: [(C {(curl)} {(-Ss)} {(${ Id.VSub_Name latest_url)})] spids: [752 765] ) ] else_action: [ (C {(echo_red)} {(DQ ("Couldn't find curl or wget. Bailing out."))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:787) arg_word: {(4)} ) ] ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:latest_release) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:798) command_list: (command.CommandList children:[(C {(get_latest_version_number)})]) ) } spids: [797] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:release) op: assign_op.Equal rhs: { (braced_var_sub token: (Token id:Id.VSub_Name val:KUBE_VERSION span_id:804) suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {(${ Id.VSub_Name latest_release)} ) ) } spids: [802] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:uname) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:813) command_list: (command.CommandList children:[(C {(uname)})]) ) } spids: [812] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ (${ Id.VSub_Name uname))} right: {(DQ (Darwin))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:834) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:platform) op: assign_op.Equal rhs: {(DQ (darwin))} spids: [839] ) ] ) ] spids: [817 836] ) (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ (${ Id.VSub_Name uname))} right: {(DQ (Linux))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:861) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:platform) op: assign_op.Equal rhs: {(DQ (linux))} spids: [866] ) ] ) ] spids: [844 863] ) ] else_action: [ (C {(echo_red)} {(DQ ('Unknown, unsupported platform: (') (${ Id.VSub_Name uname) (').'))}) (C {(echo_red)} {(DQ ('Supported platforms: Linux, Darwin.'))}) (C {(echo_red)} {(DQ ('Bailing out.'))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:899) arg_word: {(2)} ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:machine) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:907) command_list: (command.CommandList children:[(C {(uname)} {(-m)})]) ) } spids: [906] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ (${ Id.VSub_Name machine))} right: {(DQ (x86_64))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:930) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:arch) op: assign_op.Equal rhs: {(DQ (amd64))} spids: [935] ) ] ) ] spids: [913 932] ) (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ (${ Id.VSub_Name machine))} right: {(DQ (i686))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:957) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:arch) op: assign_op.Equal rhs: {(DQ (386))} spids: [962] ) ] ) ] spids: [940 959] ) (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ (${ Id.VSub_Name machine))} right: {(DQ ('arm*'))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:984) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:arch) op: assign_op.Equal rhs: {(DQ (arm))} spids: [989] ) ] ) ] spids: [967 986] ) (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ (${ Id.VSub_Name machine))} right: {(DQ ('s390x*'))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1011) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:arch) op: assign_op.Equal rhs: {(DQ (s390x))} spids: [1016] ) ] ) ] spids: [994 1013] ) ] else_action: [ (C {(echo_red)} {(DQ ('Unknown, unsupported architecture (') (${ Id.VSub_Name machine) (').'))}) (C {(echo_red)} {(DQ ('Supported architectures x86_64, i686, arm, s390x.'))}) (C {(echo_red)} {(DQ ('Bailing out.'))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1049) arg_word: {(3)} ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:kubectl_url) op: assign_op.Equal rhs: { (DQ ('https://storage.googleapis.com/kubernetes-release/release/') (${ Id.VSub_Name release) (/bin/) (${ Id.VSub_Name platform) (/) (${ Id.VSub_Name arch) (/kubectl) ) } spids: [1056] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_lt left: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1078) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(ls)} {(.)}) (C {(grep)} {(Id.Lit_Other '^') (kubectl) (Id.Lit_Other '$')}) (C {(wc)} {(-l)}) ] negated: F ) ] ) ) } right: {(1)} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1103) ) ] action: [ (C {(echo)} {(-n)} {(DQ ('Downloading kubectl binary...'))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.WordTest w: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1121) command_list: (command.CommandList children: [(C {(which)} {(wget)})] ) ) } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1128) ) ] action: [(C {(run)} {(DQ ('wget ') (${ Id.VSub_Name kubectl_url))})] spids: [1117 1130] ) (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.WordTest w: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1147) command_list: (command.CommandList children: [(C {(which)} {(curl)})] ) ) } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1154) ) ] action: [(C {(run)} {(DQ ('curl -OL ') (${ Id.VSub_Name kubectl_url))})] spids: [1143 1156] ) ] else_action: [ (C {(echo_red)} {(DQ ("Couldn't find curl or wget. Bailing out."))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1179) arg_word: {(1)} ) ] ) (C {(chmod)} {(a) (Id.Lit_Other '+') (x)} {(kubectl)}) (C {(echo)} {(DQ )}) ] spids: [1074 1105] ) ] else_action: [(C {(echo)} {(DQ ('Detected existing kubectl binary. Skipping download.'))})] ) (C {(create_cluster)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('To list the nodes in your cluster run'))}) (C {(echo_yellow)} { (DQ (Id.Lit_Other '\\') ('tkubectl -s=http://') (${ Id.VSub_Name KUBE_HOST) (':8080 get nodes')) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('To run your first pod run'))}) (C {(echo_yellow)} { (DQ (Id.Lit_Other '\\') ('tkubectl -s http://') (${ Id.VSub_Name KUBE_HOST) (':8080 run nginx --image=nginx --port=80') ) } ) ] )