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

dns: Don't hotloop on updates to DNSRecord status #484

Conversation

Miciah
Copy link
Contributor

@Miciah Miciah commented Nov 2, 2020

Add a predicate to the DNS controller's watch on DNSRecords so that only updates a DNSRecord's spec triggers reconciliation (and updates to its status do not).

Before this change, one reconciliation could update the DNSRecord's status and trigger a second reconciliation. In the case of a successful update, the second reconciliation would have no work to do, so it would complete without triggering a third reconciliation. In the case of a failed update, the second reconciliation would retry the update. If retrying the update then failed, the second reconciliation could update the DNSRecord's status to record the new failure, triggering a third reconciliation, which could similarly trigger a fourth reconciliation, and so on ad infinitum.

  • pkg/operator/controller/dns/controller.go (New): Add a predicate to the watch on DNSRecords to ignore updates to status.

@ironcladlou

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 2, 2020
@Miciah Miciah force-pushed the dns-don't-hotloop-on-updates-to-DNSRecord-status branch from 02e893b to 26e14ce Compare November 3, 2020 02:00
@Miciah
Copy link
Contributor Author

Miciah commented Nov 3, 2020

Latest push uses GenerationChangedPredicate, which returns true for create, delete, and generic events, and returns false for updates if the generation has not changed. Maybe that will fix handling of delete events.

Add a predicate to the DNS controller's watch on DNSRecords so that only
updates a DNSRecord's spec triggers reconciliation (and updates to its
status do not).

Before this commit, one reconciliation could update the DNSRecord's status
and trigger a second reconciliation.  In the case of a successful update,
the second reconciliation would have no work to do, so it would complete
without triggering a third reconciliation.  In the case of a failed update,
the second reconciliation would retry the update.  If retrying the update
then failed, the second reconciliation could update the DNSRecord's status
to record the new failure, triggering a third reconciliation, which could
similarly trigger a fourth reconciliation, and so on ad infinitum.

* pkg/operator/controller/dns/controller.go (New): Add a predicate to the
watch on DNSRecords to ignore updates to status.
@Miciah Miciah force-pushed the dns-don't-hotloop-on-updates-to-DNSRecord-status branch from 26e14ce to 1761341 Compare November 3, 2020 05:46
@ironcladlou
Copy link
Contributor

Thanks, lgtm although there are some assumptions baked into that predicate to consider:

// * The assumption that the Generation is incremented only on writing to the spec does not hold for all APIs.
// E.g For Deployment objects the Generation is also incremented on writes to the metadata.annotations field.
// For object types other than CustomResources be sure to verify which fields will trigger a Generation increment when they are written to.
//
// * With this predicate, any update events with writes only to the status field will not be reconciled.
// So in the event that the status block is overwritten or wiped by someone else the controller will not self-correct to restore the correct status.

hopefully regression testing would reveal any possible sync issue here.

@Miciah
Copy link
Contributor Author

Miciah commented Nov 3, 2020

/test e2e-aws-operator

@sgreene570
Copy link
Contributor

/lgtm

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Miciah, sgreene570

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-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 24, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

9 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 2a62785 into openshift:master Nov 25, 2020
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. 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

6 participants