From 001e7da2f1011d68ad33e530f76af3f509f455c2 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 24 Nov 2023 10:11:33 +0100 Subject: [PATCH 1/3] controller: repair fuzz test We should actually add more of them now that the code base has grown (in complexity). But this solves the issue for CI for now. Signed-off-by: Hidde Beydals --- internal/controller/helmrelease_controller_fuzz_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/controller/helmrelease_controller_fuzz_test.go b/internal/controller/helmrelease_controller_fuzz_test.go index cff926d69..4c7fc203c 100644 --- a/internal/controller/helmrelease_controller_fuzz_test.go +++ b/internal/controller/helmrelease_controller_fuzz_test.go @@ -32,6 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/yaml" + "github.com/fluxcd/pkg/runtime/patch" sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" v2 "github.com/fluxcd/helm-controller/api/v2beta2" @@ -90,13 +91,12 @@ other: values &hc, } - c := fake.NewClientBuilder().WithScheme(scheme).WithObjects(resources...).Build() + c := fake.NewClientBuilder().WithScheme(scheme).WithStatusSubresource(&v2.HelmRelease{}).WithObjects(resources...).Build() r := &HelmReleaseReconciler{ Client: c, EventRecorder: &DummyRecorder{}, } - - _, _, _ = r.reconcile(logr.NewContext(context.TODO(), logr.Discard()), hr) + _, _ = r.reconcileRelease(logr.NewContext(context.TODO(), logr.Discard()), patch.NewSerialPatcher(&hr, c), &hr) }) } From 4c439b721a195821b9cd45a802c03509ed833ced Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 24 Nov 2023 10:46:23 +0100 Subject: [PATCH 2/3] action/upgrade: use correct CRD policy Signed-off-by: Hidde Beydals --- internal/action/upgrade.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/action/upgrade.go b/internal/action/upgrade.go index f18e50a26..896ccf6a1 100644 --- a/internal/action/upgrade.go +++ b/internal/action/upgrade.go @@ -51,7 +51,7 @@ func Upgrade(ctx context.Context, config *helmaction.Configuration, obj *v2.Helm vals helmchartutil.Values, opts ...UpgradeOption) (*helmrelease.Release, error) { upgrade := newUpgrade(config, obj, opts) - policy, err := crdPolicyOrDefault(obj.GetInstall().CRDs) + policy, err := crdPolicyOrDefault(obj.GetUpgrade().CRDs) if err != nil { return nil, err } From e4d19b8e898edb4dc7facb41ca475aad89cc80c3 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 24 Nov 2023 10:47:02 +0100 Subject: [PATCH 3/3] testdata: properly take tag value into account Signed-off-by: Hidde Beydals --- .../charts/crds/bootstrap/templates/git-repository.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/testdata/charts/crds/bootstrap/templates/git-repository.yaml b/config/testdata/charts/crds/bootstrap/templates/git-repository.yaml index 8a82764fd..500b105d3 100644 --- a/config/testdata/charts/crds/bootstrap/templates/git-repository.yaml +++ b/config/testdata/charts/crds/bootstrap/templates/git-repository.yaml @@ -11,6 +11,6 @@ spec: {{- if .Values.branch }} branch: "{{ .Values.branch }}" {{- end}} - {{- if .Values.branch }} + {{- if .Values.tag }} tag: "{{ .Values.tag }}" {{- end}}