Skip to content

Commit e0720c8

Browse files
174 pkg folder for common resources (#175)
* feat: move meta package to a new location and add related tests * fix: update plumbing dependency to v1.5.1 and improve log messages for release not found scenarios * fix: update Go version in Dockerfile and go.mod to 1.25.6 * feat: add pkg directory copy to Dockerfile for improved build context * fix: update plumbing dependency to v1.6.0 in go.mod and go.sum
1 parent 992db05 commit e0720c8

9 files changed

Lines changed: 15 additions & 14 deletions

File tree

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Build environment
22
# -----------------
3-
FROM golang:1.25-trixie AS builder
3+
FROM golang:1.25.6-bookworm AS builder
44
LABEL stage=builder
55

66
ARG DEBIAN_FRONTEND=noninteractive
@@ -21,6 +21,7 @@ RUN go mod download
2121

2222
# COPY apis/ apis/
2323
COPY internal/ internal/
24+
COPY pkg/ pkg/
2425
COPY main.go main.go
2526

2627
# Build

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module github.com/krateoplatformops/composition-dynamic-controller
22

3-
go 1.25.3
3+
go 1.25.6
44

55
require (
66
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
77
github.com/go-logr/logr v1.4.3
88
github.com/gobuffalo/flect v1.0.3
9-
github.com/krateoplatformops/plumbing v1.3.1
9+
github.com/krateoplatformops/plumbing v1.6.0
1010
github.com/krateoplatformops/unstructured-runtime v1.0.0
1111
github.com/stretchr/testify v1.11.1
1212
k8s.io/api v0.35.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
167167
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
168168
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
169169
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
170-
github.com/krateoplatformops/plumbing v1.3.1 h1:DQc/ohBiGfI6mC3l2T+3ZvtSR0r3hOLqdxu73xjZUDM=
171-
github.com/krateoplatformops/plumbing v1.3.1/go.mod h1:51a1TKAoCXRHH7cJB8kiYZcIV8ci3PLPtabqBdoD9Zg=
170+
github.com/krateoplatformops/plumbing v1.6.0 h1:bCS9FLE5JjLEdsn9Ei+HfTLHySil+ne7VLW0zKOSBpg=
171+
github.com/krateoplatformops/plumbing v1.6.0/go.mod h1:L8dMKmq9hO1tz9NzJPlryBj618J5w0PYt8z6fzAbBvs=
172172
github.com/krateoplatformops/unstructured-runtime v1.0.0 h1:fawe8qFQfwTpk2l8VmdvPPVfPi2WY4l/yzuZYgS1UMA=
173173
github.com/krateoplatformops/unstructured-runtime v1.0.0/go.mod h1:k85I4xvMIMSlmNbQN93hF5PHBegPqGV4nHZaKCF0/Nk=
174174
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=

internal/composition/composition.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
xcontext "github.com/krateoplatformops/unstructured-runtime/pkg/context"
1313

1414
"github.com/krateoplatformops/composition-dynamic-controller/internal/chartinspector"
15-
compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/internal/meta"
15+
compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/pkg/meta"
1616
unstructuredtools "github.com/krateoplatformops/unstructured-runtime/pkg/tools/unstructured"
1717

1818
"github.com/krateoplatformops/composition-dynamic-controller/internal/rbacgen"
@@ -176,7 +176,7 @@ func (h *handler) Observe(ctx context.Context, mg *unstructured.Unstructured) (c
176176
return controller.ExternalObservation{}, fmt.Errorf("finding helm release: %w", err)
177177
}
178178
if rel == nil {
179-
log.Debug("Composition not found.")
179+
log.Debug("Release not found.")
180180
return controller.ExternalObservation{
181181
ResourceExists: false,
182182
ResourceUpToDate: false,
@@ -557,8 +557,8 @@ func (h *handler) Update(ctx context.Context, mg *unstructured.Unstructured) err
557557
return fmt.Errorf("getting helm release: %w", err)
558558
}
559559
if upgradedRel == nil {
560-
log.Debug("Composition not found after upgrade.")
561-
return fmt.Errorf("composition not found after upgrade")
560+
log.Debug("Release not found after upgrade.")
561+
return fmt.Errorf("release not found after upgrade")
562562
}
563563

564564
previousDigest, err := maps.NestedString(mg.Object, "status", "digest")
@@ -674,8 +674,8 @@ func (h *handler) Delete(ctx context.Context, mg *unstructured.Unstructured) err
674674
return fmt.Errorf("finding helm release: %w", err)
675675
}
676676
if rel == nil {
677-
log.Debug("Composition not found, nothing to uninstall.", "package", pkg.URL)
678-
h.eventRecorder.Event(mg, event.Normal(reasonDeleted, "Delete", fmt.Sprintf("Composition not found, nothing to uninstall: %s", mg.GetName())))
677+
log.Debug("Release not found, nothing to uninstall.", "package", pkg.URL)
678+
h.eventRecorder.Event(mg, event.Normal(reasonDeleted, "Delete", fmt.Sprintf("Release not found, nothing to uninstall: %s", mg.GetName())))
679679
return nil
680680
}
681681

internal/composition/composition_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import (
2626
"k8s.io/apimachinery/pkg/types"
2727

2828
"github.com/gobuffalo/flect"
29-
compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/internal/meta"
3029
"github.com/krateoplatformops/composition-dynamic-controller/internal/tools/archive"
30+
compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/pkg/meta"
3131
"github.com/krateoplatformops/plumbing/kubeutil/event"
3232
"github.com/krateoplatformops/plumbing/kubeutil/eventrecorder"
3333
"github.com/krateoplatformops/unstructured-runtime/pkg/controller"

internal/tools/archive/getter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77
"strings"
88

9-
compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/internal/meta"
9+
compositionMeta "github.com/krateoplatformops/composition-dynamic-controller/pkg/meta"
1010

1111
"github.com/krateoplatformops/unstructured-runtime/pkg/logging"
1212
"github.com/krateoplatformops/unstructured-runtime/pkg/pluralizer"

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020

2121
"github.com/go-logr/logr"
2222
"github.com/krateoplatformops/composition-dynamic-controller/internal/composition"
23-
"github.com/krateoplatformops/composition-dynamic-controller/internal/meta"
2423
"github.com/krateoplatformops/composition-dynamic-controller/internal/tools/archive"
2524
"github.com/krateoplatformops/composition-dynamic-controller/internal/tools/dynamic"
25+
"github.com/krateoplatformops/composition-dynamic-controller/pkg/meta"
2626
"github.com/krateoplatformops/plumbing/env"
2727
"github.com/krateoplatformops/plumbing/kubeutil/event"
2828
"github.com/krateoplatformops/plumbing/kubeutil/eventrecorder"
File renamed without changes.

0 commit comments

Comments
 (0)