feat(keycloakx): add commonLabels to apply labels across all chart resources#912
Merged
dominiquemetz merged 1 commit intoJul 13, 2026
Merged
Conversation
…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>
Contributor
|
Thank you for contribution, looks good to me! |
Contributor
Author
|
Thank you for the review and merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #915
Summary
Adds a
commonLabelsvalue to thekeycloakxchart. Today, applying the same label to every resource in the chart (e.g. a cost-allocation tag) requires copying it into ~13 separate per-resourcelabelsfields (podLabels,statefulsetLabels,service.*.labels,ingress.labels, etc.).commonLabelslets you define it once and have it applied everywhere, including the StatefulSet's pods.Changes
values.yaml/values.schema.json: newcommonLabels: {}value.templates/_helpers.tpl:commonLabelsis merged into the existingkeycloak.labelshelper, 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 includekeycloak.labels, socommonLabelsis applied there separately, betweenselectorLabelsandpodLabels.README.md: documents the new parameter.Selector fields (
keycloak.selectorLabels/ allmatchLabels) are untouched, and none of the existing per-resourcelabelsfields are modified —commonLabelsis purely additive.On a label-key collision, the user's
commonLabelsvalue 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 specificlabelsfield (e.g.podLabels) still takes precedence overcommonLabels.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/keycloakxpasseshelm templatewithcommonLabelsset 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 templatecommonLabelskey matching a built-in label (e.g.app.kubernetes.io/managed-by) ends up with the user's valuecommonLabelskey matching apodLabelskey ends up with thepodLabelsvalue on the pod templatecommonLabels: {}) renders identically to the pre-change chart — no behavior change for existing users