Skip to content

Commit

Permalink
Add log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
arybolovlev committed Jun 12, 2024
1 parent 8c377f7 commit fd379c6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/agentpool_controller_autoscaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,14 @@ func (r *AgentPoolReconciler) reconcileAgentAutoscaling(ctx context.Context, ap
r.Recorder.Eventf(&ap.instance, corev1.EventTypeWarning, "AutoscaleAgentPoolDeployment", "Autoscaling failed: %v", err.Error())
return err
}
ap.log.Info("Reconcile Agent Autoscaling", "msg", fmt.Sprintf("%d agent replicas are running", currentReplicas))

minReplicas := *ap.instance.Spec.AgentDeploymentAutoscaling.MinReplicas
maxReplicas := *ap.instance.Spec.AgentDeploymentAutoscaling.MaxReplicas
desiredReplicas := computeDesiredReplicas(requiredAgents, minReplicas, maxReplicas)
if desiredReplicas != currentReplicas {
scalingEvent := fmt.Sprintf("Scaling agent deployment from %v to %v replicas", currentReplicas, desiredReplicas)
ap.log.Info("Reconcile Agent Autoscaling", "msg", scalingEvent)
ap.log.Info("Reconcile Agent Autoscaling", "msg", strings.ToLower(scalingEvent))
r.Recorder.Event(&ap.instance, corev1.EventTypeNormal, "AutoscaleAgentPoolDeployment", scalingEvent)
err := r.scaleAgentDeployment(ctx, ap, &desiredReplicas)
if err != nil {
Expand Down

0 comments on commit fd379c6

Please sign in to comment.