helm-controller
helm-controller copied to clipboard
Support for YAML values in "valuesFrom" resource when using "targetPath"
Current solution
Currently when setting spec.valuesFrom.[n].targetPath
, the value from ConfigMap/Secret referred is treated as a JSON or string.
This is documented here with the information "targetPath
supports the same formatting as you would supply as an argument to the helm
binary using --set [path]=[value]
".
Proposed feature
Make possible to use spec.valuesFrom.[n].targetPath
to add root field(s) to the YAML values passed with valuesFrom
.
Example
Helm Release
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: myapp
namespace: apps
spec:
interval: 5m
releaseName: myapp
chart:
spec:
chart: appchart-with-subchart
sourceRef:
kind: HelmRepository
name: my-charts-repo
valuesFrom:
- kind: ConfigMap
name: config-values
targetPath: global # <-- targetPath set to pass values to subchart
Values ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: config-values
namespace: apps
data:
values.yaml: |
users:
user1:
alias: u1
users2:
alias: u2
Result values supplied to the HelmRelease
global:
users:
user1:
alias: u1
users2:
alias: u2
Background
Current solution has limitations which is problematic in cases when using subcharts.
We keep some configuration shared between applications in ConfigMaps and apply it with valuesFrom
functionality.
However, some Helm charts have subcharts which would also like to use these values. To supply these values to subchart we need them to be prefixed with subchart name or "global". To achieve that we need to duplicate all the values to have "global" prefix in YAML.
With the proposed feature, we could set targetPath
to "global" or subchart name and pass these values easily.
Hi. Was there any analisys and/or decision on this request? We would also love being able to use more complete merge capabilities! Thanks