From c3452a3be6e06daaf199f57c2dce42d844cbc8c4 Mon Sep 17 00:00:00 2001 From: Valentin Thomas Date: Tue, 10 Feb 2026 17:22:53 +0100 Subject: [PATCH 1/5] feat: add custom labels to service Signed-off-by: Valentin Thomas --- charts/coredns/templates/_helpers.tpl | 10 ++++++++++ charts/coredns/templates/service.yaml | 4 +--- charts/coredns/values.yaml | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/charts/coredns/templates/_helpers.tpl b/charts/coredns/templates/_helpers.tpl index 2c2a9d61f..2ec6af3aa 100644 --- a/charts/coredns/templates/_helpers.tpl +++ b/charts/coredns/templates/_helpers.tpl @@ -234,3 +234,13 @@ Create the name of the service account to use {{ template "coredns.fullname" . }} {{- end -}} {{- end -}} + +{{/* +Generate the service labels +*/}} +{{- define "coredns.service.labels" -}} +{{- $labels := merge (deepCopy (.Values.service.labels | default dict)) (.Values.customLabels | default dict) }} +{{- if $labels }} +{{ toYaml $labels }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/coredns/templates/service.yaml b/charts/coredns/templates/service.yaml index 1247d09b8..366f42380 100644 --- a/charts/coredns/templates/service.yaml +++ b/charts/coredns/templates/service.yaml @@ -6,9 +6,7 @@ metadata: name: {{ default (include "coredns.fullname" .) .Values.service.name }} namespace: {{ .Release.Namespace }} labels: {{- include "coredns.labels" . | nindent 4 }} -{{- if .Values.customLabels }} -{{ toYaml .Values.customLabels | indent 4 }} -{{- end }} +{{- include "coredns.service.labels" . | indent 4 }} {{- if or .Values.service.annotations .Values.customAnnotations }} annotations: {{- if .Values.service.annotations }} diff --git a/charts/coredns/values.yaml b/charts/coredns/values.yaml index 5f49cb330..496dbacca 100644 --- a/charts/coredns/values.yaml +++ b/charts/coredns/values.yaml @@ -67,6 +67,7 @@ service: annotations: {} # Pod selector selector: {} + labels: {} serviceAccount: create: false From e57d790623ac81caaff9b3a390499feb9e214e10 Mon Sep 17 00:00:00 2001 From: Valentin Thomas Date: Tue, 10 Feb 2026 17:31:47 +0100 Subject: [PATCH 2/5] chore: chart bumped with changelog Signed-off-by: Valentin Thomas --- charts/coredns/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/coredns/Chart.yaml b/charts/coredns/Chart.yaml index 8396a7893..44bbe1498 100644 --- a/charts/coredns/Chart.yaml +++ b/charts/coredns/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: coredns -version: 1.45.2 +version: 1.45.3 appVersion: 1.13.1 home: https://coredns.io icon: https://coredns.io/images/CoreDNS_Colour_Horizontal.png @@ -20,4 +20,4 @@ type: application annotations: artifacthub.io/changes: | - kind: added - description: Add configurable dnsPolicy for deployment + description: Support for service labels From 139568b8425b6020b26e8140d3639def56cd77d8 Mon Sep 17 00:00:00 2001 From: Valentin Thomas Date: Tue, 10 Feb 2026 17:32:02 +0100 Subject: [PATCH 3/5] docs: doc updated Signed-off-by: Valentin Thomas --- charts/coredns/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/coredns/README.md b/charts/coredns/README.md index c7443747e..5d39600b8 100644 --- a/charts/coredns/README.md +++ b/charts/coredns/README.md @@ -134,6 +134,7 @@ The command removes all the Kubernetes components associated with the chart and | `service.externalTrafficPolicy` | Enable client source IP preservation | [] | | `service.ipFamilyPolicy` | Service dual-stack policy | `""` | | `service.annotations` | Annotations to add to service | {} | +| `service.labels` | Labels to add to service | {} | | `service.selector` | Pod selector | `{}` | | `service.trafficDistribution` | Service traffic routing strategy | | | `serviceAccount.create` | If true, create & use serviceAccount | false | From 7b4bbccad74bf30aa41b5694ca63ba8b61a23ede Mon Sep 17 00:00:00 2001 From: Valentin Thomas Date: Tue, 10 Feb 2026 17:32:55 +0100 Subject: [PATCH 4/5] chore: reorganize values.yaml structure Signed-off-by: Valentin Thomas --- charts/coredns/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/coredns/values.yaml b/charts/coredns/values.yaml index 496dbacca..762627128 100644 --- a/charts/coredns/values.yaml +++ b/charts/coredns/values.yaml @@ -65,9 +65,9 @@ service: # If not set, a name is generated using the fullname template name: "" annotations: {} + labels: {} # Pod selector selector: {} - labels: {} serviceAccount: create: false From d30276cff246de378b42b72e75ad82cc1997e581 Mon Sep 17 00:00:00 2001 From: Valentin Thomas Date: Tue, 10 Feb 2026 17:54:28 +0100 Subject: [PATCH 5/5] refactor: simplify coredns.service.labels helper Signed-off-by: Valentin Thomas --- charts/coredns/templates/_helpers.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/coredns/templates/_helpers.tpl b/charts/coredns/templates/_helpers.tpl index 2ec6af3aa..057f823a9 100644 --- a/charts/coredns/templates/_helpers.tpl +++ b/charts/coredns/templates/_helpers.tpl @@ -239,8 +239,8 @@ Create the name of the service account to use Generate the service labels */}} {{- define "coredns.service.labels" -}} -{{- $labels := merge (deepCopy (.Values.service.labels | default dict)) (.Values.customLabels | default dict) }} -{{- if $labels }} -{{ toYaml $labels }} +{{- $labels := merge (.Values.service.labels | default dict) (.Values.customLabels | default dict) }} +{{- with $labels }} +{{ toYaml . }} {{- end }} {{- end }} \ No newline at end of file