Skip to content

Commit 66edf87

Browse files
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.
1 parent 8da3423 commit 66edf87

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
controller:
2+
name: controller
3+
kind: Deployment
4+
image:
5+
registry: registry.k8s.io
6+
image: ingress-nginx/controller
7+
tag: "v1.12.0"
8+
service:
9+
enabled: true
10+
internal:
11+
enabled: true
12+
type: ClusterIP
13+
labels:
14+
external-dns.alpha.kubernetes.io/hostname: internal.example.com
15+
custom-label: test-value
16+
labels:
17+
regular-service-label: should-not-appear-on-internal

charts/ingress-nginx/templates/controller-deployment.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ spec:
3131
minReadySeconds: {{ .Values.controller.minReadySeconds }}
3232
template:
3333
metadata:
34-
{{- if .Values.controller.podAnnotations }}
34+
{{- if .Values.controller.podAnnotations }}
3535
annotations:
36-
{{- range $key, $value := .Values.controller.podAnnotations }}
36+
{{- range $key, $value := .Values.controller.podAnnotations }}
3737
{{ $key }}: {{ $value | quote }}
38+
{{- end }}
3839
{{- end }}
39-
{{- end }}
4040
labels:
4141
{{- include "ingress-nginx.labels" . | nindent 8 }}
4242
app.kubernetes.io/component: controller

charts/ingress-nginx/templates/controller-service-internal.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and .Values.controller.service.enabled .Values.controller.service.internal.enabled .Values.controller.service.internal.annotations -}}
1+
{{- if and .Values.controller.service.enabled .Values.controller.service.internal.enabled -}}
22
apiVersion: v1
33
kind: Service
44
metadata:
@@ -9,8 +9,8 @@ metadata:
99
labels:
1010
{{- include "ingress-nginx.labels" . | nindent 4 }}
1111
app.kubernetes.io/component: controller
12-
{{- if .Values.controller.service.labels }}
13-
{{- toYaml .Values.controller.service.labels | nindent 4 }}
12+
{{- if .Values.controller.service.internal.labels }}
13+
{{- toYaml .Values.controller.service.internal.labels | nindent 4 }}
1414
{{- end }}
1515
name: {{ include "ingress-nginx.controller.fullname" . }}-internal
1616
namespace: {{ include "ingress-nginx.namespace" . }}

charts/ingress-nginx/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ controller:
2525
image:
2626
## Keep false as default for now!
2727
chroot: false
28+
service:
29+
internal:
30+
# Enable the internal service for ingress traffic
31+
enabled: false
32+
# -- Annotations to be added to internal service
33+
annotations: {}
34+
# -- Additional custom labels for internal service specifically, useful for external-dns configuration
35+
labels: {}
2836
# registry: registry.k8s.io
2937
image: ingress-nginx/controller
3038
## for backwards compatibility consider setting the full image url via the repository value below

0 commit comments

Comments
 (0)