1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 07:26:55 +00:00

fix: use v2beta1 version of exceptions in kyverno create CLI (#9020)

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
This commit is contained in:
Mariam Fahmy 2023-11-27 11:02:00 +02:00 committed by GitHub
parent 3aa662accc
commit 925f80d4c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View file

@ -7,7 +7,6 @@ import (
"text/template"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
"github.com/kyverno/kyverno/api/kyverno/v2alpha1"
"github.com/kyverno/kyverno/api/kyverno/v2beta1"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/command"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/create/templates"
@ -18,7 +17,7 @@ type options struct {
Name string
Namespace string
Background bool
Exceptions []v2alpha1.Exception
Exceptions []v2beta1.Exception
Match v2beta1.MatchResources
}
@ -81,12 +80,12 @@ func Command() *cobra.Command {
return cmd
}
func parseRule(in string) *v2alpha1.Exception {
func parseRule(in string) *v2beta1.Exception {
parts := strings.Split(in, ",")
if len(parts) < 2 {
return nil
}
return &v2alpha1.Exception{
return &v2beta1.Exception{
PolicyName: parts[0],
RuleNames: parts[1:],
}

View file

@ -40,7 +40,7 @@ func TestCommandWithAny(t *testing.T) {
out, err := io.ReadAll(b)
assert.NoError(t, err)
expected := `
apiVersion: kyverno.io/v2alpha1
apiVersion: kyverno.io/v2beta1
kind: PolicyException
metadata:
name: test
@ -73,7 +73,7 @@ func TestCommandWithAll(t *testing.T) {
out, err := io.ReadAll(b)
assert.NoError(t, err)
expected := `
apiVersion: kyverno.io/v2alpha1
apiVersion: kyverno.io/v2beta1
kind: PolicyException
metadata:
name: test

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2alpha1
apiVersion: kyverno.io/v2beta1
kind: PolicyException
metadata:
name: {{ .Name }}