mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
fix: api call chainsaw tests (#11682)
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com>
This commit is contained in:
parent
d215ce5344
commit
ec658b7abf
5 changed files with 17 additions and 31 deletions
|
@ -4,10 +4,6 @@ metadata:
|
||||||
name: default
|
name: default
|
||||||
spec:
|
spec:
|
||||||
steps:
|
steps:
|
||||||
- name: step-01
|
|
||||||
try:
|
|
||||||
- apply:
|
|
||||||
file: ns-bad.yaml
|
|
||||||
- name: create policy
|
- name: create policy
|
||||||
use:
|
use:
|
||||||
template: ../../../../../_step-templates/create-policy.yaml
|
template: ../../../../../_step-templates/create-policy.yaml
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
apiVersion: v1
|
|
||||||
kind: Namespace
|
|
||||||
metadata:
|
|
||||||
name: not-default
|
|
|
@ -1,9 +1,8 @@
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: example
|
name: bad-pod
|
||||||
namespace: default
|
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: nginx:latest
|
- image: nginx
|
||||||
name: example
|
name: example
|
|
@ -2,7 +2,6 @@ apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: example
|
name: example
|
||||||
namespace: default
|
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: nginx:latest
|
- image: nginx:latest
|
||||||
|
|
|
@ -12,31 +12,27 @@ spec:
|
||||||
- Pod
|
- Pod
|
||||||
operations:
|
operations:
|
||||||
- CREATE
|
- CREATE
|
||||||
|
- UPDATE
|
||||||
context:
|
context:
|
||||||
- name: testString
|
- name: podname
|
||||||
apiCall:
|
apiCall:
|
||||||
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
|
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
|
||||||
jmesPath: metadata.name
|
jmesPath: metadata.name
|
||||||
default: default
|
default: example
|
||||||
- name: testJSON
|
- name: testJSON
|
||||||
apiCall:
|
apiCall:
|
||||||
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
|
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
|
||||||
default: '{"metadata": {"name": "default"}}'
|
default:
|
||||||
- name: testInteger
|
metadata:
|
||||||
apiCall:
|
name: example
|
||||||
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
|
|
||||||
jmesPath: metadata.resourceVersion
|
|
||||||
default: 1
|
|
||||||
validate:
|
validate:
|
||||||
|
failureAction: Enforce
|
||||||
deny:
|
deny:
|
||||||
conditions:
|
conditions:
|
||||||
all:
|
all:
|
||||||
- key: "{{ testString }}"
|
- key: "{{ podname }}"
|
||||||
operator: Equals
|
operator: NotEquals
|
||||||
value: "{{ request.namespace }}"
|
value: "{{ request.object.metadata.name }}"
|
||||||
- key: "{{ testJSON.metadata.name }}"
|
- key: "{{ testJSON.metadata.name }}"
|
||||||
operator: Equals
|
operator: NotEquals
|
||||||
value: "{{ request.namespace }}"
|
value: "{{ request.object.metadata.name }}"
|
||||||
- key: "{{ testInteger }}"
|
|
||||||
operator: GreaterThan
|
|
||||||
value: 2
|
|
||||||
|
|
Loading…
Reference in a new issue