diff --git a/internal/controllers/persistent-volume-claim/controller.go b/internal/controllers/persistent-volume-claim/controller.go index 8dda9a6a9..12f2a3fe0 100644 --- a/internal/controllers/persistent-volume-claim/controller.go +++ b/internal/controllers/persistent-volume-claim/controller.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "math" + "sort" "strings" "time" @@ -110,6 +111,9 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu nodeMessage = append(nodeMessage, fmt.Sprintf("node %s has %s free storage", node.Name, prettyByteSize(capacityQuantity.Value()))) } + // sort the message alphabetically so we always publish the same event + sort.Strings(nodeMessage) + // Publish an event if the requested storage is greater than the available capacity if !found { msg := fmt.Sprintf("Requested storage (%s) is greater than available capacity on any node (%s).", requestedStorage.String(), strings.Join(nodeMessage, ","))