Skip to content

Commit

Permalink
OCPBUGS-29068: GCP: Skip validation of public and private zones for t…
Browse files Browse the repository at this point in the history
…erraform 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.
  • Loading branch information
barbacbd committed Feb 7, 2024
1 parent 9376c2f commit 6fe5302
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions pkg/asset/cluster/tfvars/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 6fe5302

Please sign in to comment.