From 0b63c36714dd28455753120c3ca3290c2b0000fd Mon Sep 17 00:00:00 2001 From: rksharma95 Date: Thu, 26 Dec 2024 14:33:00 +0530 Subject: [PATCH] use rollout status to check if kubearmor has deployed Signed-off-by: rksharma95 --- .github/workflows/ci-latest-release.yml | 7 +++--- .github/workflows/ci-test-controllers.yml | 30 ++++------------------- .github/workflows/ci-test-ginkgo.yml | 6 +++-- .github/workflows/ci-test-ubi-image.yml | 6 +++-- 4 files changed, 17 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci-latest-release.yml b/.github/workflows/ci-latest-release.yml index 2c414dfb73..41e3a08518 100644 --- a/.github/workflows/ci-latest-release.yml +++ b/.github/workflows/ci-latest-release.yml @@ -101,9 +101,10 @@ jobs: sed -i '/image: kubearmor\/kubearmor-controller:latest/!{/image: kubearmor\/kubearmor-relay-server:latest/!s/latest/${{ steps.vars.outputs.tag }}/g}' pkg/KubeArmorOperator/config/samples/kubearmor-test.yaml fi kubectl apply -f pkg/KubeArmorOperator/config/samples/kubearmor-test.yaml - kubectl wait -n kubearmor --timeout=5m --for=jsonpath='{.status.phase}'=Running kubearmorconfigs/kubearmorconfig-test - kubectl wait --timeout=7m --for=condition=ready pod -l kubearmor-app,kubearmor-app!=kubearmor-snitch,kubearmor-app!=kubearmor-controller -n kubearmor - kubectl wait --timeout=1m --for=condition=ready pod -l kubearmor-app=kubearmor-controller -n kubearmor + kubectl rollout status deployment -n kubearmor -l kubearmor-app=kubearmor-relay -n kubearmor + kubectl rollout status daemonset -l kubearmor-app=kubearmor -n kubearmor + kubectl rollout status deployment -l kubearmor-app=kubearmor-controller -n kubearmor + kubectl wait --timeout=1m --for=condition=ready pod -l kubearmor-app,kubearmor-app!=kubearmor-snitch -n kubearmor kubectl get pods -A - name: Test KubeArmor using Ginkgo diff --git a/.github/workflows/ci-test-controllers.yml b/.github/workflows/ci-test-controllers.yml index 9a8ff3b1fa..114b8086b1 100644 --- a/.github/workflows/ci-test-controllers.yml +++ b/.github/workflows/ci-test-controllers.yml @@ -87,31 +87,11 @@ jobs: kubectl apply -f - fi kubectl wait -n kubearmor --timeout=5m --for=jsonpath='{.status.phase}'=Running kubearmorconfigs/kubearmorconfig-test - timeout 7m bash -c -- ' - while true; do - all_running=true - echo "Checking pod status..." - for pod_status in $(kubectl get pod -n kubearmor -l kubearmor-app,kubearmor-app!=kubearmor-snitch --output=jsonpath="{.items[*].status.phase}" 2>/dev/null); do - if [ "$pod_status" != "Running" ]; then - all_running=false - echo "Waiting for pods to be Running..." - break - fi - done - - if $all_running; then - echo "All pods are Running." - break - fi - - if kubectl get pod -n kubearmor -l kubearmor-app,kubearmor-app!=kubearmor-snitch | grep CrashLoopBackOff; then - echo "Error: Pod in CrashLoopBackOff state" - exit 1 - fi - - sleep 1 - done - ' + kubectl rollout status deployment -n kubearmor -l kubearmor-app=kubearmor-relay -n kubearmor + kubectl rollout status daemonset -l kubearmor-app=kubearmor -n kubearmor + kubectl rollout status deployment -l kubearmor-app=kubearmor-controller -n kubearmor + kubectl wait --timeout=1m --for=condition=ready pod -l kubearmor-app,kubearmor-app!=kubearmor-snitch -n kubearmor + kubectl get pods -A - name: Test KubeArmor using Ginkgo run: | diff --git a/.github/workflows/ci-test-ginkgo.yml b/.github/workflows/ci-test-ginkgo.yml index 6b1752963b..a2a6040919 100644 --- a/.github/workflows/ci-test-ginkgo.yml +++ b/.github/workflows/ci-test-ginkgo.yml @@ -123,8 +123,10 @@ jobs: fi kubectl wait -n kubearmor --timeout=5m --for=jsonpath='{.status.phase}'=Running kubearmorconfigs/kubearmorconfig-test - kubectl wait --timeout=7m --for=condition=ready pod -l kubearmor-app,kubearmor-app!=kubearmor-snitch,kubearmor-app!=kubearmor-controller -n kubearmor - kubectl wait --timeout=1m --for=condition=ready pod -l kubearmor-app=kubearmor-controller -n kubearmor + kubectl rollout status deployment -n kubearmor -l kubearmor-app=kubearmor-relay -n kubearmor + kubectl rollout status daemonset -l kubearmor-app=kubearmor -n kubearmor + kubectl rollout status deployment -l kubearmor-app=kubearmor-controller -n kubearmor + kubectl wait --timeout=1m --for=condition=ready pod -l kubearmor-app,kubearmor-app!=kubearmor-snitch -n kubearmor kubectl get pods -A sleep 10 diff --git a/.github/workflows/ci-test-ubi-image.yml b/.github/workflows/ci-test-ubi-image.yml index a1ea9594b2..6d66ccd6c6 100644 --- a/.github/workflows/ci-test-ubi-image.yml +++ b/.github/workflows/ci-test-ubi-image.yml @@ -101,8 +101,10 @@ jobs: fi kubectl wait -n kubearmor --timeout=5m --for=jsonpath='{.status.phase}'=Running kubearmorconfigs/kubearmorconfig-test - kubectl wait --timeout=7m --for=condition=ready pod -l kubearmor-app,kubearmor-app!=kubearmor-snitch,kubearmor-app!=kubearmor-controller -n kubearmor - kubectl wait --timeout=1m --for=condition=ready pod -l kubearmor-app=kubearmor-controller -n kubearmor + kubectl rollout status deployment -n kubearmor -l kubearmor-app=kubearmor-relay -n kubearmor + kubectl rollout status daemonset -l kubearmor-app=kubearmor -n kubearmor + kubectl rollout status deployment -l kubearmor-app=kubearmor-controller -n kubearmor + kubectl wait --timeout=1m --for=condition=ready pod -l kubearmor-app,kubearmor-app!=kubearmor-snitch -n kubearmor kubectl get pods -A - name: Operator may take upto 10 sec to enable TLS, Sleep for 15Sec