You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Helm chart does not currently provide an easy way to add additional labels to resources. I would like to be able to pass a commonLabels variable or similar that can be appended to all resources created by the chart, particularly in the Deployment and pod template.
Workaround
I have a partial workaround, which is to override the helper template in a wrapper chart like so, which will add labels to the deployment and the pod template:
{{/*Selector labels*/}}{{- define "safe-settings.selectorLabels" -}}{{- range $key, $value := .Values.commonLabels }}{{ $key }}: {{ $value }}{{- end }}app.kubernetes.io/name: {{ include "safe-settings.name" . }}app.kubernetes.io/instance: {{ .Release.Name }}{{- end }}
However, this has the drawback of forcing a replacement of the deployment if I ever wish to change a label, as spec.selector is immutable, so a new labels variable should not affect the selector.
The text was updated successfully, but these errors were encountered:
New Feature
The Helm chart does not currently provide an easy way to add additional labels to resources. I would like to be able to pass a
commonLabels
variable or similar that can be appended to all resources created by the chart, particularly in the Deployment and pod template.Workaround
I have a partial workaround, which is to override the helper template in a wrapper chart like so, which will add labels to the deployment and the pod template:
However, this has the drawback of forcing a replacement of the deployment if I ever wish to change a label, as spec.selector is immutable, so a new labels variable should not affect the selector.
The text was updated successfully, but these errors were encountered: