@@ -210,9 +210,12 @@ func (s *Service) patchVMSSIfNeeded(ctx context.Context, infraVMSS *infrav1exp.V
210210 //
211211 // Note: if a user were to mutate the VMSS in Azure rather than through CAPZ, this hash match may match, but not
212212 // reflect the state of the specification in K8s.
213+ s .Scope .V (2 ).Info ("found matching spec hash no need to PATCH" )
213214 return nil , nil
214215 }
215216
217+ s .Scope .V (2 ).Info ("hashes don't match PATCHING VMSS" , "oldHash" , infraVMSS .Tags [infrav1 .SpecVersionHashTagKey ()], "newHash" , result .Hash )
218+ s .Scope .V (4 ).Info ("diff" , "oldVMSS" , infraVMSS , "newVMSS" , result )
216219 vmss := result .VMSSWithoutHash
217220 vmss .Tags = converters .TagsToMap (result .Tags .AddSpecVersionHashTag (result .Hash ))
218221 patch , err := getVMSSUpdateFromVMSS (vmss )
@@ -655,9 +658,13 @@ func base64EncodedHash(vmss compute.VirtualMachineScaleSet) (string, error) {
655658 // Setting Admin Password is not supported but an initial password is required for Windows
656659 // Don't include it in the hash since it is generated and won't be the same each the spec is created (#1182)
657660 tmpPass := vmss .VirtualMachineProfile .OsProfile .AdminPassword
661+ // Don't include customData in the hash since it will change due to the kubeadm bootstrap token being regenerated.
662+ tmpCustomData := vmss .VirtualMachineProfile .OsProfile .CustomData
658663 vmss .VirtualMachineProfile .OsProfile .AdminPassword = nil
664+ vmss .VirtualMachineProfile .OsProfile .CustomData = nil
659665 defer func () {
660666 vmss .VirtualMachineProfile .OsProfile .AdminPassword = tmpPass
667+ vmss .VirtualMachineProfile .OsProfile .CustomData = tmpCustomData
661668 }()
662669
663670 jsonData , err := vmss .MarshalJSON ()
0 commit comments