Skip to content

Commit

Permalink
commands: update for logging
Browse files Browse the repository at this point in the history
Signed-off-by: Javier <[email protected]>
  • Loading branch information
Javier committed Dec 13, 2023
1 parent 50cc230 commit 51ea48f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions pkg/crds/crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 {
Expand All @@ -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")

}

0 comments on commit 51ea48f

Please sign in to comment.