From 6fe53023af4cbc2ae759f8a8ff4cb30cdf8f1729 Mon Sep 17 00:00:00 2001 From: Brent Barbachem Date: Tue, 6 Feb 2024 15:33:40 -0500 Subject: [PATCH] OCPBUGS-29068: GCP: Skip validation of public and private zones for terraform vars ** During the GCP installation with custom dns configuration enabled, the private and public zones should not be validated (skip them), so that there are not errors when they cannot be found. --- pkg/asset/cluster/tfvars/tfvars.go | 32 +++++++++++++++++------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/pkg/asset/cluster/tfvars/tfvars.go b/pkg/asset/cluster/tfvars/tfvars.go index c500ef766f0..370b0e0e896 100644 --- a/pkg/asset/cluster/tfvars/tfvars.go +++ b/pkg/asset/cluster/tfvars/tfvars.go @@ -490,23 +490,27 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error { preexistingnetwork := installConfig.Config.GCP.Network != "" // Search the project for a dns zone with the specified base domain. + // When the user has selected a custom DNS solution, the zones should be skipped. publicZoneName := "" - if installConfig.Config.Publish == types.ExternalPublishingStrategy { - publicZone, err := client.GetDNSZone(ctx, installConfig.Config.GCP.ProjectID, installConfig.Config.BaseDomain, true) - if err != nil { - return errors.Wrapf(err, "failed to get GCP public zone") - } - publicZoneName = publicZone.Name - } - privateZoneName := "" - if installConfig.Config.GCP.NetworkProjectID != "" { - privateZone, err := client.GetDNSZone(ctx, installConfig.Config.GCP.ProjectID, installConfig.Config.ClusterDomain(), false) - if err != nil { - return errors.Wrapf(err, "failed to get GCP private zone") + + if installConfig.Config.GCP.UserProvisionedDNS != gcp.UserProvisionedDNSEnabled { + if installConfig.Config.Publish == types.ExternalPublishingStrategy { + publicZone, err := client.GetDNSZone(ctx, installConfig.Config.GCP.ProjectID, installConfig.Config.BaseDomain, true) + if err != nil { + return errors.Wrapf(err, "failed to get GCP public zone") + } + publicZoneName = publicZone.Name } - if privateZone != nil { - privateZoneName = privateZone.Name + + if installConfig.Config.GCP.NetworkProjectID != "" { + privateZone, err := client.GetDNSZone(ctx, installConfig.Config.GCP.ProjectID, installConfig.Config.ClusterDomain(), false) + if err != nil { + return errors.Wrapf(err, "failed to get GCP private zone") + } + if privateZone != nil { + privateZoneName = privateZone.Name + } } }