Skip to content

Commit

Permalink
Improve logs of SystemRollout
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Mar 22, 2024
1 parent dbec591 commit 420caaa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions controllers/rpaasinstance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"context"
"fmt"
"reflect"
"sort"
"strings"
"time"

Expand Down Expand Up @@ -82,8 +83,6 @@ func (r *RpaasInstanceReconciler) Reconcile(ctx context.Context, req ctrl.Reques
rolloutAllowed, reservation = r.SystemRateLimiter.Reserve()

if !rolloutAllowed {
logger.Info("modifications of rpaas instance is delayed")

return ctrl.Result{
Requeue: true,
RequeueAfter: time.Minute,
Expand Down Expand Up @@ -201,7 +200,9 @@ func (r *RpaasInstanceReconciler) Reconcile(ctx context.Context, req ctrl.Reques

if listOfChanges := getChangesList(changes); len(listOfChanges) > 0 {
if systemRollout {
r.EventRecorder.Eventf(instance, corev1.EventTypeWarning, "RpaasInstanceSystemRolloutApplied", "RPaaS controller has updated these resources: %s to ensure system consistency", strings.Join(listOfChanges, ", "))
msg := fmt.Sprintf("RPaaS controller has updated these resources: %s to ensure system consistency", strings.Join(listOfChanges, ", "))
logger.Info(msg)
r.EventRecorder.Event(instance, corev1.EventTypeWarning, "RpaasInstanceSystemRolloutApplied", msg)
}
} else {
reservation.Cancel()
Expand All @@ -222,7 +223,7 @@ func getChangesList(changes map[string]bool) []string {
changed = append(changed, k)
}
}

sort.Strings(changed)
return changed
}

Expand Down

0 comments on commit 420caaa

Please sign in to comment.