-
Notifications
You must be signed in to change notification settings - Fork 784
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: add a copy method to the policy context #10236
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MariamFahmy98
requested review from
MarcelMue,
realshuting and
KhaledEmaraDev
as code owners
May 14, 2024 14:08
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10236 +/- ##
==========================================
- Coverage 10.20% 10.20% -0.01%
==========================================
Files 1031 1031
Lines 91875 91877 +2
==========================================
- Hits 9377 9375 -2
- Misses 81470 81473 +3
- Partials 1028 1029 +1 ☔ View full report in Codecov by Sentry. |
realshuting
previously approved these changes
May 20, 2024
vishal-chdhry
previously approved these changes
May 20, 2024
KhaledEmaraDev
previously approved these changes
May 21, 2024
MariamFahmy98
dismissed stale reviews from vishal-chdhry and KhaledEmaraDev
via
May 21, 2024 12:47
998a9e8
realshuting
previously approved these changes
May 21, 2024
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
realshuting
approved these changes
May 21, 2024
/cherry-pick release-1.12 |
gcp-cherry-pick-bot bot
pushed a commit
that referenced
this pull request
May 21, 2024
* fix: add a copy method to the policy context Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> * chore: add a CLI test Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> * chore: remove mutate changes Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> --------- Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
realshuting
added
the
cherry-pick-completed
The PR was cherry-picked (or merged) to required release branches
label
May 21, 2024
realshuting
pushed a commit
that referenced
this pull request
May 21, 2024
anushkamittal2001
pushed a commit
to nirmata/kyverno
that referenced
this pull request
May 24, 2024
…#10280) * fix: add a copy method to the policy context * chore: add a CLI test * chore: remove mutate changes --------- Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> Co-authored-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-pick-completed
The PR was cherry-picked (or merged) to required release branches
cherry-pick-required
milestone 1.12.2
milestone 1.13.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
In case there is a policy that have two rules; one of which has
forEach
so it sets theelement
of the policy context while the other rule which is of typevalidate.pattern
uses the same policy context that has theelement
set.This issue arises from the following line:
kyverno/pkg/engine/handlers/validation/validate_resource.go
Line 225 in 25cb47e
Both
v.policyContext
andpolicyContext
reference the same struct in memory. As a solution, this PR implements aCopy()
method for the policy context.Related issue
Closes #10220
Milestone of this PR
/milestone 1.12.2
Documentation (required for features)
My PR contains new or altered behavior to Kyverno.
What type of PR is this
/kind bug
Proposed Changes
Proof Manifests
The resource is successfully created.
We can test it using Kyverno CLI as follows:
Checklist
Further Comments