Skip to content

test(vpa): guard camel-cased update mode through the reconcile path (closes #862) - #884

Open
abhyudayareddy wants to merge 1 commit into
FairwindsOps:masterfrom
abhyudayareddy:test/reconcile-inplace-update-mode-862
Open

abhyudayareddy wants to merge 1 commit into
FairwindsOps:masterfrom
abhyudayareddy:test/reconcile-inplace-update-mode-862

Conversation

@abhyudayareddy

Copy link
Copy Markdown
Contributor

Checklist

  • I have signed the CLA
  • I have updated/added any relevant documentation

Description

What's the goal of this PR?

Close out #862 (and its duplicate #873) by adding a regression guard at the layer where that bug actually surfaced.

Background

#862 reported that goldilocks.fairwinds.com/vpa-update-mode=InPlace produced:

admission webhook "vpa.k8s.io" denied the request: ... spec.updatePolicy.updateMode: Unsupported value: "Inplace": supported values: "InPlace", "InPlaceOrRecreate", "Initial", "Off", "Recreate"

Tracing the history:

So the bug is already resolved as of the current release line. The remaining gap is test coverage at the reconcile/emission layer: Test_ReconcileNamespace_ChangeUpdateMode only exercised the legacy auto alias, which resolves to the single-word mode Recreate and would not have caught the casing mangle.

What changes did you make?

Extended Test_ReconcileNamespace_ChangeUpdateMode to also switch the namespace to InPlace, reconcile, and assert the emitted VPA's spec.updatePolicy.updateMode is exactly InPlace. Verified the assertion fails (mode falls back to Off) if vpav1.UpdateModeInPlace is removed from allowedUpdateModes.

What alternative solution should we consider, if any?

None — test-only change.

Test_ReconcileNamespace_ChangeUpdateMode only exercised the legacy
"auto" alias, which resolves to the single-word mode "Recreate".
The regression in FairwindsOps#862 was a camel-cased mode ("InPlace") reaching the
VPA spec mangled as "Inplace" and being rejected by the VPA admission
webhook. Extend the test to switch a namespace to InPlace and assert the
emitted VPA carries the exact casing the VPA API expects.

Complements the parser-level coverage added in FairwindsOps#883.
@abhyudayareddy

Copy link
Copy Markdown
Contributor Author

cc @sudermanjr — this one's been open a couple weeks with no review (test coverage for the camel-cased VPA update-mode bug, closes #862). Small, self-contained change. Happy to rebase or adjust if needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant