fix: allow helm upgrade force to actually apply#1876
Merged
Conversation
Before this PR that was conflicting with server-side apply `getHelmUpgradeClient` also unconditionally set `ServerSideApply` and `ForceConflicts` on every upgrade. The Helm SDK rejects that combination outright: ``` invalid operation: cannot use force conflicts and force replace together ``` so the `force` option could never actually run. Any upgrade that set it failed immediately, before Helm even attempted the patch. This surfaces for instance when a chart changes a Deployment's `strategy.type` from unset, defaulted by the API server to `RollingUpdate` to `Recreate`. The live object still carries the server-defaulted `rollingUpdate` values, which the API server now rejects as forbidden alongside `Recreate`. A normal server-side apply patch can't clear a field it never owned, so the upgrade is stuck. `force` (delete+recreate) is the intended escape hatch, but it was unusable. Now `ServerSideApply`/`ForceConflicts` are only enabled when `force` is not set; when `force` is set, both are disabled so `ForceReplace` can proceed as Helm expects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this PR that was conflicting with server-side apply
getHelmUpgradeClientalso unconditionally setServerSideApplyandForceConflictson every upgrade. The Helm SDK rejects that combination outright:so the
forceoption could never actually run. Any upgrade that set it failed immediately, before Helm even attempted the patch.This surfaces for instance when a chart changes a Deployment's
strategy.typefrom unset, defaulted by the API server toRollingUpdatetoRecreate. The live object still carries the server-defaultedrollingUpdatevalues, which the API server now rejects as forbidden alongsideRecreate. A normal server-side apply patch can't clear a field it never owned, so the upgrade is stuck.force(delete+recreate) is the intended escape hatch, but it was unusable.Now
ServerSideApply/ForceConflictsare only enabled whenforceis not set; whenforceis set, both are disabled soForceReplacecan proceed as Helm expects.