Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature: [Helm Chart] Add custom labels to resources #703

Open
ejstreet opened this issue Oct 24, 2024 · 0 comments
Open

Feature: [Helm Chart] Add custom labels to resources #703

ejstreet opened this issue Oct 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ejstreet
Copy link

ejstreet commented Oct 24, 2024

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:

{{/*
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.

@ejstreet ejstreet added the enhancement New feature or request label Oct 24, 2024
@ejstreet ejstreet changed the title [Helm Chart] Add custom labels to resources Feature: [Helm Chart] Add custom labels to resources Oct 24, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant