diff --git a/controllers/tortoise_controller.go b/controllers/tortoise_controller.go index df5856f8..ba198304 100644 --- a/controllers/tortoise_controller.go +++ b/controllers/tortoise_controller.go @@ -31,6 +31,7 @@ import ( "time" v1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" @@ -167,6 +168,8 @@ func (r *TortoiseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ return ctrl.Result{}, err } + r.EventRecorder.Event(tortoise, corev1.EventTypeNormal, "RecommendationUpdated", "The recommendation on Tortoise status is updated") + if tortoise.Status.TortoisePhase == autoscalingv1beta1.TortoisePhaseGatheringData { logger.V(4).Info("tortoise is GatheringData phase; skip applying the recommendation to HPA or VPAs") return ctrl.Result{RequeueAfter: r.Interval}, nil diff --git a/pkg/tortoise/tortoise.go b/pkg/tortoise/tortoise.go index 1d088044..d6204f19 100644 --- a/pkg/tortoise/tortoise.go +++ b/pkg/tortoise/tortoise.go @@ -307,8 +307,6 @@ func (s *Service) UpdateTortoiseStatus(ctx context.Context, originalTortoise *v1 return originalTortoise, err } - s.recorder.Event(originalTortoise, corev1.EventTypeNormal, "RecommendationUpdated", "The recommendation on Tortoise status is updated") - s.updateLastTimeUpdateTortoise(originalTortoise, now) return originalTortoise, nil