From d21712cc020c59d8b3f26a71b61b1b8b140fd618 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 17 Aug 2023 14:45:08 +0800 Subject: [PATCH] chores: add pod deletion logs --- controllers/resources/bentorequest_controller.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/resources/bentorequest_controller.go b/controllers/resources/bentorequest_controller.go index 1d4afa8..4ab2ed0 100644 --- a/controllers/resources/bentorequest_controller.go +++ b/controllers/resources/bentorequest_controller.go @@ -282,6 +282,7 @@ func (r *BentoRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request oldHash := pod_.Annotations[KubeAnnotationBentoRequestHash] if oldHash != hashStr { + logs.Info("Because hash changed, delete old pod", "pod", pod_.Name, "oldHash", oldHash, "newHash", hashStr) err = r.Delete(ctx, &pod_) if err != nil { err = errors.Wrapf(err, "delete pod %s", pod_.Name) @@ -303,6 +304,7 @@ func (r *BentoRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request if len(reservedPods) > 1 { for _, pod_ := range reservedPods[1:] { + logs.Info("Because has more than one pod, delete old pod", "pod", pod_.Name) err = r.Delete(ctx, pod_) if err != nil { err = errors.Wrapf(err, "delete pod %s", pod_.Name)