Fix command debug hr not taking targetPath into account

Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
pull/5227/head
Matheus Pimenta 2 weeks ago
parent 04d87be082
commit 24057743bb
No known key found for this signature in database
GPG Key ID: DE594AAD698A94DE

@ -21,7 +21,6 @@ import (
"fmt" "fmt"
helmv2 "github.com/fluxcd/helm-controller/api/v2" helmv2 "github.com/fluxcd/helm-controller/api/v2"
"github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/chartutil" "github.com/fluxcd/pkg/chartutil"
"github.com/go-logr/logr" "github.com/go-logr/logr"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -93,23 +92,12 @@ func debugHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
} }
if debugHelmReleaseArgs.showValues { 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, finalValues, err := chartutil.ChartValuesFromReferences(ctx,
logr.Discard(), logr.Discard(),
kubeClient, kubeClient,
hr.GetNamespace(), hr.GetNamespace(),
hr.GetValues(), hr.GetValues(),
valuesRefs...) hr.Spec.ValuesFrom...)
if err != nil { if err != nil {
return err return err
} }

@ -38,6 +38,10 @@ spec:
- kind: Secret - kind: Secret
name: test name: test
valuesKey: secrets.yaml valuesKey: secrets.yaml
- kind: Secret
name: test
valuesKey: flatValue
targetPath: aFlatValue
- kind: ConfigMap - kind: ConfigMap
name: none name: none
optional: true optional: true
@ -61,3 +65,4 @@ stringData:
secrets.yaml: | secrets.yaml: |
secret: "test" secret: "test"
override: "secret" override: "secret"
flatValue: some-flat-value

@ -1,3 +1,4 @@
aFlatValue: some-flat-value
cm: test cm: test
image: image:
repository: stefanprodan/podinfo repository: stefanprodan/podinfo

Loading…
Cancel
Save