Skip to content

Commit

Permalink
chores: add pod deletion logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone committed Aug 17, 2023
1 parent 9edfdb5 commit d21712c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions controllers/resources/bentorequest_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit d21712c

Please sign in to comment.