From 278883dbe3729c00b9292f526c6a7de32630f4b8 Mon Sep 17 00:00:00 2001 From: Diego Braga Date: Wed, 8 Jul 2026 09:38:20 +0200 Subject: [PATCH] fix(composition): TakeOwnership on umbrella upgrade so an un-adoptable child cannot wedge the whole release (D1 upgrade-layer) Complements chart-inspector#4 (render layer). The cdc's hc.Upgrade also aborts with 'cannot be imported into the current release: invalid ownership metadata' when a child composition instance exists with non-Helm ownership (created/edited out-of-band), wedging the whole platform reconcile. Set TakeOwnership on both upgrade paths so helm adopts the child and self-heals its ownership. Requires braghettos/plumbing v1.7.8, which maps TakeOwnership in applyUpgradeConfig (was install-only); replace bumped v1.7.7->v1.7.8. Validated: go build ./... passes. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01FzZJtQ4bEMHuK4CvF6eBuL --- go.mod | 2 +- go.sum | 4 ++-- internal/composition/composition.go | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5099854..55f5c32 100644 --- a/go.mod +++ b/go.mod @@ -168,4 +168,4 @@ replace github.com/krateoplatformops/unstructured-runtime => github.com/braghett // gojq-panic fix, crdgen array-default markers, AND the krateo.io/traceparent child-manifest // post-render stamping for cross-composition trace propagation. (v1.7.x maintenance line — // the divergent v1.8.x fork line dropped slogs/pretty, which unstructured-runtime tests need.) -replace github.com/krateoplatformops/plumbing => github.com/braghettos/plumbing v1.7.7 +replace github.com/krateoplatformops/plumbing => github.com/braghettos/plumbing v1.7.8 diff --git a/go.sum b/go.sum index af5ca9e..bb10635 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= -github.com/braghettos/plumbing v1.7.7 h1:KUvYyhW04AP6j1HdI9GRfV/ILc1UE/bU/lxaS/ntGag= -github.com/braghettos/plumbing v1.7.7/go.mod h1:UrYvAvnfacOiOLlQbIg6J08zYC+XJ9ZMKbecQq+4jV4= +github.com/braghettos/plumbing v1.7.8 h1:OiKDpFhDVcmTjFPTCMcDkfgRUoss8j9Ax4l5cPHsw3s= +github.com/braghettos/plumbing v1.7.8/go.mod h1:UrYvAvnfacOiOLlQbIg6J08zYC+XJ9ZMKbecQq+4jV4= github.com/braghettos/unstructured-runtime v1.3.0 h1:t8QnEN3TIdfJVfO9iNP5OSFIbQlwpR/xIzWMfcDvwHc= github.com/braghettos/unstructured-runtime v1.3.0/go.mod h1:hkDWf74tgbfYONkwKEjaX24KgQLPe7fUvArz8wqglnA= github.com/bshuster-repo/logrus-logstash-hook v1.0.0 h1:e+C0SB5R1pu//O4MQ3f9cFuPGoOVeF2fE4Og9otCc70= diff --git a/internal/composition/composition.go b/internal/composition/composition.go index abc4032..6d7a54a 100644 --- a/internal/composition/composition.go +++ b/internal/composition/composition.go @@ -321,6 +321,12 @@ func (h *handler) Observe(ctx context.Context, mg *unstructured.Unstructured) (c InsecureSkipTLSverify: pkg.InsecureSkipTLSverify, Values: values, PostRenderer: postrenderLabels, + // Adopt an existing child object rather than aborting the whole release when it carries + // non-Helm ownership metadata (e.g. a composition instance created/edited out-of-band). + // Without this, one un-adoptable child 500s the entire reconcile ("cannot be imported + // into the current release: invalid ownership metadata") and wedges the platform (D1, + // 2026-07-08); with it the release takes ownership, self-healing the conflict. + TakeOwnership: true, }, MaxHistory: helmMaxHistory, }) @@ -504,6 +510,11 @@ func (h *handler) Create(ctx context.Context, mg *unstructured.Unstructured) err Password: pkg.Auth.Password, InsecureSkipTLSverify: pkg.InsecureSkipTLSverify, PostRenderer: postrenderLabels, + // Adopt an existing child object rather than aborting the whole release when it carries + // non-Helm ownership metadata (out-of-band-created/edited composition instance). Otherwise one + // un-adoptable child 500s the entire reconcile and wedges the platform (D1); with it the + // release takes ownership and self-heals the conflict. + TakeOwnership: true, } // Check if the release already exists before attempting to install, this can happen if the create event is triggered after a failed install