mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-10 18:06:55 +00:00
* fix: return policies with either audit or enforce rules from the cache Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> * feat: introduce validationFailureAction under verifyImage rules Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> * feat: add chainsaw tests Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> * fix Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> --------- Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com>
34 lines
1 KiB
YAML
Executable file
34 lines
1 KiB
YAML
Executable file
apiVersion: chainsaw.kyverno.io/v1alpha1
|
|
kind: Test
|
|
metadata:
|
|
creationTimestamp: null
|
|
name: restrict-image-registries
|
|
spec:
|
|
steps:
|
|
- name: step-01
|
|
try:
|
|
- apply:
|
|
file: policy.yaml
|
|
- assert:
|
|
file: policy-assert.yaml
|
|
- name: step-02
|
|
try:
|
|
- script:
|
|
content: kubectl run nginx-1 --image nginx
|
|
check:
|
|
($error != null): true
|
|
(contains($stderr, 'rule validate-registries failed at path /spec/containers/0/image/')): true
|
|
- name: step-03
|
|
try:
|
|
- script:
|
|
content: kubectl create deployment testing --image=nginx --replicas=1
|
|
check:
|
|
($error != null): true
|
|
(contains($stderr, 'rule autogen-validate-registries failed at path /spec/template/spec/containers/0/image/')): true
|
|
- name: step-04
|
|
try:
|
|
- script:
|
|
content: kubectl create cronjob my-job --image=busybox --schedule="*/1 * * * *"
|
|
check:
|
|
($error != null): true
|
|
(contains($stderr, 'rule autogen-cronjob-validate-registries failed')): true
|