File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ import (
2121 "encoding/base64"
2222 "encoding/json"
2323 "fmt"
24+
25+ "io"
26+ "slices"
2427 "strings"
2528
2629 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2"
@@ -357,6 +360,9 @@ func (m *MachinePoolScope) updateReplicasAndProviderIDs(ctx context.Context) err
357360 providerIDs [i ] = machine .Spec .ProviderID
358361 }
359362
363+ // Sort providerIDs to ensure deterministic ordering to prevent continuous reconciliation.
364+ slices .Sort (providerIDs )
365+
360366 m .AzureMachinePool .Status .Replicas = readyReplicas
361367 m .AzureMachinePool .Spec .ProviderIDList = providerIDs
362368 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