1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

chore: use more chainsaw step templates (#11300)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2024-10-03 10:36:30 +02:00 committed by GitHub
parent 00eeb644d9
commit 6870d8fdf8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
67 changed files with 396 additions and 426 deletions

View file

@ -6,11 +6,21 @@ spec:
concurrent: false
namespace: foo
steps:
- name: create policy
use:
template: ../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: basic-sigstore-test-policy
- try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- script:
content: kubectl run -n $NAMESPACE test-sigstore --image=$TEST_IMAGE_URL
- assert:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: basic-sigstore-test-policy
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -6,11 +6,21 @@ spec:
concurrent: false
namespace: foo
steps:
- name: create policy
use:
template: ../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: basic-sigstore-test-policy
- try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- script:
content: kubectl run -n $NAMESPACE test-sigstore --image=$TEST_IMAGE_URL
- assert:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: basic-sigstore-test-policy
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,24 @@ metadata:
name: dependencies
spec:
steps:
- name: step-01
- name: create namespace
try:
- apply:
file: manifests.yaml
- assert:
file: policy-assert.yaml
file: ns.yaml
- name: create policy
use:
template: ../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: enforce-company-budget
- name: step-02
try:
- apply:

View file

@ -1,5 +1,3 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:

View file

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: acme-fitness

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: enforce-company-budget
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -1,9 +1,3 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: acme-fitness
---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:

View file

@ -4,12 +4,24 @@ metadata:
name: dependencies
spec:
steps:
- name: step-01
- name: create namespace
try:
- apply:
file: manifests.yaml
- assert:
file: policy-assert.yaml
file: ns.yaml
- name: create policy
use:
template: ../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: enforce-company-budget
- name: step-02
try:
- apply:

View file

@ -1,5 +1,3 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:

View file

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: acme-fitness

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: enforce-company-budget
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -1,9 +1,3 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: acme-fitness
---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:

View file

@ -4,12 +4,20 @@ metadata:
name: foreach
spec:
steps:
- name: step-01
try:
- apply:
file: manifests.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: testcase-7fki3
- name: step-02
try:
- apply:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: testcase-7fki3
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -1,4 +1,3 @@
---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:

View file

@ -4,12 +4,20 @@ metadata:
name: recursive
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: one
- name: step-02
try:
- apply:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: one
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: resolve-overriden-variable
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: one
- name: step-02
try:
- apply:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: one
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: two-rules
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: one
- name: step-02
try:
- apply:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: one
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: no-wildcard
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: wildcard
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: block
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: pass
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: block
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: pass
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: no-wildcard
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: wildcard
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: block
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: pass
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: block
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: pass
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: block-pod
- name: step-02
try:
- apply:

View file

@ -1,10 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: block-pod
spec: {}
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,8 +4,7 @@ metadata:
name: apicall-correct
spec:
steps:
- name: scenario
try:
- try:
- apply:
file: namespace.yaml
- apply:
@ -14,12 +13,23 @@ spec:
file: gctxentry.yaml
- sleep:
duration: 3s
- apply:
file: clusterpolicy.yaml
- name: create policy
use:
template: ../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: cpol-apicall-correct
- try:
- sleep:
duration: 3s
- assert:
file: clusterpolicy-ready.yaml
- apply:
file: new-deployment.yaml
- assert:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: cpol-apicall-correct
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -14,12 +14,21 @@ spec:
file: gctxentry.yaml
- sleep:
duration: 3s
- apply:
file: clusterpolicy.yaml
- sleep:
duration: 3s
- assert:
file: clusterpolicy-ready.yaml
- name: create policy
use:
template: ../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: cpol-not-ready
- try:
- delete:
ref:
apiVersion: kyverno.io/v2alpha1
@ -28,7 +37,7 @@ spec:
- sleep:
duration: 3s
- assert:
file: clusterpolicy-failed.yaml
file: policy-failed.yaml
- apply:
file: new-deployment.yaml
- assert:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: cpol-not-ready
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -1,7 +1,7 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: resource-correct
name: cpol-resource-correct
spec:
steps:
- name: scenario
@ -14,12 +14,21 @@ spec:
file: gctxentry.yaml
- sleep:
duration: 3s
- apply:
file: clusterpolicy.yaml
- sleep:
duration: 3s
- assert:
file: clusterpolicy-ready.yaml
- name: create policy
use:
template: ../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: cpol-resource-correct
- try:
- apply:
file: new-deployment.yaml
- assert:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: cpol-resource-correct
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: background-variables-update
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: background-variables-update
- name: step-02
try:
- apply:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: background-variables-update
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,12 +4,20 @@ metadata:
name: policy-exceptions-disabled
spec:
steps:
- name: step-00
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: create policy
use:
template: ../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: require-app-label
- name: step-01
try:
- apply:

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: require-app-label
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,7 +4,17 @@ metadata:
name: schema-validation-crd
spec:
steps:
- name: step-01
try:
- apply:
file: chainsaw-step-01-apply-1.yaml
- name: create policy
use:
template: ../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: mutate-xteam-namespace-scoped-crds

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: mutate-xteam-namespace-scoped-crds
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready

View file

@ -4,9 +4,17 @@ metadata:
name: success
spec:
steps:
- name: step-01
try:
- apply:
file: policy-1.yaml
- assert:
file: policy-1-assert.yaml
- name: create policy
use:
template: ../../../_step-templates/create-policy.yaml
with:
bindings:
- name: file
value: policy.yaml
- name: wait policy ready
use:
template: ../../../_step-templates/cluster-policy-ready.yaml
with:
bindings:
- name: name
value: vault-init-injector

View file

@ -1,9 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: vault-init-injector
status:
conditions:
- reason: Succeeded
status: "True"
type: Ready