From 99001a877c19c792b35a912802a4309f9637c8a1 Mon Sep 17 00:00:00 2001 From: yy Date: Wed, 4 Sep 2024 12:10:26 +0800 Subject: [PATCH] add log to debug. Signed-off-by: yy --- controllers/devbox/internal/controller/devbox_controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/controllers/devbox/internal/controller/devbox_controller.go b/controllers/devbox/internal/controller/devbox_controller.go index c588e423de6..c79f2fa7cc6 100644 --- a/controllers/devbox/internal/controller/devbox_controller.go +++ b/controllers/devbox/internal/controller/devbox_controller.go @@ -263,11 +263,17 @@ func (r *DevboxReconciler) syncPod(ctx context.Context, devbox *devboxv1alpha1.D return r.updateDevboxCommitHistory(ctx, devbox, &podList.Items[0]) } if !helper.CheckPodConsistency(expectPod, &podList.Items[0]) { + logger.Info("pod is pending, but pod spec is not consistent, delete pod") + logger.Info("pod", "pod", podList.Items[0].Name, "pod spec", podList.Items[0].Spec) + logger.Info("expect pod", "pod", expectPod.Name, "pod spec", expectPod.Spec) _ = r.Delete(ctx, &podList.Items[0]) } case corev1.PodRunning: //if pod is running,check pod need restart if !helper.CheckPodConsistency(expectPod, &podList.Items[0]) { + logger.Info("pod is running, but pod spec is not consistent, delete pod") + logger.Info("pod", "pod", podList.Items[0].Name, "pod spec", podList.Items[0].Spec) + logger.Info("expect pod", "pod", expectPod.Name, "pod spec", expectPod.Spec) _ = r.Delete(ctx, &podList.Items[0]) } return r.updateDevboxCommitHistory(ctx, devbox, &podList.Items[0])