diff --git a/Dockerfile b/Dockerfile index da95a76..006ffa5 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 @@ -21,6 +21,7 @@ RUN go mod download # COPY apis/ apis/ COPY internal/ internal/ +COPY pkg/ pkg/ COPY main.go main.go # Build diff --git a/go.mod b/go.mod index 8aba85a..237a63b 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ 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 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.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 beea35f..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.3.1 h1:DQc/ohBiGfI6mC3l2T+3ZvtSR0r3hOLqdxu73xjZUDM= -github.com/krateoplatformops/plumbing v1.3.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= diff --git a/internal/composition/composition.go b/internal/composition/composition.go index 40f108b..55a5167 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" @@ -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 } 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