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

Fix constraints not satisfiable message causing compliance flood #220

Merged

Conversation

JeffeyL
Copy link
Contributor

@JeffeyL JeffeyL commented Mar 25, 2024

ConstraintsNotSatisfiable message types in the subscription status are formatted "constraints not satisfiable: clause1, clause2, clause3 ...". However, the order of the clauses is nondeterministic, which causes compliance event flapping as each update leads to a different ordering of messages, which in turn triggers another update. This was fixed by sorting the message prior to evaluation.

Ref: https://issues.redhat.com/browse/ACM-10204

Copy link
Member

@JustinKuli JustinKuli left a comment

Choose a reason for hiding this comment

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

Looks good overall! Just want to help the readability a little bit

controllers/operatorpolicy_controller.go Outdated Show resolved Hide resolved
controllers/operatorpolicy_controller.go Outdated Show resolved Hide resolved
JustinKuli
JustinKuli previously approved these changes Mar 26, 2024
}
}

if policyMessage == "" || !strings.Contains(cond.Message, cnfPrefix) {
Copy link
Member

Choose a reason for hiding this comment

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

Even better!

@JeffeyL
Copy link
Contributor Author

JeffeyL commented Mar 26, 2024

Some tests might be flaky after this change... I'll check it out

ConstraintsNotSatisfiable message types in the subscription
status are formatted "constraints not satisfiable: clause1, clause2,
clause3 ...". However, the order of the clauses is nondeterministic,
which causes compliance event flapping as each update leads to a
different ordering of messages, which in turn triggers another update.
This was fixed by sorting the message prior to evaluation.

Ref: https://issues.redhat.com/browse/ACM-10204

Signed-off-by: Jeffrey Luo <jeluo@redhat.com>
@JeffeyL
Copy link
Contributor Author

JeffeyL commented Mar 26, 2024

Turns out I had to add the string sorting logic to the check function in the tests as well, should be fixed now!

@openshift-ci openshift-ci bot added the lgtm label Mar 27, 2024
Copy link

openshift-ci bot commented Mar 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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


for _, statusCond := range policy.Status.Conditions {
if strings.Contains(statusCond.Message, cnfPrefix) {
policyMessage = statusCond.Message
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason not to break out of the loop after this assignment?

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