From 24057743bbe8bb9bc68a473c0f2c355716e153d2 Mon Sep 17 00:00:00 2001 From: Matheus Pimenta Date: Mon, 3 Mar 2025 10:17:34 +0000 Subject: [PATCH] Fix command debug hr not taking targetPath into account Signed-off-by: Matheus Pimenta --- cmd/flux/debug_helmrelease.go | 14 +------------- cmd/flux/testdata/debug_helmrelease/objects.yaml | 5 +++++ .../debug_helmrelease/values-from.golden.yaml | 1 + 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/cmd/flux/debug_helmrelease.go b/cmd/flux/debug_helmrelease.go index d87d815542..0fcdfcab62 100644 --- a/cmd/flux/debug_helmrelease.go +++ b/cmd/flux/debug_helmrelease.go @@ -21,7 +21,6 @@ import ( "fmt" helmv2 "github.com/fluxcd/helm-controller/api/v2" - "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/chartutil" "github.com/go-logr/logr" "github.com/spf13/cobra" @@ -93,23 +92,12 @@ func debugHelmReleaseCmdRun(cmd *cobra.Command, args []string) error { } if debugHelmReleaseArgs.showValues { - // TODO(stefan): remove the mapping when helm-controller/api v1.2.0 has been released - var valuesRefs []meta.ValuesReference - for _, source := range hr.Spec.ValuesFrom { - valuesRefs = append(valuesRefs, meta.ValuesReference{ - Kind: source.Kind, - Name: source.Name, - ValuesKey: source.ValuesKey, - Optional: source.Optional, - }) - } - finalValues, err := chartutil.ChartValuesFromReferences(ctx, logr.Discard(), kubeClient, hr.GetNamespace(), hr.GetValues(), - valuesRefs...) + hr.Spec.ValuesFrom...) if err != nil { return err } diff --git a/cmd/flux/testdata/debug_helmrelease/objects.yaml b/cmd/flux/testdata/debug_helmrelease/objects.yaml index 50a96f1a47..060aa71cfe 100644 --- a/cmd/flux/testdata/debug_helmrelease/objects.yaml +++ b/cmd/flux/testdata/debug_helmrelease/objects.yaml @@ -38,6 +38,10 @@ spec: - kind: Secret name: test valuesKey: secrets.yaml + - kind: Secret + name: test + valuesKey: flatValue + targetPath: aFlatValue - kind: ConfigMap name: none optional: true @@ -61,3 +65,4 @@ stringData: secrets.yaml: | secret: "test" override: "secret" + flatValue: some-flat-value diff --git a/cmd/flux/testdata/debug_helmrelease/values-from.golden.yaml b/cmd/flux/testdata/debug_helmrelease/values-from.golden.yaml index c625f83159..b436b0e893 100644 --- a/cmd/flux/testdata/debug_helmrelease/values-from.golden.yaml +++ b/cmd/flux/testdata/debug_helmrelease/values-from.golden.yaml @@ -1,3 +1,4 @@ +aFlatValue: some-flat-value cm: test image: repository: stefanprodan/podinfo