GCE: Don't create utility subnets in private topology

We don't need them on GCE, and in fact we don't support them with IP Alias.
This commit is contained in:
justinsb 2021-09-19 19:09:17 -04:00
parent 8b9f4ec41c
commit 16fc5e8cec
2 changed files with 26 additions and 20 deletions

View File

@ -52,9 +52,6 @@ spec:
- name: us-test1
region: us-test1
type: Private
- name: utility-us-test1
region: us-test1
type: Utility
topology:
bastion:
bastionPublicName: bastion.private.example.com

View File

@ -980,8 +980,6 @@ func setupTopology(opt *NewClusterOptions, cluster *api.Cluster, allZones sets.S
cluster.Spec.Subnets[i].Type = api.SubnetTypePrivate
}
var utilitySubnets []api.ClusterSubnetSpec
var zoneToSubnetProviderID map[string]string
var err error
if len(opt.Zones) > 0 && len(opt.UtilitySubnetIDs) > 0 {
@ -1001,6 +999,16 @@ func setupTopology(opt *NewClusterOptions, cluster *api.Cluster, allZones sets.S
}
}
addUtilitySubnets := true
switch api.CloudProviderID(cluster.Spec.CloudProvider) {
case api.CloudProviderGCE:
// GCE does not need utility subnets
addUtilitySubnets = false
}
if addUtilitySubnets {
var utilitySubnets []api.ClusterSubnetSpec
for _, s := range cluster.Spec.Subnets {
if s.Type == api.SubnetTypeUtility {
continue
@ -1017,6 +1025,7 @@ func setupTopology(opt *NewClusterOptions, cluster *api.Cluster, allZones sets.S
utilitySubnets = append(utilitySubnets, subnet)
}
cluster.Spec.Subnets = append(cluster.Spec.Subnets, utilitySubnets...)
}
if opt.Bastion {
bastionGroup := &api.InstanceGroup{}