From 51ea48fca3e462eddcabf579233228a244613fc5 Mon Sep 17 00:00:00 2001 From: Javier Date: Wed, 13 Dec 2023 10:21:05 -0600 Subject: [PATCH] commands: update for logging Signed-off-by: Javier --- pkg/crds/crds.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pkg/crds/crds.go b/pkg/crds/crds.go index 07a975be..cb73cd70 100644 --- a/pkg/crds/crds.go +++ b/pkg/crds/crds.go @@ -162,10 +162,10 @@ func deleteCustomResources(ctx context.Context, clientsets k8sutil.ClientsetsInt func updatingFinalizers(ctx context.Context, clientsets k8sutil.ClientsetsInterface, itemResource *unstructured.Unstructured, resource, clusterNamespace string) error { patch := defaultResourceRemoveFinalizers - //if resource == "cephclusters" { - logging.Info("Applying PATCH to %s", resource) - patch = clusterResourcePatchFinalizer - //} + if resource == "cephclusters" { + logging.Info("Applying PATCH to %s", resource) + patch = clusterResourcePatchFinalizer + } jsonPatchData, _ := json.Marshal(patch) @@ -180,6 +180,8 @@ func ensureClusterIsEmpty(ctx context.Context, k8sClientSet kubernetes.Interface logging.Info("waiting to clean up resources") logging.Info("awaiting") time.Sleep(10 * time.Second) + i := 0 + for { pods, err := k8sClientSet.CoreV1().Pods(clusterNamespace).List(ctx, v1.ListOptions{LabelSelector: "rook_cluster=" + clusterNamespace}) if err != nil { @@ -199,6 +201,11 @@ func ensureClusterIsEmpty(ctx context.Context, k8sClientSet kubernetes.Interface } } time.Sleep(10 * time.Second) - log.Fatalln("die by taking a lot of time") + if i == 20 { + log.Fatalln("die by taking a lot of time") + } + i++ } + logging.Info("is worked good") + }