Preserve image plan metadata in VMSS model conversion to prevent false model drift#6129
Preserve image plan metadata in VMSS model conversion to prevent false model drift#6129stelucz wants to merge 2 commits intokubernetes-sigs:mainfrom
Conversation
|
Hi @stelucz. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/assign vincepri |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6129 +/- ##
==========================================
- Coverage 44.41% 43.94% -0.48%
==========================================
Files 280 289 +9
Lines 25379 25357 -22
==========================================
- Hits 11273 11144 -129
- Misses 13293 13433 +140
+ Partials 813 780 -33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bdf24b8 to
c304453
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
added missing test |
Signed-off-by: Lukas Stehlik <stehlik.lukas@gmail.com>
c304453 to
c380ed5
Compare
|
Hi @jackfrancis may i ask you to have a look at change? Thanks |
mboersma
left a comment
There was a problem hiding this comment.
There's a subtle regression possible here: if the user specifies the image via image.ID (a raw string), then the desired image from GetVMImage has ID set and ComputeGallery is nil. The spec has no plan data.
The whole purpose of the IDImageRefToImage comparison is to handle the case where the user wrote a raw gallery resource ID instead of using the structured ComputeGallery field. In that case, the user has no way to express plan metadata in their spec.
Maybe the fix is to strip the plan from the observed image when comparing via this code path, since the "desired" side can never have one. We could add this to machinepoolmachine.go:
if newImage.ComputeGallery != nil {
instanceImageCopy := s.instance.Image
instanceImageCopy.ComputeGallery.Plan = nil
return reflect.DeepEqual(instanceImageCopy, newImage), nil
}Address review feedback: - Strip ComputeGallery.Plan from observed instance image when comparing against desired image built from raw ID, preventing false model drift. - Remove unused IsThirdParty field from SDKImageToImage test table. - Collapse test assertion to single SDKImageToImage call. - Add hasLatestModelApplied regression tests for plan-stripping path. Signed-off-by: Lukas Stehlik <stehlik.lukas@gmail.com>
What type of PR is this?
/kind bug
What this PR does / why we need it:
This PR fixes a VMSS model comparison issue in CAPZ where plan metadata was lost during Azure SDK → CAPZ image conversion.
As a result, CAPZ could detect a model mismatch even when
AzureMachinePoolspec was unchanged, and repeatedly rollMachinePoolinstances.Root Cause
LatestModelAppliedforAzureMachinePoolMachinedepends on comparing:MachinePoolScope.GetVMImage(...)SDKImageToImagedid not carry Plan fields for gallery-based image references.Actual State Before Change
MachinePool/AzureMachinePool.Change Introduced
SDKImageToImageWithPlan(imageRef, isThirdParty, sdkPlan)SDKImageToImage(imageRef, isThirdParty)preserved as compatibility wrapper.Expected Result
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
TODOs:
Release note: