File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
python-clusters/create-gke-cluster Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 6464 {
6565 "name" : " podIpRange" ,
6666 "label" : " Pod IP range" ,
67- "description" : " Use CIDR block/mask notation, e.g. 10.0.0.0/21 or /21" ,
67+ "description" : " Range name or CIDR block/mask notation, e.g. 10.0.0.0/21 or /21" ,
6868 "type" : " STRING" ,
6969 "mandatory" : false ,
7070 "visibilityCondition" : " model.isVpcNative"
7171 },
7272 {
7373 "name" : " svcIpRange" ,
7474 "label" : " Service IP range" ,
75- "description" : " Use CIDR block/mask notation, e.g. 10.0.0.0/24 or /24. MUST be different from pod IP range." ,
75+ "description" : " Range name or CIDR block/mask notation, e.g. 10.0.0.0/24 or /24. MUST be different from pod IP range." ,
7676 "type" : " STRING" ,
7777 "mandatory" : false ,
7878 "visibilityCondition" : " model.isVpcNative"
Original file line number Diff line number Diff line change @@ -260,10 +260,18 @@ def build(self):
260260 if self .is_vpc_native :
261261 ip_allocation_policy = {
262262 "createSubnetwork" : False ,
263- "useIpAliases" : True ,
264- "servicesIpv4CidrBlock" : cluster_svc_ip_range ,
265- "clusterIpv4CidrBlock" : cluster_pod_ip_range ,
263+ "useIpAliases" : True
266264 }
265+ if re .match ('[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+' , cluster_svc_ip_range ):
266+ ip_allocation_policy ["servicesIpv4CidrBlock" ] = cluster_svc_ip_range
267+ elif cluster_svc_ip_range is not None and len (cluster_svc_ip_range ) > 0 :
268+ # assume it's an existing range name (shared VPC case)
269+ ip_allocation_policy ["servicesSecondaryRangeName" ] = cluster_svc_ip_range
270+ if re .match ('[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+' , cluster_pod_ip_range ):
271+ ip_allocation_policy ["clusterIpv4CidrBlock" ] = cluster_pod_ip_range
272+ elif cluster_pod_ip_range is not None and len (cluster_pod_ip_range ) > 0 :
273+ # assume it's an existing range name (shared VPC case)
274+ ip_allocation_policy ["clusterSecondaryRangeName" ] = cluster_pod_ip_range
267275 create_cluster_request_body ["cluster" ]["ipAllocationPolicy" ] = ip_allocation_policy
268276
269277 if self .legacy_auth :
You can’t perform that action at this time.
0 commit comments