#!/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. # Vars assumed: # NUM_NODES proc get-master-size { var suggested_master_size = '1' if [[ "${NUM_NODES}" -gt "5" ]] { suggested_master_size := '2' } if [[ "${NUM_NODES}" -gt "10" ]] { suggested_master_size := '4' } if [[ "${NUM_NODES}" -gt "100" ]] { suggested_master_size := '8' } if [[ "${NUM_NODES}" -gt "250" ]] { suggested_master_size := '16' } if [[ "${NUM_NODES}" -gt "500" ]] { suggested_master_size := '32' } if [[ "${NUM_NODES}" -gt "3000" ]] { suggested_master_size := '64' } echo $(suggested_master_size) } # Vars assumed: # NUM_NODES proc get-master-root-disk-size { var suggested_master_root_disk_size = '"20GB'" if [[ "${NUM_NODES}" -gt "1000" ]] { suggested_master_root_disk_size := '"50GB'" } if [[ "${NUM_NODES}" -gt "2000" ]] { suggested_master_root_disk_size := '"100GB'" } echo $(suggested_master_root_disk_size) } # Vars assumed: # NUM_NODES proc get-master-disk-size { var suggested_master_disk_size = '"20GB'" if [[ "${NUM_NODES}" -gt "1000" ]] { suggested_master_disk_size := '"100GB'" } if [[ "${NUM_NODES}" -gt "2000" ]] { suggested_master_disk_size := '"200GB'" } echo $(suggested_master_disk_size) } proc get-node-ip-range { if [[ -n "${NODE_IP_RANGE:-}" ]] { >&2 echo "Using user provided NODE_IP_RANGE: $(NODE_IP_RANGE)> !2 echo "Using user provided NODE_IP_RANGE: ${NODE_IP_RANGE}" echo $(NODE_IP_RANGE) return } var suggested_range = '"10.40.0.0/22'" if [[ "${NUM_NODES}" -gt 1000 ]] { suggested_range := '"10.40.0.0/21'" } if [[ "${NUM_NODES}" -gt 2000 ]] { suggested_range := '"10.40.0.0/20'" } if [[ "${NUM_NODES}" -gt 4000 ]] { suggested_range := '"10.40.0.0/19'" } echo $(suggested_range) } proc get-cluster-ip-range { var suggested_range = '"10.64.0.0/14'" if [[ "${NUM_NODES}" -gt 1000 ]] { suggested_range := '"10.64.0.0/13'" } if [[ "${NUM_NODES}" -gt 2000 ]] { suggested_range := '"10.64.0.0/12'" } if [[ "${NUM_NODES}" -gt 4000 ]] { suggested_range := '"10.64.0.0/11'" } echo $(suggested_range) } if [[ "${FEDERATION:-}" == true ]] { global NODE_SCOPES := $(NODE_SCOPES:-monitoring,logging-write,storage-ro,https://www.googleapis.com/auth/ndev.clouddns.readwrite) } else { global NODE_SCOPES := $(NODE_SCOPES:-monitoring,logging-write,storage-ro) } (CommandList children: [ (FuncDef name: get-master-size body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:suggested_master_size) op: Equal rhs: {(1)} spids: [59] ) ] spids: [57] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(DQ (5))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_master_size) op: Equal rhs: {(2)} spids: [85] ) ] spids: [85] ) ] spids: [-1 82] ) ] spids: [-1 89] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(DQ (10))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_master_size) op: Equal rhs: {(4)} spids: [114] ) ] spids: [114] ) ] spids: [-1 111] ) ] spids: [-1 118] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(DQ (100))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_master_size) op: Equal rhs: {(8)} spids: [143] ) ] spids: [143] ) ] spids: [-1 140] ) ] spids: [-1 147] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(DQ (250))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_master_size) op: Equal rhs: {(16)} spids: [172] ) ] spids: [172] ) ] spids: [-1 169] ) ] spids: [-1 176] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(DQ (500))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_master_size) op: Equal rhs: {(32)} spids: [201] ) ] spids: [201] ) ] spids: [-1 198] ) ] spids: [-1 205] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(DQ (3000))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_master_size) op: Equal rhs: {(64)} spids: [230] ) ] spids: [230] ) ] spids: [-1 227] ) ] spids: [-1 234] ) (C {(echo)} {(DQ (${ VSub_Name suggested_master_size))}) ] spids: [54] ) spids: [50 53] ) (FuncDef name: get-master-root-disk-size body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:suggested_master_root_disk_size) op: Equal rhs: {(DQ (20GB))} spids: [265] ) ] spids: [263] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(DQ (1000))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_master_root_disk_size) op: Equal rhs: {(DQ (50GB))} spids: [293] ) ] spids: [293] ) ] spids: [-1 290] ) ] spids: [-1 299] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(DQ (2000))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_master_root_disk_size) op: Equal rhs: {(DQ (100GB))} spids: [324] ) ] spids: [324] ) ] spids: [-1 321] ) ] spids: [-1 330] ) (C {(echo)} {(DQ (${ VSub_Name suggested_master_root_disk_size))}) ] spids: [260] ) spids: [254 259] ) (FuncDef name: get-master-disk-size body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:suggested_master_disk_size) op: Equal rhs: {(DQ (20GB))} spids: [361] ) ] spids: [359] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(DQ (1000))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_master_disk_size) op: Equal rhs: {(DQ (100GB))} spids: [389] ) ] spids: [389] ) ] spids: [-1 386] ) ] spids: [-1 395] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(DQ (2000))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_master_disk_size) op: Equal rhs: {(DQ (200GB))} spids: [420] ) ] spids: [420] ) ] spids: [-1 417] ) ] spids: [-1 426] ) (C {(echo)} {(DQ (${ VSub_Name suggested_master_disk_size))}) ] spids: [356] ) spids: [350 355] ) (FuncDef name: get-node-ip-range body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_n child: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [454 457] ) ) } ) ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {(DQ ("Using user provided NODE_IP_RANGE: ") (${ VSub_Name NODE_IP_RANGE))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[466])] ) (C {(echo)} {(DQ (${ VSub_Name NODE_IP_RANGE))}) (ControlFlow token:) ] spids: [-1 463] ) ] spids: [-1 491] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:suggested_range) op: Equal rhs: {(DQ (10.40.0.0/22))} spids: [496] ) ] spids: [494] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(1000)} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_range) op: Equal rhs: {(DQ (10.40.0.0/21))} spids: [522] ) ] spids: [522] ) ] spids: [-1 519] ) ] spids: [-1 528] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(2000)} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_range) op: Equal rhs: {(DQ (10.40.0.0/20))} spids: [551] ) ] spids: [551] ) ] spids: [-1 548] ) ] spids: [-1 557] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(4000)} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_range) op: Equal rhs: {(DQ (10.40.0.0/19))} spids: [580] ) ] spids: [580] ) ] spids: [-1 577] ) ] spids: [-1 586] ) (C {(echo)} {(DQ (${ VSub_Name suggested_range))}) ] spids: [444] ) spids: [440 443] ) (FuncDef name: get-cluster-ip-range body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:suggested_range) op: Equal rhs: {(DQ (10.64.0.0/14))} spids: [609] ) ] spids: [607] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(1000)} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_range) op: Equal rhs: {(DQ (10.64.0.0/13))} spids: [635] ) ] spids: [635] ) ] spids: [-1 632] ) ] spids: [-1 641] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(2000)} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_range) op: Equal rhs: {(DQ (10.64.0.0/12))} spids: [664] ) ] spids: [664] ) ] spids: [-1 661] ) ] spids: [-1 670] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {(DQ (${ VSub_Name NUM_NODES))} right: {(4000)} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:suggested_range) op: Equal rhs: {(DQ (10.64.0.0/11))} spids: [693] ) ] spids: [693] ) ] spids: [-1 690] ) ] spids: [-1 699] ) (C {(echo)} {(DQ (${ VSub_Name suggested_range))}) ] spids: [604] ) spids: [600 603] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [719 722] ) ) } right: {(true)} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NODE_SCOPES) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {("monitoring,logging-write,storage-ro,https:") (Lit_Slash /) (Lit_Slash /) (www.googleapis.com) (Lit_Slash /) (auth) (Lit_Slash /) (ndev.clouddns.readwrite) } ) spids: [737 748] ) ) } spids: [735] ) ] spids: [735] ) ] spids: [-1 732] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NODE_SCOPES) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {("monitoring,logging-write,storage-ro")} ) spids: [756 760] ) ) } spids: [754] ) ] spids: [754] ) ] spids: [751 763] ) ] )