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}} 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 } 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) }) }