Skip to content

Commit be8abe7

Browse files
authored
Chart: Add service cluster IPs. (#12333)
1 parent a37994c commit be8abe7

8 files changed

+88
-0
lines changed

charts/ingress-nginx/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ metadata:
442442
| controller.service.annotations | object | `{}` | Annotations to be added to the external controller service. See `controller.service.internal.annotations` for annotations to be added to the internal controller service. |
443443
| controller.service.appProtocol | bool | `true` | Declare the app protocol of the external HTTP and HTTPS listeners or not. Supersedes provider-specific annotations for declaring the backend protocol. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#application-protocol |
444444
| controller.service.clusterIP | string | `""` | Pre-defined cluster internal IP address of the external 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. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address |
445+
| controller.service.clusterIPs | list | `[]` | Pre-defined cluster internal IP addresses of the external 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. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address |
445446
| controller.service.enableHttp | bool | `true` | Enable the HTTP listener on both controller services or not. |
446447
| controller.service.enableHttps | bool | `true` | Enable the HTTPS listener on both controller services or not. |
447448
| controller.service.enabled | bool | `true` | Enable controller services or not. This does not influence the creation of either the admission webhook or the metrics service. |
@@ -451,6 +452,7 @@ metadata:
451452
| controller.service.internal.annotations | object | `{}` | Annotations to be added to the internal controller service. Mandatory for the internal controller service to be created. Varies with the cloud service. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer |
452453
| controller.service.internal.appProtocol | bool | `true` | Declare the app protocol of the internal HTTP and HTTPS listeners or not. Supersedes provider-specific annotations for declaring the backend protocol. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#application-protocol |
453454
| controller.service.internal.clusterIP | string | `""` | 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. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address |
455+
| controller.service.internal.clusterIPs | list | `[]` | Pre-defined cluster internal IP addresses 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. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address |
454456
| controller.service.internal.enabled | bool | `false` | Enable the internal controller service or not. Remember to configure `controller.service.internal.annotations` when enabling this. |
455457
| controller.service.internal.externalIPs | list | `[]` | List of node IP addresses at which the internal controller service is available. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips |
456458
| controller.service.internal.externalTrafficPolicy | string | `""` | External traffic policy of the internal controller service. Set to "Local" to preserve source IP on providers supporting it. Ref: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip |
@@ -542,6 +544,7 @@ metadata:
542544
| defaultBackend.replicaCount | int | `1` | |
543545
| defaultBackend.resources | object | `{}` | |
544546
| defaultBackend.service.annotations | object | `{}` | |
547+
| defaultBackend.service.clusterIPs | list | `[]` | Pre-defined cluster internal IP addresses of the default backend 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. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address |
545548
| defaultBackend.service.externalIPs | list | `[]` | List of IP addresses at which the default backend service is available # Ref: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips # |
546549
| defaultBackend.service.loadBalancerSourceRanges | list | `[]` | |
547550
| defaultBackend.service.servicePort | int | `80` | |

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ spec:
1919
{{- if .Values.controller.service.internal.clusterIP }}
2020
clusterIP: {{ .Values.controller.service.internal.clusterIP }}
2121
{{- end }}
22+
{{- if .Values.controller.service.internal.clusterIPs }}
23+
clusterIPs: {{ toYaml .Values.controller.service.internal.clusterIPs | nindent 4 }}
24+
{{- end }}
2225
{{- if .Values.controller.service.internal.externalIPs }}
2326
externalIPs: {{ toYaml .Values.controller.service.internal.externalIPs | nindent 4 }}
2427
{{- end }}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ spec:
1919
{{- if .Values.controller.service.clusterIP }}
2020
clusterIP: {{ .Values.controller.service.clusterIP }}
2121
{{- end }}
22+
{{- if .Values.controller.service.clusterIPs }}
23+
clusterIPs: {{ toYaml .Values.controller.service.clusterIPs | nindent 4 }}
24+
{{- end }}
2225
{{- if .Values.controller.service.externalIPs }}
2326
externalIPs: {{ toYaml .Values.controller.service.externalIPs | nindent 4 }}
2427
{{- end }}

charts/ingress-nginx/templates/default-backend-service.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ spec:
1818
{{- if .Values.defaultBackend.service.clusterIP }}
1919
clusterIP: {{ .Values.defaultBackend.service.clusterIP }}
2020
{{- end }}
21+
{{- if .Values.defaultBackend.service.clusterIPs }}
22+
clusterIPs: {{ toYaml .Values.defaultBackend.service.clusterIPs | nindent 4 }}
23+
{{- end }}
2124
{{- if .Values.defaultBackend.service.externalIPs }}
2225
externalIPs: {{ toYaml .Values.defaultBackend.service.externalIPs | nindent 4 }}
2326
{{- end }}

charts/ingress-nginx/tests/controller-service-internal_test.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,27 @@ tests:
2323
- equal:
2424
path: metadata.name
2525
value: RELEASE-NAME-ingress-nginx-controller-internal
26+
27+
- it: should create a Service without `clusterIPs` if `controller.service.internal.clusterIPs` is not set
28+
set:
29+
controller.service.internal.enabled: true
30+
controller.service.internal.annotations:
31+
test.annotation: "true"
32+
asserts:
33+
- notExists:
34+
path: spec.clusterIPs
35+
36+
- it: should create a Service with `clusterIPs` if `controller.service.internal.clusterIPs` is set
37+
set:
38+
controller.service.internal.enabled: true
39+
controller.service.internal.annotations:
40+
test.annotation: "true"
41+
controller.service.internal.clusterIPs:
42+
- 10.0.0.1
43+
- fd00::1
44+
asserts:
45+
- equal:
46+
path: spec.clusterIPs
47+
value:
48+
- 10.0.0.1
49+
- fd00::1

charts/ingress-nginx/tests/controller-service_test.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,23 @@ tests:
3030
- equal:
3131
path: spec.type
3232
value: NodePort
33+
34+
- it: should create a Service without `clusterIPs` if `controller.service.clusterIPs` is not set
35+
set:
36+
controller.service.external.enabled: true
37+
asserts:
38+
- notExists:
39+
path: spec.clusterIPs
40+
41+
- it: should create a Service with `clusterIPs` if `controller.service.clusterIPs` is set
42+
set:
43+
controller.service.external.enabled: true
44+
controller.service.clusterIPs:
45+
- 10.0.0.1
46+
- fd00::1
47+
asserts:
48+
- equal:
49+
path: spec.clusterIPs
50+
value:
51+
- 10.0.0.1
52+
- fd00::1

charts/ingress-nginx/tests/default-backend-service_test.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,23 @@ tests:
3030
- equal:
3131
path: spec.ports[0].port
3232
value: 80
33+
34+
- it: should create a Service without `clusterIPs` if `defaultBackend.service.clusterIPs` is not set
35+
set:
36+
defaultBackend.enabled: true
37+
asserts:
38+
- notExists:
39+
path: spec.clusterIPs
40+
41+
- it: should create a Service with `clusterIPs` if `defaultBackend.service.clusterIPs` is set
42+
set:
43+
defaultBackend.enabled: true
44+
defaultBackend.service.clusterIPs:
45+
- 10.0.0.1
46+
- fd00::1
47+
asserts:
48+
- equal:
49+
path: spec.clusterIPs
50+
value:
51+
- 10.0.0.1
52+
- fd00::1

charts/ingress-nginx/values.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,10 @@ controller:
497497
# This value is immutable. Set once, it can not be changed without deleting and re-creating the service.
498498
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address
499499
clusterIP: ""
500+
# -- Pre-defined cluster internal IP addresses of the external controller service. Take care of collisions with existing services.
501+
# This value is immutable. Set once, it can not be changed without deleting and re-creating the service.
502+
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address
503+
clusterIPs: []
500504
# -- List of node IP addresses at which the external controller service is available.
501505
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips
502506
externalIPs: []
@@ -577,6 +581,10 @@ controller:
577581
# This value is immutable. Set once, it can not be changed without deleting and re-creating the service.
578582
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address
579583
clusterIP: ""
584+
# -- Pre-defined cluster internal IP addresses of the internal controller service. Take care of collisions with existing services.
585+
# This value is immutable. Set once, it can not be changed without deleting and re-creating the service.
586+
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address
587+
clusterIPs: []
580588
# -- List of node IP addresses at which the internal controller service is available.
581589
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips
582590
externalIPs: []
@@ -1155,6 +1163,10 @@ defaultBackend:
11551163
service:
11561164
annotations: {}
11571165
# clusterIP: ""
1166+
# -- Pre-defined cluster internal IP addresses of the default backend service. Take care of collisions with existing services.
1167+
# This value is immutable. Set once, it can not be changed without deleting and re-creating the service.
1168+
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address
1169+
clusterIPs: []
11581170

11591171
# -- List of IP addresses at which the default backend service is available
11601172
## Ref: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips

0 commit comments

Comments
 (0)