I have a values file values-production.yaml
with comments such as:
# some other comments
# another comments
image: xxxx
And I use command helm install -n=test --values=values-production.yaml some-chart
to deploy application on my Cluster. But, when I used command helm get values test
, the result just like this:
image: xxx
There is no any comments. Where is my comments? How to keep comments?
My Helm version: Client: v2.11.0 Server: v2.11.0
This is impossible, as helm install
doesn't upload your values-production.yaml
file as is. Rather, it constructs an object representing all the values from various defaults and inputs, then converts that object into a file that it posts to the server. Any comments will be lost in the conversion to the object.
The core of how the helm install
command is implemented is here:
func (i *installCmd) run() error {
// omitting some code
// note below rawVals is the output of the vals function
rawVals, err := vals(i.valueFiles, i.values, i.stringValues, i.fileValues, i.certFile, i.keyFile, i.caFile)
// omitting some code
// note below the client asks the server to install the chart, passing values
// via rawVals constructed above
res, err := i.client.InstallReleaseFromChart(
chartRequested,
i.namespace,
helm.ValueOverrides(rawVals),
helm.ReleaseName(i.name),
helm.InstallDryRun(i.dryRun),
helm.InstallReuseName(i.replace),
helm.InstallDisableHooks(i.disableHooks),
helm.InstallDisableCRDHook(i.disableCRDHook),
helm.InstallSubNotes(i.subNotes),
helm.InstallTimeout(i.timeout),
helm.InstallWait(i.wait),
helm.InstallDescription(i.description))
// more code omitted
}
and here is what vals
does -- notes that the data from the value files goes into the base
object and that thing is what is finally serialized to YAML and returned by vals
:
func vals(valueFiles valueFiles, values []string, stringValues []string, fileValues []string, CertFile, KeyFile, CAFile string) ([]byte, error) {
base := map[string]interface{}{}
// omitting code that populates base with all the values from valuesFiles, etc.
return yaml.Marshal(base)
}
Helm isn't intended to be used for file-sharing, if there's text in values-production.yaml
that you want to store, retrieve, and share that isn't semantically meaningful to Helm (like comments), you'll have to consider a different solution. Not sure what your use-case is, but you could consider some blobstore service, DropBox, etc.