fix(adapter): set the Helm managed-fields owner for drift detection - #26
Merged
Merged
Conversation
The adapter passes ControllerName as the reconciler FieldManager but never sets helm's package-level kube.ManagedFieldsManager, which action.Diff uses as the field owner for the drift-detection dry-run. Upstream sets it in its own main, which embedding callers never run. With driftDetection on, the dry-run fails with 'fieldManager: Required value' and the release goes Ready=False.
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.
What
SetupHelmReconcilerpassesControllerNameas the reconcilerFieldManagerbut never sets Helm's package-levelkube.ManagedFieldsManager, whichaction.Diffuses as the field owner for the drift-detection dry-run. Upstream sets it in its ownmain.go(kube.ManagedFieldsManager = controllerName), which embedding callers such as the agent never run. This does the same thing in the adapter.Effect today
With
driftDetection.mode: warnon any HelmRelease the dry-run is rejected and the release goesReady=False StateError: "PatchOptions fieldManager: Required value: is required". Reproduced on a dev regional (navy-aura, reloader) throughPatchRegionalClusterAppConfig, reverted afterwards. OPS-1256.Side effect, checked
Without the variable Helm falls back to the binary name, so objects on regionals are currently owned by the field manager
qdrant-cloud-agent. After this change Helm applies and the drift dry-run both usehelm-controller, the same name upstream uses. That is safe: install and upgrade always run server-side apply withForceConflicts(internal/action/install.go), and the drift dry-run usesclient.ForceOwnership(fluxcd/pkg/ssa/jsondiff), so ownership moves on the next apply without conflicts and identical values produce no drift. Verified the conflict shape with a server-side dry-run ashelm-controllerover a live release manifest, with and without--force-conflicts. Nothing in the addons or resource-protection charts keys on the manager name.Checked
go build ./...,go vet ./adapter/, kind e2e green. FOSSA is red on every PR here, the repo has no token for the inherited scan workflow. Re-test on the same regional once the agent picks up the tagged version, expecting aDrifted=Truecondition and aDriftDetectedevent without touchingReady.