diff --git a/pkg/operator/controller/ingress/dns.go b/pkg/operator/controller/ingress/dns.go index fccefe592..5494b96b1 100644 --- a/pkg/operator/controller/ingress/dns.go +++ b/pkg/operator/controller/ingress/dns.go @@ -200,7 +200,7 @@ func dnsRecordChanged(current, expected *iov1.DNSRecord) (bool, *iov1.DNSRecord) } // manageDNSForDomain returns true if the given domain contains the baseDomain -// of the cluster DNS config. It is only used for AWS in the beginning, and will be expanded to other clouds +// of the cluster DNS config. It is only used for AWS and GCP in the beginning, and will be expanded to other clouds // once we know there are no users depending on this. // See https://bugzilla.redhat.com/show_bug.cgi?id=2041616 func manageDNSForDomain(domain string, status *configv1.PlatformStatus, dnsConfig *configv1.DNS) bool { @@ -210,7 +210,7 @@ func manageDNSForDomain(domain string, status *configv1.PlatformStatus, dnsConfi mustContain := "." + dnsConfig.Spec.BaseDomain switch status.Type { - case configv1.AWSPlatformType: + case configv1.AWSPlatformType, configv1.GCPPlatformType: return strings.HasSuffix(domain, mustContain) default: return true diff --git a/pkg/operator/controller/ingress/dns_test.go b/pkg/operator/controller/ingress/dns_test.go index 1983bd03d..76f6a7451 100644 --- a/pkg/operator/controller/ingress/dns_test.go +++ b/pkg/operator/controller/ingress/dns_test.go @@ -168,14 +168,14 @@ func TestManageDNSForDomain(t *testing.T) { expected: false, }, { - name: "domain matches the baseDomain", + name: "domain matches the baseDomain on AWS", domain: "apps.openshift.example.com", baseDomain: "openshift.example.com", platformType: configv1.AWSPlatformType, expected: true, }, { - name: "domain matches single segment baseDomain", + name: "domain matches single segment baseDomain on AWS", domain: "openshift.example.com", baseDomain: "example.com", platformType: configv1.AWSPlatformType, @@ -189,12 +189,33 @@ func TestManageDNSForDomain(t *testing.T) { expected: false, }, { - name: "domain does not match prematurely", + name: "domain does not match prematurely on AWS", domain: "testopenshift.example.com", baseDomain: "openshift.example.com", platformType: configv1.AWSPlatformType, expected: false, }, + { + name: "domain matches the baseDomain on GCP", + domain: "apps.openshift.example.com", + baseDomain: "openshift.example.com", + platformType: configv1.GCPPlatformType, + expected: true, + }, + { + name: "domain does not match the baseDomain on GCP", + domain: "test.local", + baseDomain: "openshift.example.com", + platformType: configv1.GCPPlatformType, + expected: false, + }, + { + name: "domain does not match prematurely on GCP", + domain: "testopenshift.example.com", + baseDomain: "openshift.example.com", + platformType: configv1.GCPPlatformType, + expected: false, + }, { name: "domain does not match the baseDomain on unsupported platform", domain: "test.local",