Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Helm: add commonLabels (#9067) #10385

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions operations/helm/charts/mimir-distributed/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Entries should include a reference to the Pull Request that introduced the chang

## main / unreleased

* [FEATURE] Add common labels to all Mimir objects, which you can enable via global.commonLabels. #10385
* [CHANGE] Memcached: Update to Memcached 1.6.34. #10318
* [ENHANCEMENT] Minio: update subchart to v5.4.0. #10346
* [ENHANCEMENT] Individual mimir components can override their container images via the *.image values. The component's image definitions always override the values set in global `image` or `enterprise.image`. #10340
Expand Down
14 changes: 14 additions & 0 deletions operations/helm/charts/mimir-distributed/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,17 @@ Params:
{{- $resourceName -}}
{{- end -}}

{{/*
Common Labels
Params:
ctx = . context
*/}}
{{- define "mimir.commonLabels" -}}
{{- with .ctx.Values.global.commonLabels }}
{{- toYaml . }}
{{- end }}
{{- end -}}

{{/*
Resource labels
Params:
Expand Down Expand Up @@ -268,6 +279,9 @@ name: "{{ .component }}-{{ .rolloutZoneName }}" {{- /* Currently required for ro
rollout-group: {{ .component }}
zone: {{ .rolloutZoneName }}
{{- end }}
{{- if .ctx.Values.global.commonLabels }}
{{ include "mimir.commonLabels" . }}
{{- end }}
{{- end -}}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ metadata:
chart: {{ template "minio.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.global.commonLabels }}
{{- include "mimir.commonLabels" (dict "ctx" . ) | nindent 4 -}}
{{- end }}
{{- with .Values.minio.makeBucketJob.annotations }}
annotations:
{{ toYaml . | indent 4 }}
Expand Down
4 changes: 4 additions & 0 deletions operations/helm/charts/mimir-distributed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ global:
# scope: admin-api, alertmanager, compactor, distributor, gateway, ingester, memcached, nginx, overrides-exporter, querier, query-frontend, query-scheduler, ruler, store-gateway, tokengen, federation-frontend
podLabels: {}

# -- Common labels for all object directly managed this chart.
# scope: *
commonLabels: {}
Comment on lines +80 to +82
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what is the use-case for the feature, but I should point out that — in the current implementation — the global.commonLabels seem to only add labels to the top-level resources (e.g. deployments, statefulsets, configmaps, etc). It doesn't add labels to the resources, controlled by those top-levels, e.g. pods, that a deployment creates. This may be fine.


serviceAccount:
# -- Whether to create a service account or not. In case 'create' is false, do set 'name' to an existing service account name.
create: true
Expand Down