Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ur not cleaned up when deleting namespaced policy #17

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add kuttl tests for jmespath special chars (kyverno#5310)
* Adds tests for fixes in kyverno#4767

Signed-off-by: Tobias Dahlberg <tobias.dahlberg@sinch.com>

Signed-off-by: Tobias Dahlberg <tobias.dahlberg@sinch.com>
Co-authored-by: shuting <shuting@nirmata.com>
somebadcode and realshuting authored Nov 11, 2022
commit 97a2b9a9a3e9e91184b710b117934871029f9265
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- policy.yaml
assert:
- policy-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- resources.yaml
assert:
- resources-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Description

This test checks that document references with special characters in their names are supported.

## Expected Behavior

JMESPath references generated when documents are traversed are escaped properly according to the JMESPath standard.

## Reference Issue(s)

3578
3616
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: jmespath-with-special-chars-demo
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: jmespath-with-special-chars-demo
spec:
rules:
- name: format-deploy-zone
match:
any:
- resources:
kinds:
- Pod
mutate:
patchStrategicMerge:
metadata:
labels:
deploy-zone: "{{ to_upper('{{@}}') }}"
- name: retention-adjust
match:
any:
- resources:
kinds:
- Pod
mutate:
patchStrategicMerge:
metadata:
labels:
corp.com/retention: "{{ regex_replace_all('([0-9])([0-9])', '{{ @ }}', '${1}0') }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Pod
metadata:
name: busybox
labels:
deploy-zone: FRANKFURT
corp.com/retention: days_30
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Pod
metadata:
name: busybox
labels:
deploy-zone: frankfurt
corp.com/retention: days_37
spec:
containers:
- name: busybox
image: busybox:stable
command: ["sleep", "600"]