6

I created a helm chart which is deriving value of app.kubernetes.io/instance from a template value like this:

labels:
    app.kubernetes.io/name: {{ include "mychart.name" . }}
    helm.sh/chart: {{ include "mychart.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}

I don't know in which file and how to override its value. I don't want to override it by command line as described at Helm how to define .Release.Name value

Ryan Dawson
  • 11,832
  • 5
  • 38
  • 61
Prateek Jain
  • 2,738
  • 4
  • 28
  • 42
  • Why is it that you would like to set the .Release.Name in the chart? I am thinking there may be other ways to address your concern. – Ryan Dawson Nov 28 '18 at 07:52
  • The idea is to treat delivered package as installer for deployer (with no configuration provided) and still be able to control the names of services, deployemnts etc. Anyways, I might be just speculating too much as part of my learning. – Prateek Jain Nov 28 '18 at 13:30
  • You could control the names of the services and deployments etc. by setting fixed names in those resources or a name from the values.yaml. See https://docs.helm.sh/chart_best_practices/#resource-naming-in-templates – Ryan Dawson Nov 28 '18 at 13:35

1 Answers1

8

The intention is that you don't set the .Release.Name within the helm chart. It is either set to an automatically generated value by helm when the user runs helm install or is set by the user as a parameter with helm install <name>. Imagine if the chart were to set the value of .Release.Name - the user would still be able to set a different value for it with helm install <name> and there would then be a conflict where it wouldn't be clear which name would be used.

Ryan Dawson
  • 11,832
  • 5
  • 38
  • 61