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

Synchronously emit template events #56

Conversation

JustinKuli
Copy link
Member

@JustinKuli JustinKuli commented Apr 17, 2023

Main commit:

Previously, the controller-runtime event recorder was used for these events. Other policy controllers have moved away from that, for various reasons. In this case, if a policy went from pending to noncompliant and back to pending, the "old" pending event would be re-used by the event recorder, and only the lastTimestamp would be updated. In this case, if a policy controller emitted a compliance event within the same second as the Pending event, the status-sync would see it as a tie, and use the hex-encoded nanoseconds in the event name. But the event name was not updated from the original instance when the policy was pending, so the events would be ordered incorrectly.

Most error cases from this synchronous sending can be ignored because they are already error cases that would be requeued.

Refs:

This should make it slightly more re-usable in other controllers. In
particular this allows the `instance` to be `nil`, which might be the
case if the template was not created.

Signed-off-by: Justin Kulikauskas <[email protected]>
This might be slightly more performant, and other things can use this
clientset.

Signed-off-by: Justin Kulikauskas <[email protected]>
Previously, the controller-runtime event recorder was used for these
events. Other policy controllers have moved away from that, for various
reasons. In this case, if a policy went from pending to noncompliant and
back to pending, the "old" pending event would be re-used by the event
recorder, and only the `lastTimestamp` would be updated. In this case,
if a policy controller emitted a compliance event within the same second
as the Pending event, the status-sync would see it as a tie, and use the
hex-encoded nanoseconds in the event name. But the event name was not
updated from the original instance when the policy was pending, so the
events would be ordered incorrectly.

Most error cases from this synchronous sending can be ignored because
they are already error cases that would be requeued.

Refs:
 - https://issues.redhat.com/browse/ACM-4699

Signed-off-by: Justin Kulikauskas <[email protected]>
@yiraeChristineKim
Copy link
Contributor

does this pr need squash?

@JustinKuli
Copy link
Member Author

Succeeding 30 times in a row on the targeted framework tests: (last 3 commits).

@JustinKuli
Copy link
Member Author

does this pr need squash?

I can squash it if you want, but I felt like splitting the changes into these commits made sense.

@openshift-ci
Copy link

openshift-ci bot commented Apr 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JustinKuli, yiraeChristineKim

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:
  • OWNERS [JustinKuli,yiraeChristineKim]

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

@openshift-merge-robot openshift-merge-robot merged commit f0e2c60 into open-cluster-management-io:main Apr 18, 2023
@JustinKuli JustinKuli deleted the pending-collision branch April 18, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants