From 8017637206fe0fc1807e7d38487ce43e72c85f8b Mon Sep 17 00:00:00 2001 From: Matteo Gastaldello Date: Fri, 13 Mar 2026 15:22:41 +0100 Subject: [PATCH 1/5] feat: move meta package to a new location and add related tests --- internal/composition/composition.go | 2 +- internal/composition/composition_test.go | 2 +- internal/tools/archive/getter.go | 2 +- main.go | 2 +- {internal => pkg}/meta/meta.go | 0 {internal => pkg}/meta/meta_test.go | 0 6 files changed, 4 insertions(+), 4 deletions(-) rename {internal => pkg}/meta/meta.go (100%) rename {internal => pkg}/meta/meta_test.go (100%) diff --git a/internal/composition/composition.go b/internal/composition/composition.go index 40f108b..e794b99 100644 --- a/internal/composition/composition.go +++ b/internal/composition/composition.go @@ -12,7 +12,7 @@ import ( xcontext "github.com/krateoplatformops/unstructured-runtime/pkg/context" "github.com/krateoplatformops/composition-dynamic-controller/internal/chartinspector" - compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/internal/meta" + compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/pkg/meta" unstructuredtools "github.com/krateoplatformops/unstructured-runtime/pkg/tools/unstructured" "github.com/krateoplatformops/composition-dynamic-controller/internal/rbacgen" diff --git a/internal/composition/composition_test.go b/internal/composition/composition_test.go index a94cb2a..24eb328 100644 --- a/internal/composition/composition_test.go +++ b/internal/composition/composition_test.go @@ -26,8 +26,8 @@ import ( "k8s.io/apimachinery/pkg/types" "github.com/gobuffalo/flect" - compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/internal/meta" "github.com/krateoplatformops/composition-dynamic-controller/internal/tools/archive" + compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/pkg/meta" "github.com/krateoplatformops/plumbing/kubeutil/event" "github.com/krateoplatformops/plumbing/kubeutil/eventrecorder" "github.com/krateoplatformops/unstructured-runtime/pkg/controller" diff --git a/internal/tools/archive/getter.go b/internal/tools/archive/getter.go index 5805439..2badb6e 100644 --- a/internal/tools/archive/getter.go +++ b/internal/tools/archive/getter.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/internal/meta" + compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/pkg/meta" "github.com/krateoplatformops/unstructured-runtime/pkg/logging" "github.com/krateoplatformops/unstructured-runtime/pkg/pluralizer" diff --git a/main.go b/main.go index d8ffc24..e5e7b55 100644 --- a/main.go +++ b/main.go @@ -20,9 +20,9 @@ import ( "github.com/go-logr/logr" "github.com/krateoplatformops/composition-dynamic-controller/internal/composition" - "github.com/krateoplatformops/composition-dynamic-controller/internal/meta" "github.com/krateoplatformops/composition-dynamic-controller/internal/tools/archive" "github.com/krateoplatformops/composition-dynamic-controller/internal/tools/dynamic" + "github.com/krateoplatformops/composition-dynamic-controller/pkg/meta" "github.com/krateoplatformops/plumbing/env" "github.com/krateoplatformops/plumbing/kubeutil/event" "github.com/krateoplatformops/plumbing/kubeutil/eventrecorder" diff --git a/internal/meta/meta.go b/pkg/meta/meta.go similarity index 100% rename from internal/meta/meta.go rename to pkg/meta/meta.go diff --git a/internal/meta/meta_test.go b/pkg/meta/meta_test.go similarity index 100% rename from internal/meta/meta_test.go rename to pkg/meta/meta_test.go From f3b0079e88f01cc099c08da16a372dda80278038 Mon Sep 17 00:00:00 2001 From: Matteo Gastaldello Date: Mon, 16 Mar 2026 14:07:52 +0100 Subject: [PATCH 2/5] fix: update plumbing dependency to v1.5.1 and improve log messages for release not found scenarios --- go.mod | 2 +- go.sum | 4 ++-- internal/composition/composition.go | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 8aba85a..1117291 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc github.com/go-logr/logr v1.4.3 github.com/gobuffalo/flect v1.0.3 - github.com/krateoplatformops/plumbing v1.3.1 + github.com/krateoplatformops/plumbing v1.5.1 github.com/krateoplatformops/unstructured-runtime v1.0.0 github.com/stretchr/testify v1.11.1 k8s.io/api v0.35.2 diff --git a/go.sum b/go.sum index beea35f..d7df5ae 100644 --- a/go.sum +++ b/go.sum @@ -167,8 +167,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/krateoplatformops/plumbing v1.3.1 h1:DQc/ohBiGfI6mC3l2T+3ZvtSR0r3hOLqdxu73xjZUDM= -github.com/krateoplatformops/plumbing v1.3.1/go.mod h1:51a1TKAoCXRHH7cJB8kiYZcIV8ci3PLPtabqBdoD9Zg= +github.com/krateoplatformops/plumbing v1.5.1 h1:+4rF7ly1g7R1FG/iF4aTCUHdYcAdxW1B10JotoVHKMc= +github.com/krateoplatformops/plumbing v1.5.1/go.mod h1:51a1TKAoCXRHH7cJB8kiYZcIV8ci3PLPtabqBdoD9Zg= github.com/krateoplatformops/unstructured-runtime v1.0.0 h1:fawe8qFQfwTpk2l8VmdvPPVfPi2WY4l/yzuZYgS1UMA= github.com/krateoplatformops/unstructured-runtime v1.0.0/go.mod h1:k85I4xvMIMSlmNbQN93hF5PHBegPqGV4nHZaKCF0/Nk= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= diff --git a/internal/composition/composition.go b/internal/composition/composition.go index e794b99..55a5167 100644 --- a/internal/composition/composition.go +++ b/internal/composition/composition.go @@ -176,7 +176,7 @@ func (h *handler) Observe(ctx context.Context, mg *unstructured.Unstructured) (c return controller.ExternalObservation{}, fmt.Errorf("finding helm release: %w", err) } if rel == nil { - log.Debug("Composition not found.") + log.Debug("Release not found.") return controller.ExternalObservation{ ResourceExists: false, ResourceUpToDate: false, @@ -557,8 +557,8 @@ func (h *handler) Update(ctx context.Context, mg *unstructured.Unstructured) err return fmt.Errorf("getting helm release: %w", err) } if upgradedRel == nil { - log.Debug("Composition not found after upgrade.") - return fmt.Errorf("composition not found after upgrade") + log.Debug("Release not found after upgrade.") + return fmt.Errorf("release not found after upgrade") } previousDigest, err := maps.NestedString(mg.Object, "status", "digest") @@ -674,8 +674,8 @@ func (h *handler) Delete(ctx context.Context, mg *unstructured.Unstructured) err return fmt.Errorf("finding helm release: %w", err) } if rel == nil { - log.Debug("Composition not found, nothing to uninstall.", "package", pkg.URL) - h.eventRecorder.Event(mg, event.Normal(reasonDeleted, "Delete", fmt.Sprintf("Composition not found, nothing to uninstall: %s", mg.GetName()))) + log.Debug("Release not found, nothing to uninstall.", "package", pkg.URL) + h.eventRecorder.Event(mg, event.Normal(reasonDeleted, "Delete", fmt.Sprintf("Release not found, nothing to uninstall: %s", mg.GetName()))) return nil } From 54b15d62aa179fc66e44672a08294fcbc26fb543 Mon Sep 17 00:00:00 2001 From: Matteo Gastaldello Date: Mon, 16 Mar 2026 14:21:24 +0100 Subject: [PATCH 3/5] fix: update Go version in Dockerfile and go.mod to 1.25.6 --- Dockerfile | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index da95a76..ec0e617 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Build environment # ----------------- -FROM golang:1.25-trixie AS builder +FROM golang:1.25.6-bookworm AS builder LABEL stage=builder ARG DEBIAN_FRONTEND=noninteractive diff --git a/go.mod b/go.mod index 1117291..5d372f3 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/krateoplatformops/composition-dynamic-controller -go 1.25.3 +go 1.25.6 require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc From 6d1acaeaa1fcddafacad5184e848ffff80d3a867 Mon Sep 17 00:00:00 2001 From: Matteo Gastaldello Date: Mon, 16 Mar 2026 14:28:12 +0100 Subject: [PATCH 4/5] feat: add pkg directory copy to Dockerfile for improved build context --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index ec0e617..006ffa5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ RUN go mod download # COPY apis/ apis/ COPY internal/ internal/ +COPY pkg/ pkg/ COPY main.go main.go # Build From 320fe4d1ea54e0b70e93c61b83a42d47218d65b1 Mon Sep 17 00:00:00 2001 From: Matteo Gastaldello Date: Mon, 16 Mar 2026 14:31:31 +0100 Subject: [PATCH 5/5] fix: update plumbing dependency to v1.6.0 in go.mod and go.sum --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5d372f3..237a63b 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc github.com/go-logr/logr v1.4.3 github.com/gobuffalo/flect v1.0.3 - github.com/krateoplatformops/plumbing v1.5.1 + github.com/krateoplatformops/plumbing v1.6.0 github.com/krateoplatformops/unstructured-runtime v1.0.0 github.com/stretchr/testify v1.11.1 k8s.io/api v0.35.2 diff --git a/go.sum b/go.sum index d7df5ae..0d8012e 100644 --- a/go.sum +++ b/go.sum @@ -167,8 +167,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/krateoplatformops/plumbing v1.5.1 h1:+4rF7ly1g7R1FG/iF4aTCUHdYcAdxW1B10JotoVHKMc= -github.com/krateoplatformops/plumbing v1.5.1/go.mod h1:51a1TKAoCXRHH7cJB8kiYZcIV8ci3PLPtabqBdoD9Zg= +github.com/krateoplatformops/plumbing v1.6.0 h1:bCS9FLE5JjLEdsn9Ei+HfTLHySil+ne7VLW0zKOSBpg= +github.com/krateoplatformops/plumbing v1.6.0/go.mod h1:L8dMKmq9hO1tz9NzJPlryBj618J5w0PYt8z6fzAbBvs= github.com/krateoplatformops/unstructured-runtime v1.0.0 h1:fawe8qFQfwTpk2l8VmdvPPVfPi2WY4l/yzuZYgS1UMA= github.com/krateoplatformops/unstructured-runtime v1.0.0/go.mod h1:k85I4xvMIMSlmNbQN93hF5PHBegPqGV4nHZaKCF0/Nk= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=