@@ -137,32 +137,35 @@ func GenerateClusterAssets(installConfig *installconfig.InstallConfig, clusterID
137137// only use zones if both the compute and control plane node availability zones exist.
138138func findFailureDomains (installConfig * installconfig.InstallConfig ) []string {
139139 zones := sets .New [string ]()
140- defaultMachinePlatformDefined := false
141- if gcpPlatform := installConfig .Config .Platform .GCP ; gcpPlatform != nil && gcpPlatform .DefaultMachinePlatform != nil {
142- defaultMachinePlatformDefined = true
143- for _ , zone := range gcpPlatform .DefaultMachinePlatform .Zones {
140+
141+ var controlPlaneZones , computeZones []string
142+ if installConfig .Config .ControlPlane .Platform .GCP != nil {
143+ controlPlaneZones = installConfig .Config .ControlPlane .Platform .GCP .Zones
144+ }
145+
146+ if installConfig .Config .Compute [0 ].Platform .GCP != nil {
147+ computeZones = installConfig .Config .Compute [0 ].Platform .GCP .Zones
148+ }
149+
150+ def := installConfig .Config .GCP .DefaultMachinePlatform
151+ if def != nil && len (def .Zones ) > 0 {
152+ for _ , zone := range def .Zones {
153+ zones .Insert (zone )
154+ }
155+
156+ for _ , zone := range controlPlaneZones {
144157 zones .Insert (zone )
145158 }
146159
147- if installConfig .Config .ControlPlane .Platform .GCP != nil {
148- for _ , zone := range installConfig .Config .ControlPlane .Platform .GCP .Zones {
149- zones .Insert (zone )
150- }
160+ for _ , zone := range computeZones {
161+ zones .Insert (zone )
151162 }
152- if installConfig .Config .Compute [0 ].Platform .GCP != nil {
153- for _ , zone := range installConfig .Config .Compute [0 ].Platform .GCP .Zones {
154- zones .Insert (zone )
155- }
163+ } else if len (controlPlaneZones ) > 0 && len (computeZones ) > 0 {
164+ for _ , zone := range controlPlaneZones {
165+ zones .Insert (zone )
156166 }
157- }
158- if ! defaultMachinePlatformDefined {
159- if installConfig .Config .ControlPlane .Platform .GCP != nil && installConfig .Config .Compute [0 ].Platform .GCP != nil {
160- for _ , zone := range installConfig .Config .ControlPlane .Platform .GCP .Zones {
161- zones .Insert (zone )
162- }
163- for _ , zone := range installConfig .Config .Compute [0 ].Platform .GCP .Zones {
164- zones .Insert (zone )
165- }
167+ for _ , zone := range computeZones {
168+ zones .Insert (zone )
166169 }
167170 }
168171
0 commit comments