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 items in nested lists not always being matched #168

Merged

Conversation

JustinKuli
Copy link
Member

When a policy is looking for a field in a list, which is itself nested in an object in a list, and when there are multiple items in these lists on the cluster, the controller was not always matching things correctly. This could result in the policy's compliance depending on the order of the items in the nested list on the cluster. (The new test case may be more clear than this problem description.)

This situation is difficult to reproduce: because of the way some lists were compared before, fields that don't seem like they should affect the result can change the outcome.

When a policy is looking for a field in a list, which is itself nested
in an object in a list, and when there are multiple items in these lists
on the cluster, the controller was not always matching things correctly.
This could result in the policy's compliance depending on the order of
the items in the nested list on the cluster. (The new test case may be
more clear than this problem description.)

This situation is difficult to reproduce: because of the way some lists
were compared before, fields that don't seem like they should affect the
result can change the outcome.

Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
Copy link
Member

@mprahl mprahl left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix!

@openshift-ci
Copy link

openshift-ci bot commented Oct 24, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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 merged commit 32421e8 into open-cluster-management-io:main Oct 24, 2023
4 checks passed
@JustinKuli JustinKuli deleted the nested-list-matching branch October 24, 2023 13:19
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.

2 participants