Skip to content

Conversation

@tincho-burgos
Copy link
Contributor

Enabling the tempo-distributed HelmChart to have commonLabels that will be added to all K8S created.

Signed-off-by: Martin Burgos [email protected]

@CLAassistant
Copy link

CLAassistant commented Sep 20, 2025

CLA assistant check
All committers have signed the CLA.

@KyriosGN0
Copy link
Contributor

@tincho-burgos why not merge the logic to the tempo.labels?

@tincho-burgos
Copy link
Contributor Author

It thought about that, but if I want to have some labels for expense tracking purposes, it wouldn't make sense to have those as part of the labels selectors.
Basically, I'm trying to add labels in an easy way (that I'll use later to filter resources) without affecting the current functionality.

@tincho-burgos
Copy link
Contributor Author

Hi @Sheikh-Abubaker @BitProcessor @faustodavid,
Are you ok with this PR?

@tincho-burgos
Copy link
Contributor Author

Hi @Sheikh-Abubaker @BitProcessor @faustodavid @swartz-k,
Could you please take a minute to review this PR? It helps to tag all K8S resources.

@tincho-burgos tincho-burgos force-pushed the mburgos/Adding_commonLabels_to_tempo-distributed branch 3 times, most recently from 51c19d5 to c582fe7 Compare September 29, 2025 07:09
@tincho-burgos
Copy link
Contributor Author

Hi @Sheikh-Abubaker @BitProcessor @faustodavid @swartz-k, Could you please take a minute to review this PR? It helps to tag all K8S resources.

Can you please take a look at it? @Sheikh-Abubaker @BitProcessor @faustodavid @swartz-k

@tincho-burgos tincho-burgos changed the title Adding commonLabels for tempo-distributed HC. With this we'll be able to add labels to all K8S resources the chart is creating. [tempo-distributed] Adding commonLabels for tempo-distributed HC. With this we'll be able to add labels to all K8S resources the chart is creating. Oct 10, 2025
@tincho-burgos
Copy link
Contributor Author

Can you please take a look at it? @Sheikh-Abubaker @BitProcessor @faustodavid @swartz-k
It's been over a month for this.

@tincho-burgos tincho-burgos force-pushed the mburgos/Adding_commonLabels_to_tempo-distributed branch from d0016a7 to a9f8e0e Compare October 22, 2025 10:16
@tincho-burgos
Copy link
Contributor Author

Can you please take a look at it? @Sheikh-Abubaker @BitProcessor @faustodavid @swartz-k
Fixed linting, ran helm-docs.

@tincho-burgos tincho-burgos force-pushed the mburgos/Adding_commonLabels_to_tempo-distributed branch from 07b128d to 74ad534 Compare October 27, 2025 08:16
@tincho-burgos
Copy link
Contributor Author

Can you please take a look at it? @Sheikh-Abubaker @BitProcessor @faustodavid @swartz-k
Rebasing main, bump chart and ran helm-docs

@tincho-burgos tincho-burgos force-pushed the mburgos/Adding_commonLabels_to_tempo-distributed branch from 11385f9 to 3f24f1d Compare October 27, 2025 08:27
@QuentinBisson
Copy link
Collaborator

QuentinBisson commented Oct 27, 2025

@tincho-burgos this is a good idea but I probably would have only updated the helpers file by adding the common Label in the tempo.labels and tempo.podLabels that are already in the helpers file

@Sheikh-Abubaker
Copy link
Collaborator

Sheikh-Abubaker commented Oct 28, 2025

@tincho-burgos Thanks for your contribution! it looks great, before we could proceed to merging it, I would like to elaborate on @QuentinBisson's above #3909 (comment)

  • It would be much more clear and less confusing to folks, if the convention could be customLabels instead of commonLabels in the values.yaml file.

  • The tempo.commonLabels helper function is perfect to wrap around the commonLabels logic from values.yaml file. However if we could wrap that exact logic within tempo.labels and tempo.podLabels helper function because every other resource include these functions thus achieving the desired goal of your new helper function i.e tempo.commonLabels in this case, the code looks more clean, less complex with minimal changes.

  • For example tempo.labels helper function :

{{/*
Simple resource labels
*/}}
{{- define "tempo.labels" -}}
helm.sh/chart: {{ include "tempo.chart" .ctx }}
app.kubernetes.io/name: {{ include "tempo.name" .ctx }}
app.kubernetes.io/instance: {{ .ctx.Release.Name }}
{{- if .component }}
app.kubernetes.io/component: {{ .component }}
{{- end }}
{{- if .memberlist }}
app.kubernetes.io/part-of: memberlist
{{- end }}
{{- if .ctx.Chart.AppVersion }}
app.kubernetes.io/version: {{ .ctx.Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .ctx.Release.Service }}
{{- end -}}
{{/*
Custom labels for resources
*/}}
{{- with .Values.customLabels }}
{{ toYaml . }}
{{- end }}
{{- end -}}
  • Please try a similar approach as above for tempo.podLabels function as well.

@QuentinBisson
Copy link
Collaborator

@Sheikh-Abubaker in that case, would it not be better to define global.labels and global.podLabels instead of customLabels? This is a breaking change though

@Sheikh-Abubaker
Copy link
Collaborator

@Sheikh-Abubaker in that case, would it not be better to define global.labels and global.podLabels instead of customLabels? This is a breaking change though

I guess so, could you elaborate more ?

@QuentinBisson
Copy link
Collaborator

First of, this would make this chart use the same patterns for label as the Loki and Mimir helm charts which provides the global.podLabels and global.podAnnotations fields.

Those are useful, specifically in the context of subcharts because those are also passed around.

For instance, I would find it useful to add tempo culture as a subchart. Following this global pattern would ensure that subcharts could use those labels as well

@Sheikh-Abubaker
Copy link
Collaborator

Sheikh-Abubaker commented Oct 29, 2025

Following this global pattern would ensure that subcharts could use those labels as well

That's even better as it aligns with loki and mimir charts maintaining consistency, more simpler for umbrella chart scenarios and aligns well with this PR's scope as well! sounds good to me!

sringel and others added 9 commits November 4, 2025 11:03
Signed-off-by: Sean Ringel <[email protected]>
Signed-off-by: Martin Burgos <[email protected]>
Signed-off-by: Sean Ringel <[email protected]>
Signed-off-by: Martin Burgos <[email protected]>
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Martin Burgos <[email protected]>
Signed-off-by: hwwi <[email protected]>
Signed-off-by: Martin Burgos <[email protected]>
…d annotations

Signed-off-by: Sean Ringel <[email protected]>
Signed-off-by: Martin Burgos <[email protected]>
Signed-off-by: Sean Ringel <[email protected]>
Signed-off-by: Martin Burgos <[email protected]>
Signed-off-by: Quentin Bisson <[email protected]>
Signed-off-by: Martin Burgos <[email protected]>
@tincho-burgos tincho-burgos force-pushed the mburgos/Adding_commonLabels_to_tempo-distributed branch from dd0cae8 to 4c0bcb0 Compare November 4, 2025 10:03
@tincho-burgos tincho-burgos force-pushed the mburgos/Adding_commonLabels_to_tempo-distributed branch from c2f239e to 1d3c0ad Compare November 4, 2025 13:30
@tincho-burgos
Copy link
Contributor Author

Hey @QuentinBisson @Sheikh-Abubaker,

Just to confirm I made the changes and bumped the chart version.

@Sheikh-Abubaker
Copy link
Collaborator

Hey @QuentinBisson @Sheikh-Abubaker,

Just to confirm I made the changes and bumped the chart version.

@tincho-burgos Thank you for the changes, look good to me! I just merged a PR so you'd need to bump version again.

Signed-off-by: Martin Burgos <[email protected]>
@tincho-burgos tincho-burgos force-pushed the mburgos/Adding_commonLabels_to_tempo-distributed branch from 9400bf3 to cbe41ab Compare November 4, 2025 13:40
@tincho-burgos
Copy link
Contributor Author

@Sheikh-Abubaker Done!

@Sheikh-Abubaker
Copy link
Collaborator

Sheikh-Abubaker commented Nov 4, 2025

Signed-off-by: Martin Burgos <[email protected]>
@tincho-burgos
Copy link
Contributor Author

@Sheikh-Abubaker Done! Apologies for that, I missed the excluding pods part

Signed-off-by: Martin Burgos <[email protected]>
@tincho-burgos
Copy link
Contributor Author

@Sheikh-Abubaker , I have added an if to bypass the error if it's empty.

==> Linting charts/tempo-distributed Error: templates/: template: tempo-distributed/templates/query-frontend/service-query-frontend.yaml:7:8: executing "tempo-distributed/templates/query-frontend/service-query-frontend.yaml" at <include "tempo.labels" (dict "ctx" . "component" "query-frontend")>: error calling include: template: tempo-distributed/templates/_helpers.tpl:93:16: executing "tempo.labels" at <.Values.global.commonLabels>: nil pointer evaluating interface {}.global

Signed-off-by: Martin Burgos <[email protected]>
@tincho-burgos
Copy link
Contributor Author

@Sheikh-Abubaker it should work now.

@Sheikh-Abubaker
Copy link
Collaborator

Sheikh-Abubaker commented Nov 4, 2025

I have added an if to bypass the error if it's empty.

That wouldn't help because it wasn't a with or if problem, what we actually need is .ctx.Values.global.commonLables I suppose due to the temporary dict being created here so we would need to call it via ctx

{{- include "tempo.labels" (dict "ctx" . "component" "query-frontend") | nindent 4 }}

Copy link
Collaborator

@Sheikh-Abubaker Sheikh-Abubaker left a comment

Choose a reason for hiding this comment

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

LGTM!

@tincho-burgos
Copy link
Contributor Author

@Sheikh-Abubaker Thanks for the help!

@Sheikh-Abubaker Sheikh-Abubaker merged commit 0db5800 into grafana:main Nov 4, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.