Skip to content

Commit 451d034

Browse files
authored
Merge pull request #1197 from devigned/customdata-hash
do not include customData in AzureMachinePool hash calculation
2 parents 2d51dfe + 9d2dd13 commit 451d034

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

azure/services/scalesets/scalesets.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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()

config/manager/manager.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ spec:
2424
- --leader-elect
2525
- "--metrics-bind-addr=127.0.0.1:8080"
2626
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},AKS=${EXP_AKS:=false}"
27+
- "--v=0"
2728
image: controller:latest
2829
imagePullPolicy: Always
2930
name: manager

test/e2e/config/azure-dev.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ providers:
7575
targetName: "cluster-template-windows.yaml"
7676
- sourcePath: "${PWD}/templates/test/cluster-template-prow-machine-pool-windows.yaml"
7777
targetName: "cluster-template-machine-pool-windows.yaml"
78+
replacements:
79+
- old: "--v=0"
80+
new: "--v=4"
7881

7982
variables:
8083
KUBERNETES_VERSION: "${KUBERNETES_VERSION:-v1.19.7}"

0 commit comments

Comments
 (0)