[go: up one dir, main page]

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

feat: support all valid jsonpatches in validation webhook #9476

Merged
merged 3 commits into from
Jan 22, 2024

Conversation

woehrl01
Copy link
Contributor
@woehrl01 woehrl01 commented Jan 22, 2024

Explanation

This PR modifies the validation webhook so that JsonPatches can be of all valid JsonPatches operations. Adding "move", "copy" and "test"

Related issue

Milestone of this PR

Documentation (optional)

My PR contains new or altered behavior to Kyverno.

What type of PR is this

Proposed Changes

Proof Manifests

Checklist

  • I have read the contributing guidelines.
  • I have read the PR documentation guide and followed the process including adding proof manifests to this PR.
  • This is a bug fix and I have added unit tests that prove my fix is effective.
  • This is a feature and I have added CLI tests that are applicable.
  • My PR needs to be cherry picked to a specific release branch which is .
  • My PR contains new or altered behavior to Kyverno and
    • CLI support should be added and my PR doesn't contain that functionality.

Further Comments

Copy link
welcome bot commented Jan 22, 2024

Thanks for opening your first Pull Request here! Please check out our Contributing guidelines and confirm that you Signed off.

Signed-off-by: Lukas Wöhrl <lukas.woehrl@plentymarkets.com>
@eddycharly
Copy link
Member

Thanks @woehrl01 !
Could you elaborate why we need this change ?

@woehrl01
Copy link
Contributor Author
woehrl01 commented Jan 22, 2024

@eddycharly Absolutely, in our policy I could make use of the move statement, to shift values around, same applies for copy. I added test as well just to complete the list.

Potential rule:

      mutate:
        patchesJson6902: |-
          - op: move
            from: /spec/containers/0/resources
            path: /tmp/keepResources
          - op: add
            path: /spec/containers
            value: {{ context.containers || `[]` }}
          - op: move
            from: /tmp/keepResources
            path: /spec/containers/0/resources

@eddycharly
Copy link
Member

Sounds good, thanks for clarifying it.

@eddycharly eddycharly enabled auto-merge (squash) January 22, 2024 13:51
Copy link
codecov bot commented Jan 22, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (2f4b823) 32.83% compared to head (1e73673) 32.82%.

Files Patch % Lines
pkg/validation/policy/validate.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9476      +/-   ##
==========================================
- Coverage   32.83%   32.82%   -0.01%     
==========================================
  Files         326      326              
  Lines       26191    26193       +2     
==========================================
  Hits         8599     8599              
- Misses      16794    16796       +2     
  Partials      798      798              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eddycharly eddycharly merged commit 349e363 into kyverno:main Jan 22, 2024
229 of 233 checks passed
Copy link
welcome bot commented Jan 22, 2024

Congratulations! 🎉

Great job merging your first Pull Request here! How awesome! If you are new to this project, feel free to join our Slack community
200w

@woehrl01 woehrl01 deleted the support-alljsonpatch-ops branch January 22, 2024 14:57
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