Skip to content

Commit

Permalink
Fix command debug hr not taking targetPath into account
Browse files Browse the repository at this point in the history
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
  • Loading branch information
matheuscscp committed Mar 3, 2025
1 parent 04d87be commit 2405774
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
14 changes: 1 addition & 13 deletions cmd/flux/debug_helmrelease.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/flux/testdata/debug_helmrelease/objects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -61,3 +65,4 @@ stringData:
secrets.yaml: |
secret: "test"
override: "secret"
flatValue: some-flat-value
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
aFlatValue: some-flat-value
cm: test
image:
repository: stefanprodan/podinfo
Expand Down

0 comments on commit 2405774

Please sign in to comment.