From 6263ee154945fd638a6e7d03019c96b233127757 Mon Sep 17 00:00:00 2001 From: Matteo Gastaldello Date: Fri, 3 Apr 2026 15:06:48 +0200 Subject: [PATCH] fix: update unstructured-runtime dependency to v1.0.1 and refactor release name handling in Observe function --- go.mod | 2 +- go.sum | 4 ++-- internal/composition/composition.go | 2 +- main.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 237a63b..6b198ea 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/logr v1.4.3 github.com/gobuffalo/flect v1.0.3 github.com/krateoplatformops/plumbing v1.6.0 - github.com/krateoplatformops/unstructured-runtime v1.0.0 + github.com/krateoplatformops/unstructured-runtime v1.0.1 github.com/stretchr/testify v1.11.1 k8s.io/api v0.35.2 k8s.io/apiextensions-apiserver v0.35.0 diff --git a/go.sum b/go.sum index 0d8012e..b04ab8c 100644 --- a/go.sum +++ b/go.sum @@ -169,8 +169,8 @@ 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.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/krateoplatformops/unstructured-runtime v1.0.1 h1:ureSvhxqVTGtS92p0d+TakC7X7osvq5ExbX2334OdCs= +github.com/krateoplatformops/unstructured-runtime v1.0.1/go.mod h1:k85I4xvMIMSlmNbQN93hF5PHBegPqGV4nHZaKCF0/Nk= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw= diff --git a/internal/composition/composition.go b/internal/composition/composition.go index 55a5167..7cc0594 100644 --- a/internal/composition/composition.go +++ b/internal/composition/composition.go @@ -107,7 +107,6 @@ type handler struct { func (h *handler) Observe(ctx context.Context, mg *unstructured.Unstructured) (controller.ExternalObservation, error) { mg = mg.DeepCopy() - releaseName := compositionMeta.GetReleaseName(mg) log := xcontext.Logger(ctx) @@ -128,6 +127,7 @@ func (h *handler) Observe(ctx context.Context, mg *unstructured.Unstructured) (c } compositionMeta.SetReleaseName(mg, compositionMeta.CalculateReleaseName(mg, h.safeReleaseName)) + releaseName := compositionMeta.GetReleaseName(mg) if _, p := compositionMeta.GetGracefullyPausedTime(mg); p && compositionMeta.IsGracefullyPaused(mg) { log.Debug("Composition is gracefully paused, skipping observe.") h.eventRecorder.Event(mg, event.Normal(reasonReconciliationGracefullyPaused, "Observe", "Reconciliation is paused via the gracefully paused annotation.")) diff --git a/main.go b/main.go index e5e7b55..c8cefe8 100644 --- a/main.go +++ b/main.go @@ -129,7 +129,7 @@ func main() { }...) defer cancel() - rec, err := eventrecorder.CreateWithThrottle(ctx, cfg, "composition-dynamic-controller", nil) + rec, err := eventrecorder.Create(ctx, cfg, "composition-dynamic-controller", nil) if err != nil { log.Error(err, "Creating event recorder.") os.Exit(1)