From 877d2ee20fa64cc708f9d05d4ef3e44244a94913 Mon Sep 17 00:00:00 2001 From: Jim Bugwadia Date: Wed, 28 Aug 2024 11:16:20 -0700 Subject: [PATCH] add pod status wait instead of sleeps Signed-off-by: Jim Bugwadia --- .../.chainsaw-test/chainsaw-test.yaml | 10 ++++++++++ .../.chainsaw-test/chainsaw-test.yaml | 13 +++++++++---- .../.chainsaw-test/deployment.yaml | 6 +++--- .../.chainsaw-test/chainsaw-step-02-apply-1.yaml | 2 +- .../.chainsaw-test/chainsaw-step-02-apply-2.yaml | 2 +- .../.chainsaw-test/chainsaw-step-02-apply-3.yaml | 2 +- .../.chainsaw-test/chainsaw-step-02-apply-4.yaml | 2 +- .../.chainsaw-test/chainsaw-test.yaml | 11 +++++++++-- 8 files changed, 35 insertions(+), 13 deletions(-) diff --git a/other/audit-event-on-exec/.chainsaw-test/chainsaw-test.yaml b/other/audit-event-on-exec/.chainsaw-test/chainsaw-test.yaml index 4630f1939..8854bd09e 100755 --- a/other/audit-event-on-exec/.chainsaw-test/chainsaw-test.yaml +++ b/other/audit-event-on-exec/.chainsaw-test/chainsaw-test.yaml @@ -22,6 +22,16 @@ spec: file: ns.yaml - apply: file: pod.yaml + - wait: + apiVersion: v1 + kind: Pod + name: execevent-pod + namespace: exec-event-ns + timeout: 1m + for: + condition: + name: Ready + value: 'true' - name: step-03 try: - sleep: diff --git a/other/refresh-env-var-in-pod/.chainsaw-test/chainsaw-test.yaml b/other/refresh-env-var-in-pod/.chainsaw-test/chainsaw-test.yaml index a1179a8a9..7a1c2c053 100755 --- a/other/refresh-env-var-in-pod/.chainsaw-test/chainsaw-test.yaml +++ b/other/refresh-env-var-in-pod/.chainsaw-test/chainsaw-test.yaml @@ -24,10 +24,15 @@ spec: try: - apply: file: deployment.yaml - - name: step-03 - try: - - sleep: - duration: 5s + - wait: + apiVersion: v1 + kind: Pod + namespace: refresh-env-var-ns + timeout: 1m + for: + condition: + name: Ready + value: 'true' - script: content: | kubectl get pod -n refresh-env-var-ns --no-headers | awk '{print $1}' > deploy-names.txt diff --git a/other/refresh-env-var-in-pod/.chainsaw-test/deployment.yaml b/other/refresh-env-var-in-pod/.chainsaw-test/deployment.yaml index 140d7c428..3eee27819 100644 --- a/other/refresh-env-var-in-pod/.chainsaw-test/deployment.yaml +++ b/other/refresh-env-var-in-pod/.chainsaw-test/deployment.yaml @@ -16,7 +16,7 @@ spec: app: busybox spec: containers: - - image: busybox:1.35 + - image: ghcr.io/kyverno/test-busybox:1.35 name: busybox command: ["sleep", "3600"] env: @@ -46,7 +46,7 @@ spec: app: busybox spec: containers: - - image: busybox:1.35 + - image: ghcr.io/kyverno/test-busybox:1.35 name: busybox command: ["sleep", "3600"] env: @@ -76,7 +76,7 @@ spec: app: busybox spec: containers: - - image: busybox:1.35 + - image: ghcr.io/kyverno/test-busybox:1.35 name: busybox command: ["sleep", "3600"] env: diff --git a/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-1.yaml b/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-1.yaml index 857fc959f..b9d102037 100755 --- a/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-1.yaml +++ b/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-1.yaml @@ -8,7 +8,7 @@ spec: - command: - sleep - "3600" - image: busybox:1.35 + image: ghcr.io/kyverno/test-busybox:1.35 name: busybox volumeMounts: - mountPath: /mnt/foo diff --git a/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-2.yaml b/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-2.yaml index 6e17ab4d8..cef4c1c31 100755 --- a/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-2.yaml +++ b/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-2.yaml @@ -10,7 +10,7 @@ spec: - command: - sleep - "3600" - image: busybox:1.35 + image: ghcr.io/kyverno/test-busybox:1.35 name: busybox volumeMounts: - mountPath: /mnt/foo diff --git a/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-3.yaml b/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-3.yaml index 75a6b7962..f4944faff 100755 --- a/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-3.yaml +++ b/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-3.yaml @@ -10,5 +10,5 @@ spec: - command: - sleep - "3600" - image: busybox:1.35 + image: ghcr.io/kyverno/test-busybox:1.35 name: busybox diff --git a/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-4.yaml b/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-4.yaml index 9f2145567..d41231001 100755 --- a/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-4.yaml +++ b/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-step-02-apply-4.yaml @@ -10,7 +10,7 @@ spec: - command: - sleep - "3600" - image: busybox:1.35 + image: ghcr.io/kyverno/test-busybox:1.35 name: busybox volumeMounts: - mountPath: /mnt/foo diff --git a/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-test.yaml b/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-test.yaml index 8c6fcc342..50337a3de 100755 --- a/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-test.yaml +++ b/other/refresh-volumes-in-pods/.chainsaw-test/chainsaw-test.yaml @@ -38,8 +38,15 @@ spec: file: chainsaw-step-03-apply-2.yaml - name: step-04 try: - - sleep: - duration: 5s + - wait: + apiVersion: v1 + kind: Pod + namespace: refresh-vols-ns + timeout: 1m + for: + condition: + name: Ready + value: 'true' - script: content: | annotation=$(kubectl get pod pod01 -n refresh-vols-ns -o json | kyverno jp query "metadata.annotations.\"corp.org/random\" || '' " | tail -n 1 | cut -d '"' -f 2)