1
0
Fork 0
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:
Vishal Choudhary 2024-12-02 21:16:37 +05:30 committed by GitHub
parent d215ce5344
commit ec658b7abf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 31 deletions

View file

@ -4,10 +4,6 @@ metadata:
name: default
spec:
steps:
- name: step-01
try:
- apply:
file: ns-bad.yaml
- name: create policy
use:
template: ../../../../../_step-templates/create-policy.yaml

View file

@ -1,4 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: not-default

View file

@ -1,9 +1,8 @@
apiVersion: v1
kind: Pod
metadata:
name: example
namespace: default
name: bad-pod
spec:
containers:
- image: nginx:latest
- image: nginx
name: example

View file

@ -2,7 +2,6 @@ apiVersion: v1
kind: Pod
metadata:
name: example
namespace: default
spec:
containers:
- image: nginx:latest

View file

@ -12,31 +12,27 @@ spec:
- Pod
operations:
- CREATE
- UPDATE
context:
- name: testString
- name: podname
apiCall:
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
jmesPath: metadata.name
default: default
default: example
- name: testJSON
apiCall:
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
default: '{"metadata": {"name": "default"}}'
- name: testInteger
apiCall:
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
jmesPath: metadata.resourceVersion
default: 1
default:
metadata:
name: example
validate:
failureAction: Enforce
deny:
conditions:
all:
- key: "{{ testString }}"
operator: Equals
value: "{{ request.namespace }}"
- key: "{{ podname }}"
operator: NotEquals
value: "{{ request.object.metadata.name }}"
- key: "{{ testJSON.metadata.name }}"
operator: Equals
value: "{{ request.namespace }}"
- key: "{{ testInteger }}"
operator: GreaterThan
value: 2
operator: NotEquals
value: "{{ request.object.metadata.name }}"