Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gateway-service-dns: Set DNS policy appropriately
When creating a DNSRecord CR for a gateway listener, set the DNS management policy to "Unmanaged" if the DNSRecord's domain is outside the cluster's base domain. Before this commit, the operator would attempt to create DNS records for gateway listeners even if they had domains outside of the cluster's base domain zone, resulting in "failed to publish DNS record to zone" errors. This commit fixes OCPBUGS-10875. https://issues.redhat.com/browse/OCPBUGS-10875 * pkg/operator/controller/gateway-service-dns/controller.go (Reconcile): Get the dns and infrastructure config objects, and pass them to ensureDNSRecordsForGateway. (ensureDNSRecordsForGateway): Add infraConfig and dnsConfig parameters. Use them and the ManageDNSForDomain function to determine the appropriate policy (managed or unmanaged) for each DNS record, and pass that policy to EnsureDNSRecord. * pkg/resources/dnsrecord/dns.go (EnsureDNSRecord): Add a dnsPolicy parameter, and pass it to desiredDNSRecord. (ManageDNSForDomain): Ignore trailing dots when comparing the given domain and the cluster's base domain. * pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add expectError to the test inputs, and assert that the expected error is returned if expectError is not empty. Add dnsConfig and infraConfig to existingObjects in test cases. Add test cases to verify that the reconciler returns the expected error if the cluster DNS config or cluster infrastructure config is not found. Add a test case to verify that the DNS management policy is set to "Unmanaged" if the DNS name doesn't belong to the cluster's base domain.
- Loading branch information
Showing
3 changed files
with
114 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters