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:
parent
3aa662accc
commit
925f80d4c2
3 changed files with 6 additions and 7 deletions
|
@ -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:],
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kyverno.io/v2alpha1
|
||||
apiVersion: kyverno.io/v2beta1
|
||||
kind: PolicyException
|
||||
metadata:
|
||||
name: {{ .Name }}
|
||||
|
|
Loading…
Add table
Reference in a new issue