mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
chore: use v2 for exceptions in chainsaw tests (#10529)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
This commit is contained in:
parent
585aff0aca
commit
b7bf894fe9
40 changed files with 44 additions and 44 deletions
|
@ -40,7 +40,7 @@ func TestCommandWithAny(t *testing.T) {
|
||||||
out, err := io.ReadAll(b)
|
out, err := io.ReadAll(b)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
expected := `
|
expected := `
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: test
|
name: test
|
||||||
|
@ -72,7 +72,7 @@ func TestCommandWithAll(t *testing.T) {
|
||||||
out, err := io.ReadAll(b)
|
out, err := io.ReadAll(b)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
expected := `
|
expected := `
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: test
|
name: test
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ .Name }}
|
name: {{ .Name }}
|
||||||
|
|
|
@ -288,7 +288,7 @@ func NewPolicyExceptionEvents(engineResponse engineapi.EngineResponse, ruleResp
|
||||||
func NewCleanupPolicyEvent(policy kyvernov2beta1.CleanupPolicyInterface, resource unstructured.Unstructured, err error) Info {
|
func NewCleanupPolicyEvent(policy kyvernov2beta1.CleanupPolicyInterface, resource unstructured.Unstructured, err error) Info {
|
||||||
regarding := corev1.ObjectReference{
|
regarding := corev1.ObjectReference{
|
||||||
// TODO: iirc it's not safe to assume api version is set
|
// TODO: iirc it's not safe to assume api version is set
|
||||||
APIVersion: "kyverno.io/v2beta1",
|
APIVersion: "kyverno.io/v2",
|
||||||
Kind: policy.GetKind(),
|
Kind: policy.GetKind(),
|
||||||
Name: policy.GetName(),
|
Name: policy.GetName(),
|
||||||
Namespace: policy.GetNamespace(),
|
Namespace: policy.GetNamespace(),
|
||||||
|
|
|
@ -26,7 +26,7 @@ func Test_Validate(t *testing.T) {
|
||||||
Enabled: false,
|
Enabled: false,
|
||||||
Namespace: "kyverno",
|
Namespace: "kyverno",
|
||||||
},
|
},
|
||||||
resource: []byte(`{"apiVersion":"kyverno.io/v2beta1","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"delta"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
|
resource: []byte(`{"apiVersion":"kyverno.io/v2","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"delta"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
|
||||||
},
|
},
|
||||||
want: 1,
|
want: 1,
|
||||||
},
|
},
|
||||||
|
@ -37,7 +37,7 @@ func Test_Validate(t *testing.T) {
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
Namespace: "kyverno",
|
Namespace: "kyverno",
|
||||||
},
|
},
|
||||||
resource: []byte(`{"apiVersion":"kyverno.io/v2beta1","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"delta"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
|
resource: []byte(`{"apiVersion":"kyverno.io/v2","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"delta"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
|
||||||
},
|
},
|
||||||
want: 1,
|
want: 1,
|
||||||
},
|
},
|
||||||
|
@ -48,7 +48,7 @@ func Test_Validate(t *testing.T) {
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
Namespace: "kyverno",
|
Namespace: "kyverno",
|
||||||
},
|
},
|
||||||
resource: []byte(`{"apiVersion":"kyverno.io/v2beta1","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"kyverno"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
|
resource: []byte(`{"apiVersion":"kyverno.io/v2","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"kyverno"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
|
||||||
},
|
},
|
||||||
want: 0,
|
want: 0,
|
||||||
},
|
},
|
||||||
|
@ -59,7 +59,7 @@ func Test_Validate(t *testing.T) {
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
Namespace: "",
|
Namespace: "",
|
||||||
},
|
},
|
||||||
resource: []byte(`{"apiVersion":"kyverno.io/v2beta1","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"kyverno"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
|
resource: []byte(`{"apiVersion":"kyverno.io/v2","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"kyverno"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
|
||||||
},
|
},
|
||||||
want: 0,
|
want: 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: delta-exception
|
name: delta-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: container-exception
|
name: container-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: exception
|
name: exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: mynewpolex
|
name: mynewpolex
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: delta-exception
|
name: delta-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: polex-right
|
name: polex-right
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: polex-wrong
|
name: polex-wrong
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: container-exception
|
name: container-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: policy-exception-allow-latest
|
name: policy-exception-allow-latest
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: failing-container-exception
|
name: failing-container-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: passing-container-exception
|
name: passing-container-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: mynewpolex
|
name: mynewpolex
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: mynewpolex
|
name: mynewpolex
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: policy-exception
|
name: policy-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: label-exception
|
name: label-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: mynewpolex
|
name: mynewpolex
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: container-exception
|
name: container-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-security-exception
|
name: pod-security-exception
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: mynewpolex
|
name: mynewpolex
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: allow-scaling-nginx-test
|
name: allow-scaling-nginx-test
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: kyverno.io/v2beta1
|
apiVersion: kyverno.io/v2
|
||||||
kind: PolicyException
|
kind: PolicyException
|
||||||
metadata:
|
metadata:
|
||||||
name: allow-scaling-nginx-test
|
name: allow-scaling-nginx-test
|
||||||
|
|
Loading…
Reference in a new issue