From 3b57efee70722e0208e31d77ce7f167d21e519f6 Mon Sep 17 00:00:00 2001 From: Ankur Singh <49074231+sankur-codes@users.noreply.github.com> Date: Mon, 16 Feb 2026 15:24:45 +0530 Subject: [PATCH] Default clusterhosted on gcp --- pkg/asset/manifests/infrastructure.go | 12 ++++++------ pkg/asset/manifests/infrastructure_test.go | 2 +- pkg/types/gcp/defaults/platform.go | 9 ++++++++- pkg/types/gcp/platform.go | 4 ++-- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/pkg/asset/manifests/infrastructure.go b/pkg/asset/manifests/infrastructure.go index 5717d9efa06..378dd72570f 100644 --- a/pkg/asset/manifests/infrastructure.go +++ b/pkg/asset/manifests/infrastructure.go @@ -215,14 +215,14 @@ func (i *Infrastructure) Generate(ctx context.Context, dependencies asset.Parent config.Status.PlatformStatus.GCP.ResourceTags = resourceTags } - // If the user has requested the use of a DNS provisioned by them, then OpenShift needs to - // start an in-cluster DNS for the installation to succeed. The user can then configure their - // DNS post-install. + // GCP defaults to ClusterHosted DNS, where the user provides their own DNS solution + // post-install. The installer starts an in-cluster DNS for the installation to succeed. + // If the user has explicitly disabled UserProvisionedDNS, use PlatformDefault instead. config.Status.PlatformStatus.GCP.CloudLoadBalancerConfig = &configv1.CloudLoadBalancerConfig{ - DNSType: configv1.PlatformDefaultDNSType, + DNSType: configv1.ClusterHostedDNSType, } - if installConfig.Config.GCP.UserProvisionedDNS == dns.UserProvisionedDNSEnabled { - config.Status.PlatformStatus.GCP.CloudLoadBalancerConfig.DNSType = configv1.ClusterHostedDNSType + if installConfig.Config.GCP.UserProvisionedDNS == dns.UserProvisionedDNSDisabled { + config.Status.PlatformStatus.GCP.CloudLoadBalancerConfig.DNSType = configv1.PlatformDefaultDNSType } case ibmcloud.Name: config.Spec.PlatformSpec.Type = configv1.IBMCloudPlatformType diff --git a/pkg/asset/manifests/infrastructure_test.go b/pkg/asset/manifests/infrastructure_test.go index a98b65e33af..a32220261ac 100644 --- a/pkg/asset/manifests/infrastructure_test.go +++ b/pkg/asset/manifests/infrastructure_test.go @@ -72,7 +72,7 @@ func TestGenerateInfrastructure(t *testing.T) { installConfig: icBuild.build(icBuild.forGCP()), expectedInfrastructure: infraBuild.build( infraBuild.forPlatform(configv1.GCPPlatformType), - infraBuild.withGCPClusterHostedDNS("Disabled"), + infraBuild.withGCPClusterHostedDNS("Enabled"), ), expectedFilesGenerated: 2, }, { diff --git a/pkg/types/gcp/defaults/platform.go b/pkg/types/gcp/defaults/platform.go index dfe85e81e5c..ee868bcb39b 100644 --- a/pkg/types/gcp/defaults/platform.go +++ b/pkg/types/gcp/defaults/platform.go @@ -1,6 +1,9 @@ package defaults -import "github.com/openshift/installer/pkg/types/gcp" +import ( + "github.com/openshift/installer/pkg/types/dns" + "github.com/openshift/installer/pkg/types/gcp" +) // SetPlatformDefaults sets the defaults for the platform. func SetPlatformDefaults(p *gcp.Platform) { @@ -8,6 +11,10 @@ func SetPlatformDefaults(p *gcp.Platform) { return } + if p.UserProvisionedDNS == "" { + p.UserProvisionedDNS = dns.UserProvisionedDNSEnabled + } + if gcpDmp := p.DefaultMachinePlatform; gcpDmp != nil { if ek := gcpDmp.EncryptionKey; ek != nil { if kms := ek.KMSKey; kms != nil { diff --git a/pkg/types/gcp/platform.go b/pkg/types/gcp/platform.go index 7fbb9ca53cc..6f0128b65e5 100644 --- a/pkg/types/gcp/platform.go +++ b/pkg/types/gcp/platform.go @@ -102,8 +102,8 @@ type Platform struct { // UserProvisionedDNS indicates if the customer is providing their own DNS solution in place of the default // provisioned by the Installer. - // +kubebuilder:default:="Disabled" - // +default="Disabled" + // +kubebuilder:default:="Enabled" + // +default="Enabled" // +kubebuilder:validation:Enum="Enabled";"Disabled" UserProvisionedDNS dns.UserProvisionedDNS `json:"userProvisionedDNS,omitempty"`