File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
2121 "encoding/base64"
2222 "encoding/json"
2323 "fmt"
24+ "slices"
2425 "strings"
2526
2627 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2"
@@ -357,6 +358,9 @@ func (m *MachinePoolScope) updateReplicasAndProviderIDs(ctx context.Context) err
357358 providerIDs [i ] = machine .Spec .ProviderID
358359 }
359360
361+ // Sort providerIDs to ensure deterministic ordering to prevent continuous reconciliation.
362+ slices .Sort (providerIDs )
363+
360364 m .AzureMachinePool .Status .Replicas = readyReplicas
361365 m .AzureMachinePool .Spec .ProviderIDList = providerIDs
362366 return nil
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package controllers
1919import (
2020 "context"
2121 "fmt"
22+ "slices"
2223 "time"
2324
2425 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
@@ -164,6 +165,8 @@ func (s *azureManagedMachinePoolService) Reconcile(ctx context.Context) error {
164165 providerIDs [i ] = providerID
165166 }
166167
168+ // Sort providerIDs to ensure deterministic ordering to prevent continuous reconciliation.
169+ slices .Sort (providerIDs )
167170 s .scope .SetAgentPoolProviderIDList (providerIDs )
168171 s .scope .SetAgentPoolReplicas (int32 (len (providerIDs )))
169172 s .scope .SetAgentPoolReady (true )
You can’t perform that action at this time.
0 commit comments