Skip to content

Commit d7742ee

Browse files
Merge pull request openshift#7986 from barbacbd/OCPBUGS-29068
OCPBUGS-29068: GCP: Skip validation of public and private zones for terraform vars
2 parents ff82697 + 6fe5302 commit d7742ee

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

pkg/asset/cluster/tfvars/tfvars.go

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -490,23 +490,27 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
490490
preexistingnetwork := installConfig.Config.GCP.Network != ""
491491

492492
// Search the project for a dns zone with the specified base domain.
493+
// When the user has selected a custom DNS solution, the zones should be skipped.
493494
publicZoneName := ""
494-
if installConfig.Config.Publish == types.ExternalPublishingStrategy {
495-
publicZone, err := client.GetDNSZone(ctx, installConfig.Config.GCP.ProjectID, installConfig.Config.BaseDomain, true)
496-
if err != nil {
497-
return errors.Wrapf(err, "failed to get GCP public zone")
498-
}
499-
publicZoneName = publicZone.Name
500-
}
501-
502495
privateZoneName := ""
503-
if installConfig.Config.GCP.NetworkProjectID != "" {
504-
privateZone, err := client.GetDNSZone(ctx, installConfig.Config.GCP.ProjectID, installConfig.Config.ClusterDomain(), false)
505-
if err != nil {
506-
return errors.Wrapf(err, "failed to get GCP private zone")
496+
497+
if installConfig.Config.GCP.UserProvisionedDNS != gcp.UserProvisionedDNSEnabled {
498+
if installConfig.Config.Publish == types.ExternalPublishingStrategy {
499+
publicZone, err := client.GetDNSZone(ctx, installConfig.Config.GCP.ProjectID, installConfig.Config.BaseDomain, true)
500+
if err != nil {
501+
return errors.Wrapf(err, "failed to get GCP public zone")
502+
}
503+
publicZoneName = publicZone.Name
507504
}
508-
if privateZone != nil {
509-
privateZoneName = privateZone.Name
505+
506+
if installConfig.Config.GCP.NetworkProjectID != "" {
507+
privateZone, err := client.GetDNSZone(ctx, installConfig.Config.GCP.ProjectID, installConfig.Config.ClusterDomain(), false)
508+
if err != nil {
509+
return errors.Wrapf(err, "failed to get GCP private zone")
510+
}
511+
if privateZone != nil {
512+
privateZoneName = privateZone.Name
513+
}
510514
}
511515
}
512516

0 commit comments

Comments
 (0)