From 15ffbeb36cb5188269d7a8658eac597a1875e9e2 Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Fri, 5 Apr 2024 12:46:30 -0600 Subject: [PATCH] clean: ensure cephcluster cleanup job runs The cleanup policy was not allowed to take effect during the cluster cleanup. The finalizer was immediately be removed instead of remaining until the operator has a chance to handle the cleanup policy and internally remove the finalizer. Now the cleanup policy is allowed to be applied and the cleanup job(s) will be started to cleanup the host path and disks from OSDs. Signed-off-by: Travis Nielsen --- .github/workflows/go-test.yaml | 5 ++++- pkg/crds/crds.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go-test.yaml b/.github/workflows/go-test.yaml index 9a2ffb19..1346dfc9 100644 --- a/.github/workflows/go-test.yaml +++ b/.github/workflows/go-test.yaml @@ -323,7 +323,10 @@ jobs: set -ex kubectl rook-ceph --operator-namespace test-operator -n test-cluster destroy-cluster sleep 1 - kubectl get deployments -n test-cluster --no-headers| wc -l | (read n && [ $n -le 1 ] || { echo "the crs could not be deleted"; kubectl get all -n test-cluster; exit 1;}) + kubectl -n test-cluster get deployments --no-headers| wc -l | (read n && [ $n -le 1 ] || { echo "the crs could not be deleted"; kubectl get all -n test-cluster; exit 1;}) + sleep 5 + node_name=$(kubectl get node --no-headers | awk '{print $1}') + kubectl -n test-cluster get pod -l job-name=cluster-cleanup-job-${node_name} --no-headers | grep Completed || { echo "cluster cleanup job not found or failed"; kubectl get all -n test-cluster; exit 1;} - name: collect common logs if: always() diff --git a/pkg/crds/crds.go b/pkg/crds/crds.go index 5cf066b6..3f61dee3 100644 --- a/pkg/crds/crds.go +++ b/pkg/crds/crds.go @@ -166,6 +166,8 @@ func updatingFinalizers(ctx context.Context, clientsets k8sutil.ClientsetsInterf if err != nil { return err } + logging.Info("Added cleanup policy to the cephcluster CR %q", resource) + return nil } jsonPatchData, _ := json.Marshal(DefaultResourceRemoveFinalizers)