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

Correctly invoking Kyverno engine in Kyverno CLI #8101

Closed

Conversation

anushkamittal2001
Copy link
Collaborator

@anushkamittal2001 anushkamittal2001 commented Aug 23, 2023

Explanation

We want to correct the way Kyverno engine is invoked in Kyverno CLI

Related issue

Fixes #7994

Milestone of this PR

What type of PR is this

/kind design

Proposed Changes

ApplyPolicyConfig struct now takes a slice of policies instead of a single policy. We are then changing the way Kyverno engine is invoked in the CLI. Now on a single resource we apply all mutate policies, then verifyImage then validate then generate policies.

Proof Manifests

This PR contains mostly refactoring, all the unit test cases in apply_command_test.go and common_test.go pass

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.
    • I have added or changed the documentation myself in an existing PR and the link is:
    • I have raised an issue in kyverno/website to track the documentation update and the link is:

Further Comments

Reference doc for this PR

Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
@anushkamittal2001 anushkamittal2001 marked this pull request as ready for review August 25, 2023 09:36
Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Merging #8101 (7aef8f8) into main (f3ad487) will increase coverage by 0.27%.
The diff coverage is 48.55%.

@@            Coverage Diff             @@
##             main    #8101      +/-   ##
==========================================
+ Coverage   33.05%   33.33%   +0.27%     
==========================================
  Files         252      252              
  Lines       23719    24050     +331     
==========================================
+ Hits         7841     8016     +175     
- Misses      15058    15192     +134     
- Partials      820      842      +22     
Files Changed Coverage Δ
cmd/cli/kubectl-kyverno/test/test.go 7.77% <0.00%> (ø)
cmd/cli/kubectl-kyverno/utils/common/common.go 10.51% <28.23%> (ø)
...ctl-kyverno/utils/common/kyverno_policies_types.go 53.13% <51.64%> (-1.71%) ⬇️
cmd/cli/kubectl-kyverno/apply/apply_command.go 38.67% <90.00%> (+1.03%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@eddycharly eddycharly changed the title Correctly invoking Kyverno engine int Kyverno CLI Correctly invoking Kyverno engine in Kyverno CLI Aug 28, 2023
Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
anushkamittal2001 and others added 6 commits August 29, 2023 19:37
Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
Signed-off-by: anushkamittal2001 <anushka@nirmata.com>
@chipzoller
Copy link
Member

Many conflicts to now resolve.

@eddycharly
Copy link
Member

Closing, done in #8327

@eddycharly eddycharly closed this Sep 11, 2023
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.

[Feature] Refactored CLI
5 participants