Skip to content

Commit

Permalink
fix chainsaw tests
Browse files Browse the repository at this point in the history
Signed-off-by: Mariam Fahmy <[email protected]>
  • Loading branch information
MariamFahmy98 committed Jan 2, 2024
1 parent d926f21 commit 81b5e22
Show file tree
Hide file tree
Showing 30 changed files with 207 additions and 155 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: disallow-capabilities-strict
spec:
steps:
- name: step-01
try:
- script:
content: |
sed 's/validationFailureAction: Audit/validationFailureAction: Enforce/' ../disallow-capabilities-strict.yaml | kubectl create -f -
- assert:
file: ../../../../pod-security/restricted/disallow-capabilities-strict/.chainsaw-test/chainsaw-step-01-assert-1.yaml
- name: step-02
try:
- apply:
file: ../../../../pod-security/restricted/disallow-capabilities-strict/.chainsaw-test/pod-good.yaml
- apply:
expect:
- check:
($error != null): true
file: ../../../../pod-security/restricted/disallow-capabilities-strict/.chainsaw-test/pod-bad.yaml
- apply:
file: ../../../../pod-security/restricted/disallow-capabilities-strict/.chainsaw-test/podcontroller-good.yaml
- apply:
expect:
- check:
($error != null): true
file: ../../../../pod-security/restricted/disallow-capabilities-strict/.chainsaw-test/podcontroller-bad.yaml
- name: step-99
try:
- delete:
ref:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
name: disallow-capabilities-strict
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: Test
metadata:
name: disallow-capabilities-strict
policies:
- disallow-capabilities-strict.yaml
- ../disallow-capabilities-strict.yaml
resources:
- ../../../pod-security/restricted/disallow-capabilities-strict/resource.yaml
- ../../../../pod-security/restricted/disallow-capabilities-strict/.kyverno-test/resource.yaml
results:
- kind: CronJob
policy: disallow-capabilities-strict
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: disallow-privilege-escalation
spec:
steps:
- name: step-01
try:
- script:
content: |
sed 's/validationFailureAction: Audit/validationFailureAction: Enforce/' ../disallow-privilege-escalation.yaml | kubectl create -f -
- assert:
file: ../../../../pod-security/restricted/disallow-privilege-escalation/.chainsaw-test/chainsaw-step-01-assert-1.yaml
- name: step-02
try:
- apply:
file: ../../../../pod-security/restricted/disallow-privilege-escalation/.chainsaw-test/pod-good.yaml
- apply:
expect:
- check:
($error != null): true
file: ../../../../pod-security/restricted/disallow-privilege-escalation/.chainsaw-test/pod-bad.yaml
- apply:
file: ../../../../pod-security/restricted/disallow-privilege-escalation/.chainsaw-test/podcontroller-good.yaml
- apply:
expect:
- check:
($error != null): true
file: ../../../../pod-security/restricted/disallow-privilege-escalation/.chainsaw-test/podcontroller-bad.yaml
- name: step-99
try:
- delete:
ref:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
name: disallow-privilege-escalation
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: Test
metadata:
name: disallow-privilege-escalation
policies:
- disallow-privilege-escalation.yaml
- ../disallow-privilege-escalation.yaml
resources:
- ../../../pod-security/restricted/disallow-privilege-escalation/resource.yaml
- ../../../../pod-security/restricted/disallow-privilege-escalation/.kyverno-test/resource.yaml
results:
- kind: CronJob
policy: disallow-privilege-escalation
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: require-run-as-non-root-user
spec:
steps:
- name: step-01
try:
- script:
content: |
sed 's/validationFailureAction: Audit/validationFailureAction: Enforce/' ../require-run-as-non-root-user.yaml | kubectl create -f -
- assert:
file: ../../../../pod-security/restricted/require-run-as-non-root-user/.chainsaw-test/chainsaw-step-01-assert-1.yaml
- name: step-02
try:
- apply:
file: ../../../../pod-security/restricted/require-run-as-non-root-user/.chainsaw-test/pod-good.yaml
- apply:
expect:
- check:
($error != null): true
file: ../../../../pod-security/restricted/require-run-as-non-root-user/.chainsaw-test/pod-bad.yaml
- apply:
file: ../../../../pod-security/restricted/require-run-as-non-root-user/.chainsaw-test/podcontroller-good.yaml
- apply:
expect:
- check:
($error != null): true
file: ../../../../pod-security/restricted/require-run-as-non-root-user/.chainsaw-test/podcontroller-bad.yaml
- name: step-99
try:
- delete:
ref:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
name: require-run-as-non-root-user
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: Test
metadata:
name: require-run-as-non-root-user
policies:
- require-run-as-non-root-user.yaml
- ../require-run-as-non-root-user.yaml
resources:
- ../../../pod-security/restricted/require-run-as-non-root-user/resource.yaml
- ../../../../pod-security/restricted/require-run-as-non-root-user/.kyverno-test/resource.yaml
results:
- kind: CronJob
policy: require-run-as-non-root-user
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: restrict-seccomp-strict
spec:
steps:
- name: step-01
try:
- script:
content: |
sed 's/validationFailureAction: Audit/validationFailureAction: Enforce/' ../restrict-seccomp-strict.yaml | kubectl create -f -
- assert:
file: ../../../../pod-security/restricted/restrict-seccomp-strict/.chainsaw-test/chainsaw-step-01-assert-1.yaml
- name: step-02
try:
- apply:
file: ../../../../pod-security/restricted/restrict-seccomp-strict/.chainsaw-test/pod-good.yaml
- apply:
expect:
- check:
($error != null): true
file: ../../../../pod-security/restricted/restrict-seccomp-strict/.chainsaw-test/pod-bad.yaml
- apply:
file: ../../../../pod-security/restricted/restrict-seccomp-strict/.chainsaw-test/podcontroller-good.yaml
- apply:
expect:
- check:
($error != null): true
file: ../../../../pod-security/restricted/restrict-seccomp-strict/.chainsaw-test/podcontroller-bad.yaml
- name: step-99
try:
- delete:
ref:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
name: restrict-seccomp-strict
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: Test
metadata:
name: restrict-seccomp-strict
policies:
- restrict-seccomp-strict.yaml
- ../restrict-seccomp-strict.yaml
resources:
- ../../../pod-security/restricted/restrict-seccomp-strict/resource.yaml
- ../../../../pod-security/restricted/restrict-seccomp-strict/.kyverno-test/resource.yaml
results:
- kind: CronJob
policy: restrict-seccomp-strict
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: restrict-volume-types
spec:
steps:
- name: step-01
try:
- apply:
file: ns.yaml
- script:
content: |
sed 's/validationFailureAction: Audit/validationFailureAction: Enforce/' ../restrict-volume-types.yaml | kubectl create -f -
- assert:
file: ../../../../pod-security/restricted/restrict-volume-types/.chainsaw-test/chainsaw-step-01-assert-1.yaml
- name: step-02
try:
- apply:
file: ../../../../pod-security/restricted/restrict-volume-types/.chainsaw-test/pod-good.yaml
- apply:
expect:
- check:
($error != null): true
file: ../../../../pod-security/restricted/restrict-volume-types/.chainsaw-test/pod-bad.yaml
- apply:
file: ../../../../pod-security/restricted/restrict-volume-types/.chainsaw-test/podcontroller-good.yaml
- apply:
expect:
- check:
($error != null): true
file: ../../../../pod-security/restricted/restrict-volume-types/.chainsaw-test/podcontroller-bad.yaml
- name: step-99
try:
- delete:
ref:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
name: restrict-volume-types
- command:
args:
- delete
- all
- --all
- --force
- --grace-period=0
- -n
- restrict-voltypes-ns
entrypoint: kubectl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: Test
metadata:
name: restrict-volume-types
policies:
- restrict-volume-types.yaml
- ../restrict-volume-types.yaml
resources:
- ../../../pod-security/restricted/restrict-volume-types/resource.yaml
- ../../../../pod-security/restricted/restrict-volume-types/.kyverno-test/resource.yaml
results:
- kind: CronJob
policy: restrict-volume-types
Expand Down

This file was deleted.

Loading

0 comments on commit 81b5e22

Please sign in to comment.