From 53ff818aedc9bf970cc24fd0ad20b7865678de57 Mon Sep 17 00:00:00 2001 From: samuelarogbonlo Date: Tue, 14 Jan 2025 09:32:03 +0100 Subject: [PATCH] feat: support custom labels for internal service This change allows configuring labels specifically for the internal service without affecting the main controller service, useful for external-dns configuration. The commit also includes minor YAML indentation fixes in the deployment template. --- .../ingress-nginx/ci/controller-service-internal-values.yaml | 2 ++ .../ingress-nginx/templates/controller-service-internal.yaml | 3 +++ charts/ingress-nginx/values.yaml | 2 ++ 3 files changed, 7 insertions(+) diff --git a/charts/ingress-nginx/ci/controller-service-internal-values.yaml b/charts/ingress-nginx/ci/controller-service-internal-values.yaml index 11108fbce9..257ffbf7e7 100644 --- a/charts/ingress-nginx/ci/controller-service-internal-values.yaml +++ b/charts/ingress-nginx/ci/controller-service-internal-values.yaml @@ -11,3 +11,5 @@ controller: enabled: true annotations: service.beta.kubernetes.io/aws-load-balancer-internal: "true" + labels: + external-dns.alpha.kubernetes.io/hostname: internal.example.com diff --git a/charts/ingress-nginx/templates/controller-service-internal.yaml b/charts/ingress-nginx/templates/controller-service-internal.yaml index 24ac032acc..8d369526da 100644 --- a/charts/ingress-nginx/templates/controller-service-internal.yaml +++ b/charts/ingress-nginx/templates/controller-service-internal.yaml @@ -12,6 +12,9 @@ metadata: {{- if .Values.controller.service.labels }} {{- toYaml .Values.controller.service.labels | nindent 4 }} {{- end }} + {{- if .Values.controller.service.internal.labels }} + {{- toYaml .Values.controller.service.internal.labels | nindent 4 }} + {{- end }} name: {{ include "ingress-nginx.controller.fullname" . }}-internal namespace: {{ include "ingress-nginx.namespace" . }} spec: diff --git a/charts/ingress-nginx/values.yaml b/charts/ingress-nginx/values.yaml index 9875b36933..be41ce2a87 100644 --- a/charts/ingress-nginx/values.yaml +++ b/charts/ingress-nginx/values.yaml @@ -580,6 +580,8 @@ controller: # -- Type of the internal controller service. # Defaults to the value of `controller.service.type`. # Ref: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + labels: {} + # -- Type of the internal controller service. type: "" # -- Pre-defined cluster internal IP address of the internal controller service. Take care of collisions with existing services. # This value is immutable. Set once, it can not be changed without deleting and re-creating the service.