-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Darkhood148 <ujjwal.sharma9999999@gmail.com>
- Loading branch information
1 parent
bee6e4d
commit af49548
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
other/mount-volumes-for-ephemeral-containers/.chainsaw-test/chainsaw-test.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,55 @@ | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
creationTimestamp: null | ||
name: mount-volumes-for-ephemeral-containers | ||
spec: | ||
timeouts: | ||
cleanup: 60s | ||
steps: | ||
- name: step-01 | ||
try: | ||
- apply: | ||
file: ../mount-volumes-for-ephemeral-containers.yaml | ||
- assert: | ||
file: policy-ready.yaml | ||
- name: step-02 | ||
try: | ||
- apply: | ||
file: pods.yaml | ||
- assert: | ||
resource: | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: pod1 | ||
namespace: default | ||
labels: | ||
ephemeral-debug: "true" | ||
spec: | ||
(volumes[?name == 'ephemeralcontainer-tmp-tcpdump-volume']): | ||
- emptyDir: | ||
sizeLimit: 1G | ||
- name: step-03 | ||
try: | ||
- script: | ||
content: kubectl debug -it pod1 --image=busybox:1.35 --target=busybox -c pod1-doo -- touch myfile.txt; if test -e myfile.txt; then echo "File created"; else echo "File not created"; fi | ||
check: | ||
(contains($stdout, 'File not created')): true | ||
- name: step-04 | ||
try: | ||
- assert: | ||
resource: | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: pod1 | ||
namespace: default | ||
labels: | ||
ephemeral-debug: "true" | ||
spec: | ||
ephemeralContainers: | ||
- name: pod1-doo | ||
volumeMounts: | ||
- mountPath: /tmp | ||
name: ephemeralcontainer-tmp-tcpdump-volume |
12 changes: 12 additions & 0 deletions
12
other/mount-volumes-for-ephemeral-containers/.chainsaw-test/pods.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,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: pod1 | ||
namespace: default | ||
labels: | ||
ephemeral-debug: "true" | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
command: ["sh", "-c", "while true; do sleep 3600; done"] |
9 changes: 9 additions & 0 deletions
9
other/mount-volumes-for-ephemeral-containers/.chainsaw-test/policy-ready.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,9 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: mount-volumes-for-ephemeral-containers | ||
status: | ||
conditions: | ||
- reason: Succeeded | ||
status: "True" | ||
type: Ready |