Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.17] OCPBUGS-42142: Skip private managed zone creation for xpn installs #9033

Open
wants to merge 1 commit into
base: release-4.17
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pkg/infrastructure/gcp/clusterapi/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"time"

"github.com/sirupsen/logrus"
"google.golang.org/api/dns/v1"
"google.golang.org/api/option"

Expand Down Expand Up @@ -148,6 +149,22 @@ func createDNSRecords(ctx context.Context, ic *installconfig.InstallConfig, clus
// createPrivateManagedZone will create a private managed zone in the GCP project specified in the install config. The
// private managed zone should only be created when one is not specified in the install config.
func createPrivateManagedZone(ctx context.Context, ic *installconfig.InstallConfig, clusterID, network string) error {
// A shared VPC install allows a user to preconfigure a private zone. If there is a private zone found, do not create a new one.
if ic.Config.GCP.NetworkProjectID != "" {
client, err := gcpic.NewClient(ctx)
if err != nil {
return err
}
privateZone, err := client.GetDNSZone(ctx, ic.Config.GCP.ProjectID, ic.Config.ClusterDomain(), false)
if err != nil {
return fmt.Errorf("failed to get GCP private zone")
}
if privateZone != nil {
logrus.Debugf("found private zone %s, skipping creation of private zone", privateZone.Name)
return nil
}
}

// TODO: use the opts for the service to restrict scopes see google.golang.org/api/option.WithScopes
ssn, err := gcpic.GetSession(ctx)
if err != nil {
Expand Down