#!/bin/bash # Copyright 2016 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # A library of helper functions and constant for the Container Linux distro. source "$(KUBE_ROOT)/cluster/gce/container-linux/helper.sh" proc get-node-instance-metadata { var metadata = ''"" metadata := ""kube-env=$(KUBE_TEMP)/node-kube-env.yaml,"" metadata := ""user-data=$(KUBE_ROOT)/cluster/gce/container-linux/node.yaml,"" metadata := ""configure-sh=$(KUBE_ROOT)/cluster/gce/container-linux/configure.sh,"" metadata := ""cluster-name=$(KUBE_TEMP)/cluster-name.txt"" echo $(metadata) } # $1: template name (required). proc create-node-instance-template { var template_name = $1 create-node-template $template_name $(scope_flags[*]) $[get-node-instance-metadata] # TODO(euank): We should include update-strategy here. We should also switch to ignition } (CommandList children: [ (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/gce/container-linux/helper.sh))}) (FuncDef name: get-node-instance-metadata body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:metadata) op:Equal rhs:{(DQ )} spids:[66])] spids: [64] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: PlusEqual rhs: {(DQ ("kube-env=") (${ VSub_Name KUBE_TEMP) ("/node-kube-env.yaml,"))} spids: [71] ) ] spids: [71] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: PlusEqual rhs: { (DQ ("user-data=") (${ VSub_Name KUBE_ROOT) ("/cluster/gce/container-linux/node.yaml,") ) } spids: [81] ) ] spids: [81] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: PlusEqual rhs: { (DQ ("configure-sh=") (${ VSub_Name KUBE_ROOT) ("/cluster/gce/container-linux/configure.sh,") ) } spids: [91] ) ] spids: [91] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:metadata) op: PlusEqual rhs: {(DQ ("cluster-name=") (${ VSub_Name KUBE_TEMP) (/cluster-name.txt))} spids: [101] ) ] spids: [101] ) (C {(echo)} {(DQ (${ VSub_Name metadata))}) ] spids: [61] ) spids: [57 60] ) (FuncDef name: create-node-instance-template body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:template_name) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [134] ) ] spids: [132] ) (C {(create-node-template)} {(DQ ($ VSub_Name "$template_name"))} { (DQ (BracedVarSub token: bracket_op: (WholeArray op_id:Arith_Star) spids: [148 153] ) ) } { (DQ (CommandSubPart command_list: (CommandList children:[(C {(get-node-instance-metadata)})]) left_token: spids: [157 159] ) ) } ) ] spids: [129] ) spids: [125 128] ) ] )