helm: Sprig `dig` doesn't dig into chartutil.Values
For values.yaml:
smth:
deep:
here: "servus"
A new dig func coming from sprig 3.2.0 in Helm 3.5 doesn’t work with scope variables.
{{ dig "Values" "smth" "deep" "there" "default" . }}
# or
{{ dig "smth" "deep" "there" "default" .Values }}
Outputs: error calling dig: interface conversion: interface {} is chartutil.Values, not map[string]interface {}
but this works:
{{ dig "deep" "there" "default" .Values.smth }}
As a workaround, this also works:
{{ dig "smth" "deep" "there" "default" (.Values | merge (dict)) }}
Expected behaviour: dig can dig into .Values at least.
Output of helm version:
version.BuildInfo{Version:"v3.5.0", GitCommit:"32c22239423b3b4ba6706d450bd044baffdcf9e6", GitTreeState:"clean", GoVersion:"go1.15.6"}
Output of kubectl version:
not relevant
Cloud Provider/Platform (AKS, GKE, Minikube etc.):
not relevant
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 20
- Comments: 20 (3 by maintainers)
Values can easily be converted to a map: https://github.com/helm/helm/blob/v3.12.1/pkg/chartutil/values.go#L70 So why not use something like this:
{{ dig "smth" "deep" "there" "default" .Values.AsMap }}instead of the dict hack
{{ dig "smth" "deep" "there" "default" (.Values | merge (dict)) }}Isn’t that Stale bot a bit aggressive? This issue was confirmed by a contributor and still the bot was allowed to close it. That seems a bit rash for an unfixed issue
@wingsofovnia why did you use the
mergefunction in hereWhy not just calling the
dictfunction like this{{ dig "smth" "deep" "there" "default" ( .Values | dict ) }}this looks sprig related and sprig looks like a dead project https://github.com/Masterminds/sprig/graphs/code-frequency