Skip to content

feat: add global.commonLabels support to camunda-load-tests chart#58

Open
ChrisKujawa wants to merge 8 commits into
mainfrom
feat/global-common-labels
Open

feat: add global.commonLabels support to camunda-load-tests chart#58
ChrisKujawa wants to merge 8 commits into
mainfrom
feat/global-common-labels

Conversation

@ChrisKujawa

Copy link
Copy Markdown
Member

Summary

  • Add global.commonLabels value and a camunda-load-tests.commonLabels helper in _helpers.tpl
  • Inject the helper into all six resource templates (starter, workers, clients-service, credentials, load-test-config, service monitor) — metadata labels only, never selector.matchLabels
  • Add Terratest golden-file tests covering starter.yaml, workers.yaml, and clients-service.yaml with camunda.io/created-by and camunda.io/purpose labels
  • Update 21 existing golden files to match the new template output (empty-line whitespace from the no-op helper path)

Motivation

Enables the camunda/camunda load-test setup scripts to propagate author and purpose labels to
every Kubernetes resource via global.commonLabels:

global:
  commonLabels:
    camunda.io/created-by: <git-user>
    camunda.io/purpose: load-test

These labels are already present in load-test-values.yaml (camunda/camunda#51880) but had no
effect until this chart added support. With both changes in place, cost attribution and logging
alerts can be driven from per-resource labels without resolving the namespace first.

Test Plan

  • Run go test ./charts/camunda-load-tests/test/... — all golden tests pass
  • Deploy a load test with global.commonLabels set and verify labels appear on Pods/Deployments/Services
  • Verify no labels appear under selector.matchLabels on any Deployment

🤖 Generated with Claude Code

Templates now include a commonLabels block; when no labels are set the
helper renders an empty line. Update all pre-existing golden files to
match the new template output so the full suite stays green.
{{- if ... }} (no trailing dash) left the newline between the if tag and
{{ tpl }} in the output, so the helper returned \n<yaml>. nindent then
prepended another \n, producing a blank line before each injected label.
Changing to {{- if ... -}} trims that newline, keeping output clean.
nindent always emits a leading newline even for empty input, producing a
blank line in the rendered YAML when global.commonLabels is not set.
Wrap each call site with {{- if .Values.global.commonLabels }} so the
nindent call is skipped entirely when no labels are configured.
@ChrisKujawa ChrisKujawa marked this pull request as ready for review May 3, 2026 16:13
Copilot AI review requested due to automatic review settings May 3, 2026 16:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for propagating user-defined labels (global.commonLabels) into the camunda-load-tests Helm chart so that every rendered Kubernetes resource can receive consistent metadata labels.

Changes:

  • Introduces global.commonLabels in values.yaml and a camunda-load-tests.commonLabels helper in _helpers.tpl.
  • Injects the helper into multiple templates’ metadata.labels (and pod template labels for Deployments).
  • Adds Terratest golden tests and golden files to validate common-label rendering.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
charts/camunda-load-tests/values.yaml Adds the new global.commonLabels value and documentation.
charts/camunda-load-tests/templates/_helpers.tpl Adds camunda-load-tests.commonLabels helper to render global.commonLabels.
charts/camunda-load-tests/templates/workers.yaml Injects common labels into Deployment metadata and pod template labels.
charts/camunda-load-tests/templates/starter.yaml Injects common labels into Deployment metadata and pod template labels.
charts/camunda-load-tests/templates/clients-service.yaml Injects common labels into Service and ServiceMonitor metadata labels.
charts/camunda-load-tests/templates/load-test-config.yaml Injects common labels into ConfigMap metadata labels.
charts/camunda-load-tests/templates/credentials.yaml Adds Secret metadata labels section for common labels.
charts/camunda-load-tests/test/common_labels_test.go Adds golden tests to assert common labels are rendered.
charts/camunda-load-tests/test/golden/golden-saas-with-extra-config-workers.golden.yaml Updates expected checksum output due to template changes.
charts/camunda-load-tests/test/golden/golden-saas-with-extra-config-starter.golden.yaml Updates expected checksum output due to template changes.
charts/camunda-load-tests/test/golden/golden-credentials-workers.golden.yaml Updates expected checksum output due to template changes.
charts/camunda-load-tests/test/golden/golden-credentials-starter.golden.yaml Updates expected checksum output due to template changes.
charts/camunda-load-tests/test/golden/golden-credentials-credentials.golden.yaml Updates expected Secret rendering (now includes labels:).
charts/camunda-load-tests/test/golden/golden-common-labels-workers.golden.yaml New golden file validating common labels on workers Deployment.
charts/camunda-load-tests/test/golden/golden-common-labels-starter.golden.yaml New golden file validating common labels on starter Deployment.
charts/camunda-load-tests/test/golden/golden-common-labels-clients-service.golden.yaml New golden file validating common labels on clients Service/ServiceMonitor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread charts/camunda-load-tests/templates/credentials.yaml
Comment on lines 5 to 8
labels:
app: starter
{{- if .Values.global.commonLabels }}{{ include "camunda-load-tests.commonLabels" . | nindent 4 }}{{- end }}
spec:
Comment on lines 6 to 9
labels:
app: {{ $workerName }}
{{- if $.Values.global.commonLabels }}{{ include "camunda-load-tests.commonLabels" $ | nindent 4 }}{{- end }}
spec:
Comment on lines 15 to 19
labels:
app: starter
app.kubernetes.io/component: zeebe-client
{{- if .Values.global.commonLabels }}{{ include "camunda-load-tests.commonLabels" . | nindent 8 }}{{- end }}
annotations:
Comment on lines 17 to +19
app: {{ $workerName }}
app.kubernetes.io/component: zeebe-client
{{- if $.Values.global.commonLabels }}{{ include "camunda-load-tests.commonLabels" $ | nindent 8 }}{{- end }}
@ChrisKujawa ChrisKujawa requested a review from multani May 4, 2026 06:10

@multani multani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ChrisKujawa should we merge the camunda-load-tests.labels template and camunda-load-tests.commonLabels templates together and set by default everywhere labels: {{- include "camunda-load-tests.labels" . | nindent 4 }} (+ more labels, if needed?)

This would move the if to check if Values.global.commonLabels is set into the camunda-load-tests.labels template:

  • you won't need to add it in all the target resources
  • this would also remove the current double if you have (once in the template, once in the resources using the template)

@ChrisKujawa

Copy link
Copy Markdown
Member Author

@multani do you mean this one https://github.com/camunda/camunda-load-tests-helm/blob/main/charts/camunda-load-tests/templates/_helpers.tpl#L58-L68 ? i think makes sense. Currently wondering why Starter and worker are actually not using it 🤔

@multani

multani commented May 5, 2026

Copy link
Copy Markdown
Member

@multani do you mean this one main/charts/camunda-load-tests/templates/_helpers.tpl#L58-L68 ? i think makes sense. Currently wondering why Starter and worker are actually not using it 🤔

Yes, this one. I think it could be used everywhere (also not sure why it's not the case 🤔 ) and you can integrate your new global labels into it 👍

@ChrisKujawa

Copy link
Copy Markdown
Member Author

Good point I will look into this 👍🏼

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.

3 participants