Skip to content

Commit

Permalink
Merge pull request #866 from gcs278/gcp-dns-record-mismatching
Browse files Browse the repository at this point in the history
OCPBUGS-4759: Do not manage DNS for an ingresscontroller with domain mismatch in GCP
  • Loading branch information
openshift-merge-robot committed Jan 13, 2023
2 parents dc49def + cb8d9bb commit fc69408
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/operator/controller/ingress/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
27 changes: 24 additions & 3 deletions pkg/operator/controller/ingress/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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",
Expand Down

0 comments on commit fc69408

Please sign in to comment.