Skip to content

Commit

Permalink
record RecommendationUpdated in a right place (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanposhiho authored Oct 4, 2023
1 parent 58ffc85 commit e198d22
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions controllers/tortoise_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions pkg/tortoise/tortoise.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e198d22

Please sign in to comment.