Skip to content

Commit 8ff9c10

Browse files
rbm897dominiquemetz
authored andcommitted
feat(keycloakx): add commonLabels to apply labels across all chart resources
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>
1 parent 81aa9d7 commit 8ff9c10

5 files changed

Lines changed: 13 additions & 0 deletions

File tree

charts/keycloakx/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ The following table lists the configurable parameters of the Keycloak-X chart an
6868
| `nameOverride` | Optionally override the name | `""` |
6969
| `namespaceOverride` | Optionally override the namespace for all resources. Useful for umbrella charts that deploy multiple aliased keycloak instances each into their own namespace. | `""` |
7070
| `replicas` | The number of replicas to create | `1` |
71+
| `commonLabels` | Additional labels applied to every resource in this chart, and on the StatefulSet's pods | `{}` |
7172
| `image.repository` | The Keycloak image repository | `quay.io/keycloak/keycloak` |
7273
| `image.tag` | Overrides the Keycloak image tag whose default is the chart version | `""` |
7374
| `image.digest` | Overrides the Keycloak image tag with a digest | `""` |

charts/keycloakx/templates/_helpers.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ helm.sh/chart: {{ include "keycloak.chart" . }}
3737
{{ include "keycloak.selectorLabels" . }}
3838
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | toString | trunc 63 | quote }}
3939
app.kubernetes.io/managed-by: {{ .Release.Service }}
40+
{{- range $key, $value := .Values.commonLabels }}
41+
{{ printf "%s: %s" $key (tpl $value $ | quote) }}
42+
{{- end }}
4043
{{- end }}
4144

4245
{{/*

charts/keycloakx/templates/statefulset.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ spec:
3838
{{- end }}
3939
labels:
4040
{{- include "keycloak.selectorLabels" . | nindent 8 }}
41+
{{- range $key, $value := .Values.commonLabels }}
42+
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 8 }}
43+
{{- end }}
4144
{{- range $key, $value := .Values.podLabels }}
4245
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 8 }}
4346
{{- end }}

charts/keycloakx/values.schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@
109109
"command": {
110110
"type": "array"
111111
},
112+
"commonLabels": {
113+
"type": "object"
114+
},
112115
"enableServiceLinks": {
113116
"type": "boolean"
114117
},

charts/keycloakx/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ namespaceOverride: ""
1111
# The number of replicas to create (has no effect if autoscaling enabled)
1212
replicas: 1
1313

14+
# Additional labels applied to every resource in this chart, and on the StatefulSet's pods
15+
commonLabels: {}
16+
1417
image:
1518
# The Keycloak image repository
1619
repository: quay.io/keycloak/keycloak

0 commit comments

Comments
 (0)