@@ -20,6 +20,8 @@ import (
2020 "context"
2121 "fmt"
2222
23+ "github.com/google/go-cmp/cmp"
24+
2325 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
2426 "github.com/pkg/errors"
2527 azprovider "sigs.k8s.io/cloud-provider-azure/pkg/provider"
@@ -96,7 +98,7 @@ func (s *Service) Reconcile(ctx context.Context) (retErr error) {
9698 return errors .Errorf ("%T is not of type ScaleSetSpec" , spec )
9799 }
98100
99- _ , err := s .Client .Get (ctx , spec )
101+ existing , err := s .Client .Get (ctx , spec )
100102 if err == nil {
101103 // We can only get the existing instances if the VMSS already exists
102104 scaleSetSpec .VMSSInstances , err = s .Client .ListInstances (ctx , spec .ResourceGroupName (), spec .ResourceName ())
@@ -118,6 +120,17 @@ func (s *Service) Reconcile(ctx context.Context) (retErr error) {
118120 return errors .Errorf ("%T is not an armcompute.VirtualMachineScaleSet" , result )
119121 }
120122
123+ if existing != nil {
124+ if existingVmss , ok := existing .(armcompute.VirtualMachineScaleSet ); ok {
125+ vmssEqual := cmp .Equal (vmss , existingVmss )
126+ if ! vmssEqual {
127+ log .Info ("updated VMSS" , "diff" , cmp .Diff (existingVmss , vmss ))
128+ } else {
129+ log .Info ("VMSS equal, probably not updated?" )
130+ }
131+ }
132+ }
133+
121134 fetchedVMSS := converters .SDKToVMSS (vmss , scaleSetSpec .VMSSInstances )
122135 if err := s .Scope .ReconcileReplicas (ctx , & fetchedVMSS ); err != nil {
123136 return errors .Wrap (err , "unable to reconcile VMSS replicas" )
0 commit comments