-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: update KeysAreMissing() to ignore negations in resource #8953
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: update KeysAreMissing() to ignore negations in resource #8953
Conversation
KeysAreMissing() checks if a key is missing in a resource, since a negation should not be present in the resource, it should not count as a missing key Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #8953 +/- ##
==========================================
- Coverage 33.60% 33.60% -0.01%
==========================================
Files 315 315
Lines 24951 24953 +2
==========================================
Hits 8386 8386
- Misses 15768 15769 +1
- Partials 797 798 +1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
...ormance/kuttl/validate/clusterpolicy/standard/enforce/failure-policy-ignore-anchor/README.md
Show resolved
Hide resolved
/cherry-pick release-1.11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May not be related directly to this fix, do we need a doc issue to clarify behaviors for the policy failure vs error ?
/cherry-pick release-1.11 |
* fix: update KeysAreMissing() to ignore negations in resource KeysAreMissing() checks if a key is missing in a resource, since a negation should not be present in the resource, it should not count as a missing key Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> * feat: add tests Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> * fix: pod is supposed to fail Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> --------- Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
…8982) * fix: update KeysAreMissing() to ignore negations in resource KeysAreMissing() checks if a key is missing in a resource, since a negation should not be present in the resource, it should not count as a missing key * feat: add tests * fix: pod is supposed to fail --------- Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> Co-authored-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>
…#8953) * fix: update KeysAreMissing() to ignore negations in resource KeysAreMissing() checks if a key is missing in a resource, since a negation should not be present in the resource, it should not count as a missing key Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> * feat: add tests Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> * fix: pod is supposed to fail Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> --------- Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
…#8953) * fix: update KeysAreMissing() to ignore negations in resource KeysAreMissing() checks if a key is missing in a resource, since a negation should not be present in the resource, it should not count as a missing key Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> * feat: add tests Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> * fix: pod is supposed to fail Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> --------- Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
…#8953) * fix: update KeysAreMissing() to ignore negations in resource KeysAreMissing() checks if a key is missing in a resource, since a negation should not be present in the resource, it should not count as a missing key Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> * feat: add tests Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> * fix: pod is supposed to fail Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> --------- Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Explanation
The resource is not blocked when setting the
failurePolicy
toIgnore
for a policy that was set toEnforce
.When testing using the provided proof manifest I found out that ac.KeysAreMissing() returns true here which results in the rule returning an error and not a failure. Due to this failurePolicy=Ignore consumes the error response and the resource is not blocked.
The resource should be blocked and
ac.KeysAreMissing()
should not return an error when it does not encounters an negation anchor key in resource.Related issue
Closes: #8916
Milestone of this PR
/milestone 1.11.1
What type of PR is this
/kind bug
Proposed Changes
Proof Manifests
Checklist
Further Comments