Skip to content

feat(keycloakx): add commonLabels to apply labels across all chart resources#912

Merged
dominiquemetz merged 1 commit into
codecentric:masterfrom
rbm897:feat/keycloakx-common-labels
Jul 13, 2026
Merged

feat(keycloakx): add commonLabels to apply labels across all chart resources#912
dominiquemetz merged 1 commit into
codecentric:masterfrom
rbm897:feat/keycloakx-common-labels

Conversation

@rbm897

@rbm897 rbm897 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Closes #915

Summary

Adds a commonLabels value to the keycloakx chart. Today, applying the same label to every resource in the chart (e.g. a cost-allocation tag) requires copying it into ~13 separate per-resource labels fields (podLabels, statefulsetLabels, service.*.labels, ingress.labels, etc.). commonLabels lets you define it once and have it applied everywhere, including the StatefulSet's pods.

Changes

  • values.yaml / values.schema.json: new commonLabels: {} value.
  • templates/_helpers.tpl: commonLabels is merged into the existing keycloak.labels helper, which is already included by every resource template in the chart (StatefulSet, both Services, Ingress, HTTPRoute, Route, RBAC, ServiceAccount, ConfigMap, Secret, HPA, PodDisruptionBudget, PrometheusRule, ServiceMonitor, NetworkPolicy, test Pod/ConfigMap) — one change propagates to all of them.
  • templates/statefulset.yaml: the pod template (spec.template.metadata.labels) doesn't include keycloak.labels, so commonLabels is applied there separately, between selectorLabels and podLabels.
  • README.md: documents the new parameter.

Selector fields (keycloak.selectorLabels / all matchLabels) are untouched, and none of the existing per-resource labels fields are modified — commonLabels is purely additive.

On a label-key collision, the user's commonLabels value takes precedence over the chart's own built-in labels (helm.sh/chart, app.kubernetes.io/version, app.kubernetes.io/managed-by), and a resource's own specific labels field (e.g. podLabels) still takes precedence over commonLabels.

No manual chart version bump — this repo bumps automatically from commit message keywords (this PR's commit message includes feat, so it triggers a minor bump).

Test plan

  • helm lint ./charts/keycloakx passes
  • helm template with commonLabels set renders the label on every resource kind the chart can produce (14 kinds with all optional resources enabled), plus once more on the StatefulSet's pod template
  • Collision precedence verified: a commonLabels key matching a built-in label (e.g. app.kubernetes.io/managed-by) ends up with the user's value
  • Collision precedence verified: a commonLabels key matching a podLabels key ends up with the podLabels value on the pod template
  • Default (commonLabels: {}) renders identically to the pre-change chart — no behavior change for existing users

…sources

Adds a commonLabels value so a user-defined label set can be applied
once and propagated to every resource this chart renders, including
the StatefulSet's pods, without touching selector fields.

Signed-off-by: Ram Bhajan Mishra <rbm897@gmail.com>
@rbm897
rbm897 requested a review from a team as a code owner July 7, 2026 12:07
@rbm897 rbm897 changed the title keycloakx: add commonLabels to apply labels across all chart resources feat(keycloakx): add commonLabels to apply labels across all chart resources Jul 7, 2026
@dominiquemetz dominiquemetz self-assigned this Jul 13, 2026

@dominiquemetz dominiquemetz 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.

Sorry, my llm agent has pushed its "findings" automatically as a review. I will need to verify the findings and will come back to this PR later

Comment thread charts/keycloakx/templates/_helpers.tpl
Comment thread charts/keycloakx/values.schema.json
Comment thread charts/keycloakx/templates/statefulset.yaml
@dominiquemetz

Copy link
Copy Markdown
Contributor

Thank you for contribution, looks good to me!

@dominiquemetz
dominiquemetz merged commit 8ff9c10 into codecentric:master Jul 13, 2026
3 checks passed
@rbm897
rbm897 deleted the feat/keycloakx-common-labels branch July 13, 2026 14:46
@rbm897

rbm897 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the review and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

keycloakx: support commonLabels to apply labels across all chart resources

2 participants