-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added kuttl tests for kyverno 1.10 * updated e2e workflow yaml Updated the license key in the helm command Added Kuttl e2e tests for best practices policy Updated the kuttl test yaml files Updated the resource yaml Kyverno 1.10 policy updates (#79) * Update policies to use Kyverno 1.10 * Update Kyverno version annotation * Update Kyverno annotation and e2e tests Co-authored-by: sathyaseelan <[email protected]>
- Loading branch information
1 parent
dd2b50e
commit 4a1ed5d
Showing
25 changed files
with
340 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
charts/best-practices-workload-security/templates/e2e/01-policy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
apply: | ||
- ../restrict_image_registries.yaml | ||
assert: | ||
- policy-assert.yaml |
5 changes: 5 additions & 0 deletions
5
charts/best-practices-workload-security/templates/e2e/02-enforce.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: | | ||
sed 's/validationFailureAction: audit/validationFailureAction: Enforce/' ../restrict_image_registries.yaml | kubectl apply -f - |
11 changes: 11 additions & 0 deletions
11
charts/best-practices-workload-security/templates/e2e/03-enforce-policy-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: restrict-image-registries | ||
spec: | ||
validationFailureAction: enforce | ||
status: | ||
conditions: | ||
- reason: Succeeded | ||
status: "True" | ||
type: Ready |
15 changes: 15 additions & 0 deletions
15
charts/best-practices-workload-security/templates/e2e/04-manifests.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
apply: | ||
- file: good-pods.yaml | ||
shouldFail: false | ||
- file: good-podcontrollers.yaml | ||
shouldFail: false | ||
- file: bad-pod-noregistry.yaml | ||
shouldFail: true | ||
- file: bad-pod-notall.yaml | ||
shouldFail: true | ||
- file: bad-pod-false.yaml | ||
shouldFail: true | ||
- file: bad-podcontrollers.yaml | ||
shouldFail: true |
4 changes: 4 additions & 0 deletions
4
charts/best-practices-workload-security/templates/e2e/05-ephemeral.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: if kubectl debug -it goodpod02-registry --image=busybox:1.35 --target=k8s-nginx -n ir-pods-namespace; then exit 1; else exit 0; fi; |
6 changes: 6 additions & 0 deletions
6
charts/best-practices-workload-security/templates/e2e/98-delete.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- command: kubectl delete deployments --all --force --grace-period=0 -n ir-pods-namespace | ||
- command: kubectl delete pods --all --force --grace-period=0 -n ir-pods-namespace | ||
- command: kubectl delete cronjobs --all --force --grace-period=0 -n ir-pods-namespace |
6 changes: 6 additions & 0 deletions
6
charts/best-practices-workload-security/templates/e2e/99-delete.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
delete: | ||
- apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
name: restrict-image-registries |
8 changes: 8 additions & 0 deletions
8
charts/best-practices-workload-security/templates/e2e/bad-pod-false.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: badpod01-registry | ||
spec: | ||
containers: | ||
- name: k8s-nginx | ||
image: registry.k8s.io/nginx:1.7.9 |
8 changes: 8 additions & 0 deletions
8
charts/best-practices-workload-security/templates/e2e/bad-pod-noregistry.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: badpod04-registry | ||
spec: | ||
containers: | ||
- name: k8s-nginx | ||
image: nginx |
21 changes: 21 additions & 0 deletions
21
charts/best-practices-workload-security/templates/e2e/bad-pod-notall.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: badpod02-registry | ||
spec: | ||
containers: | ||
- name: k8s-nginx | ||
image: registry.k8s.io/nginx:1.7.9 | ||
- name: busybox | ||
image: bar.io/busybox | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: badpod03-registry | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: eu.foo.io/busybox | ||
- name: k8s-nginx | ||
image: registry.k8s.io/nginx:1.7.9 |
140 changes: 140 additions & 0 deletions
140
charts/best-practices-workload-security/templates/e2e/bad-podcontrollers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: reqro-baddeployment01 | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: app | ||
template: | ||
metadata: | ||
labels: | ||
foo: bar | ||
spec: | ||
initContainers: | ||
- name: k8s-nginx-init | ||
image: bar.io/nginx | ||
- name: busybox-init | ||
image: busybox | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
- name: k8s-nginx | ||
image: bar.io/nginx | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: reqro-baddeployment02 | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: app | ||
template: | ||
metadata: | ||
labels: | ||
foo: bar | ||
spec: | ||
initContainers: | ||
- name: k8s-nginx-init | ||
image: bar.io/nginx | ||
- name: nginx-init | ||
image: eu.foo.io/nginx | ||
containers: | ||
- name: k8s-nginx | ||
image: bar.io/nginx | ||
- name: busybox | ||
image: busybox:1.35 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: reqro-baddeployment03 | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: app | ||
template: | ||
metadata: | ||
labels: | ||
foo: bar | ||
spec: | ||
initContainers: | ||
- name: k8s-nginx-init | ||
image: bar.io/nginx | ||
- name: busybox-init | ||
image: busybox:1.35 | ||
containers: | ||
- name: k8s-nginx | ||
image: bar.io/nginx | ||
- name: nginx | ||
image: eu.foo.io/nginx | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: reqro-badcronjob01 | ||
spec: | ||
schedule: "*/1 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
initContainers: | ||
- name: k8s-nginx-init | ||
image: bar.io/nginx | ||
- name: busybox-init | ||
image: busybox | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
- name: k8s-nginx | ||
image: bar.io/nginx | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: reqro-badcronjob02 | ||
spec: | ||
schedule: "*/1 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
initContainers: | ||
- name: k8s-nginx-init | ||
image: bar.io/nginx | ||
- name: nginx-init | ||
image: eu.foo.io/nginx | ||
containers: | ||
- name: k8s-nginx | ||
image: bar.io/nginx | ||
- name: busybox | ||
image: busybox:1.35 | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: reqro-badcronjob03 | ||
spec: | ||
schedule: "*/1 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
initContainers: | ||
- name: k8s-nginx-init | ||
image: bar.io/nginx | ||
- name: busybox-init | ||
image: busybox:1.35 | ||
containers: | ||
- name: k8s-nginx | ||
image: bar.io/nginx | ||
- name: nginx | ||
image: eu.foo.io/nginx |
48 changes: 48 additions & 0 deletions
48
charts/best-practices-workload-security/templates/e2e/good-podcontrollers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: reqro-gooddeployment01 | ||
namespace: ir-pods-namespace | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
foo: bar | ||
template: | ||
metadata: | ||
labels: | ||
foo: bar | ||
spec: | ||
initContainers: | ||
- name: k8s-nginx-init | ||
image: bar.io/nginx | ||
- name: busybox-init | ||
image: eu.foo.io/busybox | ||
containers: | ||
- name: busybox | ||
image: eu.foo.io/nginx | ||
- name: k8s-nginx | ||
image: bar.io/nginx | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: reqprobes-goodcronjob01 | ||
namespace: ir-pods-namespace | ||
spec: | ||
schedule: "*/1 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
initContainers: | ||
- name: k8s-nginx-init | ||
image: bar.io/nginx | ||
- name: busybox-init | ||
image: eu.foo.io/busybox | ||
containers: | ||
- name: busybox | ||
image: eu.foo.io/nginx | ||
- name: k8s-nginx | ||
image: bar.io/nginx |
Oops, something went wrong.