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

OCPBUGS-10875: gateway-service-dns: Set DNS policy appropriately #934

Conversation

Miciah
Copy link
Contributor

@Miciah Miciah commented May 19, 2023

gateway-service-dns: Add test coverage for deletes

  • pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add labels to DNS records so that deleteStaleDNSRecordsForGateway doesn't filter them out. Verify that objects that are expected to be deleted are indeed deleted. Add a test case to verify that deletion works properly.
    (fakeClientRecorder): Add "deleted" field.
    (Create, Delete, Update): Log actions.
    (Delete): Record deleted objects.

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 change, 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.

  • 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/resources/dnsrecord/dns_test.go (TestManageDNSForDomain): Add test cases for empty base domain and for various combinations of trailing dots on the domain or base domain.
  • pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add dnsConfig and infraConfig to existingObjects in test cases. 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.

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 19, 2023
@openshift-ci-robot
Copy link
Contributor

@Miciah: This pull request references Jira Issue OCPBUGS-10875, which is invalid:

  • expected the bug to target the "4.14.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

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 change, 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.

  • 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.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Miciah
Copy link
Contributor Author

Miciah commented May 19, 2023

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 19, 2023
@openshift-ci-robot
Copy link
Contributor

@Miciah: This pull request references Jira Issue OCPBUGS-10875, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.14.0) matches configured target version for branch (4.14.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @lihongan

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot requested a review from lihongan May 19, 2023 00:16
@Miciah Miciah force-pushed the OCPBUGS-10875-gateway-service-dns-set-DNS-policy-appropriately branch from 26ca122 to c5b6502 Compare May 19, 2023 18:19
@openshift-ci-robot
Copy link
Contributor

@Miciah: This pull request references Jira Issue OCPBUGS-10875, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.14.0) matches configured target version for branch (4.14.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @lihongan

In response to this:

gateway-service-dns: Add test coverage for deletes

  • pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add labels to DNS records so that deleteStaleDNSRecordsForGateway doesn't filter them out. Verify that objects that are expected to be deleted are indeed deleted. Add a test case to verify that deletion works properly.
    (fakeClientRecorder): Add "deleted" field.
    (Create, Delete, Update): Log actions.
    (Delete): Record deleted objects.

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 change, 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.

  • 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.
  • pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add dnsConfig and infraConfig to existingObjects in test cases. 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.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@candita
Copy link
Contributor

candita commented Jun 14, 2023

/retest-required

@candita
Copy link
Contributor

candita commented Jun 21, 2023

/assign @gcs278

},
expectUpdate: []client.Object{},
expectDelete: []client.Object{},
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth adding 2 simple test cases: one for dnsConfig is null and another for infraConfig is null and nothing should be created?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Miciah Miciah marked this pull request as draft June 29, 2023 00:26
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 29, 2023
@Miciah Miciah force-pushed the OCPBUGS-10875-gateway-service-dns-set-DNS-policy-appropriately branch from c5b6502 to 8b20178 Compare June 29, 2023 01:08
@Miciah Miciah force-pushed the OCPBUGS-10875-gateway-service-dns-set-DNS-policy-appropriately branch from 8b20178 to 038190e Compare June 29, 2023 01:16
@Miciah
Copy link
Contributor Author

Miciah commented Jun 29, 2023

@Miciah Miciah force-pushed the OCPBUGS-10875-gateway-service-dns-set-DNS-policy-appropriately branch from 038190e to 0eb49fb Compare June 29, 2023 01:18
@Miciah
Copy link
Contributor Author

Miciah commented Jun 29, 2023

I'll rebase again once #949 (comment) is resolved.

* pkg/operator/controller/gateway-service-dns/controller_test.go
(Test_Reconcile): Add labels to DNS records so that
deleteStaleDNSRecordsForGateway doesn't filter them out.  Verify that
objects that are expected to be deleted are indeed deleted.  Add a test
case to verify that deletion works properly.
(fakeClientRecorder): Add "deleted" field.
(Create, Delete, Update): Log actions.
(Delete): Record deleted objects.
@Miciah Miciah force-pushed the OCPBUGS-10875-gateway-service-dns-set-DNS-policy-appropriately branch from 0eb49fb to 26492db Compare June 29, 2023 23:47
@openshift-ci openshift-ci bot requested review from knobunc and rfredette June 29, 2023 23:49
@@ -229,11 +229,20 @@ func dnsRecordChanged(current, expected *iov1.DNSRecord) (bool, *iov1.DNSRecord)
// 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 {
if len(domain) == 0 {
if len(domain) == 0 || len(dnsConfig.Spec.BaseDomain) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we unit test this new change? BaseDomain = ""?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return false
}

mustContain := "." + dnsConfig.Spec.BaseDomain

// Ignore any trailing dot for comparison.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we unit test comparison of domains and base domains that end with .?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Miciah Miciah force-pushed the OCPBUGS-10875-gateway-service-dns-set-DNS-policy-appropriately branch from 26492db to 7a32d62 Compare July 18, 2023 19:25
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/resources/dnsrecord/dns_test.go (TestManageDNSForDomain): Add test
cases for empty base domain and for various combinations of trailing dots
on the domain or 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.
@Miciah Miciah force-pushed the OCPBUGS-10875-gateway-service-dns-set-DNS-policy-appropriately branch from 7a32d62 to 620c930 Compare July 18, 2023 19:26
@openshift-ci-robot
Copy link
Contributor

@Miciah: This pull request references Jira Issue OCPBUGS-10875, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.14.0) matches configured target version for branch (4.14.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @lihongan

In response to this:

gateway-service-dns: Add test coverage for deletes

  • pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add labels to DNS records so that deleteStaleDNSRecordsForGateway doesn't filter them out. Verify that objects that are expected to be deleted are indeed deleted. Add a test case to verify that deletion works properly.
    (fakeClientRecorder): Add "deleted" field.
    (Create, Delete, Update): Log actions.
    (Delete): Record deleted objects.

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 change, 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.

  • 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.
  • pkg/resources/dnsrecord/dns_test.go (TestManageDNSForDomain): Add test cases for empty base domain and for various combinations of trailing dots on the domain or base domain.
  • pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add dnsConfig and infraConfig to existingObjects in test cases. 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.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link
Contributor

@Miciah: This pull request references Jira Issue OCPBUGS-10875, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.14.0) matches configured target version for branch (4.14.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @lihongan

In response to this:

gateway-service-dns: Add test coverage for deletes

  • pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add labels to DNS records so that deleteStaleDNSRecordsForGateway doesn't filter them out. Verify that objects that are expected to be deleted are indeed deleted. Add a test case to verify that deletion works properly.
    (fakeClientRecorder): Add "deleted" field.
    (Create, Delete, Update): Log actions.
    (Delete): Record deleted objects.

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 change, 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.

  • 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/resources/dnsrecord/dns_test.go (TestManageDNSForDomain): Add test cases for empty base domain and for various combinations of trailing dots on the domain or base domain.
  • pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add dnsConfig and infraConfig to existingObjects in test cases. 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.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Miciah
Copy link
Contributor Author

Miciah commented Jul 18, 2023

@Miciah
Copy link
Contributor Author

Miciah commented Jul 19, 2023

e2e-aws-ovn-serial failed on [sig-scheduling] Multi-AZ Clusters should spread the pods of a service across zones:

{  fail [test/e2e/scheduling/ubernetes_lite.go:178]: Pods were not evenly spread across zones.  0 in one zone and 10 in another zone
Expected
    <int>: 10
to be within 2 of ~
    <int>: 0
Error: exit with code 1
Ginkgo exit error 1: exit with code 1}

Search.ci isn't currently loading for me, so I cannot check whether this failure is occurring on other PRs.
/test e2e-aws-ovn-serial

e2e-hypershift failed. It isn't clear why. I see numerous errors in test output, but no actual test failure. I think the tests just timed out:

 {"component":"entrypoint","error":"process timed out","file":"k8s.io/test-infra/prow/entrypoint/run.go:79","func":"k8s.io/test-infra/prow/entrypoint.Options.Run","level":"error","msg":"Error executing test process","severity":"error","time":"2023-07-18T20:59:02Z"} 

@enxebre, do you know how to diagnose these failures?
/test e2e-hypershift

@gcs278
Copy link
Contributor

gcs278 commented Aug 2, 2023

Sorry for the delay, I missed the notifications on this one.

Updates look good, thanks.
/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 2, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 2, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gcs278

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 2, 2023
@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD ddba423 and 2 for PR HEAD 620c930 in total

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 4e7b2da and 1 for PR HEAD 620c930 in total

@Miciah
Copy link
Contributor Author

Miciah commented Aug 4, 2023

e2e-gcp-operator failed because must-gather failed.

Also, #968 merged, so we need to rerun all tests.
/test all.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 4, 2023

@Miciah: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test e2e-aws-operator
  • /test e2e-aws-ovn
  • /test e2e-aws-ovn-serial
  • /test e2e-aws-ovn-upgrade
  • /test e2e-azure-operator
  • /test e2e-gcp-operator
  • /test e2e-hypershift
  • /test images
  • /test unit
  • /test verify

The following commands are available to trigger optional jobs:

  • /test e2e-aws-ovn-single-node
  • /test e2e-azure-manual-oidc
  • /test e2e-azure-ovn
  • /test e2e-gcp-ovn

Use /test all to run the following jobs that were automatically triggered:

  • pull-ci-openshift-cluster-ingress-operator-master-e2e-aws-operator
  • pull-ci-openshift-cluster-ingress-operator-master-e2e-aws-ovn
  • pull-ci-openshift-cluster-ingress-operator-master-e2e-aws-ovn-serial
  • pull-ci-openshift-cluster-ingress-operator-master-e2e-aws-ovn-single-node
  • pull-ci-openshift-cluster-ingress-operator-master-e2e-aws-ovn-upgrade
  • pull-ci-openshift-cluster-ingress-operator-master-e2e-azure-operator
  • pull-ci-openshift-cluster-ingress-operator-master-e2e-azure-ovn
  • pull-ci-openshift-cluster-ingress-operator-master-e2e-gcp-operator
  • pull-ci-openshift-cluster-ingress-operator-master-e2e-gcp-ovn
  • pull-ci-openshift-cluster-ingress-operator-master-e2e-hypershift
  • pull-ci-openshift-cluster-ingress-operator-master-images
  • pull-ci-openshift-cluster-ingress-operator-master-unit
  • pull-ci-openshift-cluster-ingress-operator-master-verify

In response to this:

e2e-gcp-operator failed because must-gather failed.

Also, #968 merged, so we need to rerun all tests.
/test all.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Miciah
Copy link
Contributor Author

Miciah commented Aug 4, 2023

/test all

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 833bc28 and 0 for PR HEAD 620c930 in total

@openshift-ci-robot
Copy link
Contributor

/hold

Revision 620c930 was retested 3 times: holding

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 5, 2023
@Miciah
Copy link
Contributor Author

Miciah commented Aug 5, 2023

e2e-aws-operator failed because must-gather failed.
/test e2e-aws-operator

e2e-aws-ovn-serial failed because [sig-storage] PersistentVolumes-local Stress with local volumes [Serial] should be able to process many pods and reuse local volumes failed:

{  fail [test/e2e/storage/persistent_volumes-local.go:522]: persistentvolumes "local-pvx9bhx" not found
Error: exit with code 1
Ginkgo exit error 1: exit with code 1}

This is a known issue: OCPBUGS-14930.
/test e2e-aws-ovn-seria

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 5, 2023
@Miciah
Copy link
Contributor Author

Miciah commented Aug 5, 2023

/test e2e-aws-ovn-serial

1 similar comment
@Miciah
Copy link
Contributor Author

Miciah commented Aug 5, 2023

/test e2e-aws-ovn-serial

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 5, 2023

@Miciah: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 2be8f80 into openshift:master Aug 5, 2023
14 checks passed
@openshift-ci-robot
Copy link
Contributor

@Miciah: Jira Issue OCPBUGS-10875: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-10875 has been moved to the MODIFIED state.

In response to this:

gateway-service-dns: Add test coverage for deletes

  • pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add labels to DNS records so that deleteStaleDNSRecordsForGateway doesn't filter them out. Verify that objects that are expected to be deleted are indeed deleted. Add a test case to verify that deletion works properly.
    (fakeClientRecorder): Add "deleted" field.
    (Create, Delete, Update): Log actions.
    (Delete): Record deleted objects.

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 change, 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.

  • 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/resources/dnsrecord/dns_test.go (TestManageDNSForDomain): Add test cases for empty base domain and for various combinations of trailing dots on the domain or base domain.
  • pkg/operator/controller/gateway-service-dns/controller_test.go (Test_Reconcile): Add dnsConfig and infraConfig to existingObjects in test cases. 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.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants