mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
Added chainsaw test for the ttl based cleanup poliy (#11328)
* Added chainsaw test for the ttl based cleanup poliy Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com> * Updated the ttl/propagation-policy chainsaw test structure Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com> * Enhanced the chainsaw tests for the ttl/propagation-policy Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com> * orphan Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * Update test/conformance/chainsaw/ttl/propagation-policy/orphan/chainsaw-test.yaml Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * Improved chainsaw tests for foreground and background propagation policies Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com> * Fix background policy test: assert pod is deleted after job removal Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com> * Fix: changed pod-deleted-assert.yaml to pod-assert.yaml in the foreground Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com> * Change assert to error check for pod deletion in foreground test Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com> * Removed the pod-deleted-assert.yaml file Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com> --------- Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
00fd6d47f8
commit
1114f0af36
9 changed files with 130 additions and 0 deletions
|
@ -0,0 +1,22 @@
|
||||||
|
apiVersion: chainsaw.kyverno.io/v1alpha1
|
||||||
|
kind: Test
|
||||||
|
metadata:
|
||||||
|
name: background
|
||||||
|
spec:
|
||||||
|
steps:
|
||||||
|
- name: Create job with background deletion policy
|
||||||
|
try:
|
||||||
|
- create:
|
||||||
|
file: job.yaml
|
||||||
|
- name: Wait pod is running
|
||||||
|
try:
|
||||||
|
- assert:
|
||||||
|
file: pod-assert.yaml
|
||||||
|
- name: Delete job with background deletion policy
|
||||||
|
try:
|
||||||
|
- delete:
|
||||||
|
file: job.yaml
|
||||||
|
- name: Assert pod is no longer running
|
||||||
|
try:
|
||||||
|
- error:
|
||||||
|
file: pod-assert.yaml
|
|
@ -0,0 +1,17 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: job
|
||||||
|
annotations:
|
||||||
|
cleanup.kyverno.io/propagation-policy: Background
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
containers:
|
||||||
|
- name: main
|
||||||
|
image: docker.io/library/bash:5
|
||||||
|
command: ["bash"]
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- sleep 120s
|
|
@ -0,0 +1,4 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
status:
|
||||||
|
phase: Running
|
|
@ -0,0 +1,22 @@
|
||||||
|
apiVersion: chainsaw.kyverno.io/v1alpha1
|
||||||
|
kind: Test
|
||||||
|
metadata:
|
||||||
|
name: foreground
|
||||||
|
spec:
|
||||||
|
steps:
|
||||||
|
- name: Create job with foreground deletion policy
|
||||||
|
try:
|
||||||
|
- create:
|
||||||
|
file: job.yaml
|
||||||
|
- name: Wait pod is running
|
||||||
|
try:
|
||||||
|
- assert:
|
||||||
|
file: pod-assert.yaml
|
||||||
|
- name: Delete job with foreground deletion policy
|
||||||
|
try:
|
||||||
|
- delete:
|
||||||
|
file: job.yaml
|
||||||
|
- name: Assert pod is no longer running
|
||||||
|
try:
|
||||||
|
- error:
|
||||||
|
file: pod-assert.yaml
|
|
@ -0,0 +1,17 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: job
|
||||||
|
annotations:
|
||||||
|
cleanup.kyverno.io/propagation-policy: Foreground
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
containers:
|
||||||
|
- name: main
|
||||||
|
image: docker.io/library/bash:5
|
||||||
|
command: ["bash"]
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- sleep 120s
|
|
@ -0,0 +1,5 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
status:
|
||||||
|
phase: Running
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
apiVersion: chainsaw.kyverno.io/v1alpha1
|
||||||
|
kind: Test
|
||||||
|
metadata:
|
||||||
|
name: orphan
|
||||||
|
spec:
|
||||||
|
steps:
|
||||||
|
- name: Create job with orphan deletion policy
|
||||||
|
try:
|
||||||
|
- create:
|
||||||
|
file: job.yaml
|
||||||
|
- name: Wait pod is running
|
||||||
|
try:
|
||||||
|
- assert:
|
||||||
|
file: pod-assert.yaml
|
||||||
|
- name: Delete job
|
||||||
|
try:
|
||||||
|
- delete:
|
||||||
|
file: job.yaml
|
||||||
|
- name: Assert pod is still running
|
||||||
|
try:
|
||||||
|
- assert:
|
||||||
|
file: pod-assert.yaml
|
|
@ -0,0 +1,17 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: job
|
||||||
|
annotations:
|
||||||
|
cleanup.kyverno.io/propagation-policy: Orphan
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
containers:
|
||||||
|
- name: main
|
||||||
|
image: docker.io/library/bash:5
|
||||||
|
command: ["bash"]
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- sleep 120s
|
|
@ -0,0 +1,4 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
status:
|
||||||
|
phase: Running
|
Loading…
Reference in a new issue