Chart: Add service cluster IPs. (#12333)

This commit is contained in:
Felix Dobler 2024-11-12 22:26:46 +01:00 committed by GitHub
parent a37994cb52
commit be8abe7a5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 88 additions and 0 deletions

View file

@ -442,6 +442,7 @@ metadata:
| 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. |
| 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 |
| 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 |
| 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 |
| controller.service.enableHttp | bool | `true` | Enable the HTTP listener on both controller services or not. |
| controller.service.enableHttps | bool | `true` | Enable the HTTPS listener on both controller services or not. |
| 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:
| 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 |
| 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 |
| 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 |
| 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 |
| controller.service.internal.enabled | bool | `false` | Enable the internal controller service or not. Remember to configure `controller.service.internal.annotations` when enabling this. |
| 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 |
| 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:
| defaultBackend.replicaCount | int | `1` | |
| defaultBackend.resources | object | `{}` | |
| defaultBackend.service.annotations | object | `{}` | |
| 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 |
| 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 # |
| defaultBackend.service.loadBalancerSourceRanges | list | `[]` | |
| defaultBackend.service.servicePort | int | `80` | |

View file

@ -19,6 +19,9 @@ spec:
{{- if .Values.controller.service.internal.clusterIP }}
clusterIP: {{ .Values.controller.service.internal.clusterIP }}
{{- end }}
{{- if .Values.controller.service.internal.clusterIPs }}
clusterIPs: {{ toYaml .Values.controller.service.internal.clusterIPs | nindent 4 }}
{{- end }}
{{- if .Values.controller.service.internal.externalIPs }}
externalIPs: {{ toYaml .Values.controller.service.internal.externalIPs | nindent 4 }}
{{- end }}

View file

@ -19,6 +19,9 @@ spec:
{{- if .Values.controller.service.clusterIP }}
clusterIP: {{ .Values.controller.service.clusterIP }}
{{- end }}
{{- if .Values.controller.service.clusterIPs }}
clusterIPs: {{ toYaml .Values.controller.service.clusterIPs | nindent 4 }}
{{- end }}
{{- if .Values.controller.service.externalIPs }}
externalIPs: {{ toYaml .Values.controller.service.externalIPs | nindent 4 }}
{{- end }}

View file

@ -18,6 +18,9 @@ spec:
{{- if .Values.defaultBackend.service.clusterIP }}
clusterIP: {{ .Values.defaultBackend.service.clusterIP }}
{{- end }}
{{- if .Values.defaultBackend.service.clusterIPs }}
clusterIPs: {{ toYaml .Values.defaultBackend.service.clusterIPs | nindent 4 }}
{{- end }}
{{- if .Values.defaultBackend.service.externalIPs }}
externalIPs: {{ toYaml .Values.defaultBackend.service.externalIPs | nindent 4 }}
{{- end }}

View file

@ -23,3 +23,27 @@ tests:
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller-internal
- it: should create a Service without `clusterIPs` if `controller.service.internal.clusterIPs` is not set
set:
controller.service.internal.enabled: true
controller.service.internal.annotations:
test.annotation: "true"
asserts:
- notExists:
path: spec.clusterIPs
- it: should create a Service with `clusterIPs` if `controller.service.internal.clusterIPs` is set
set:
controller.service.internal.enabled: true
controller.service.internal.annotations:
test.annotation: "true"
controller.service.internal.clusterIPs:
- 10.0.0.1
- fd00::1
asserts:
- equal:
path: spec.clusterIPs
value:
- 10.0.0.1
- fd00::1

View file

@ -30,3 +30,23 @@ tests:
- equal:
path: spec.type
value: NodePort
- it: should create a Service without `clusterIPs` if `controller.service.clusterIPs` is not set
set:
controller.service.external.enabled: true
asserts:
- notExists:
path: spec.clusterIPs
- it: should create a Service with `clusterIPs` if `controller.service.clusterIPs` is set
set:
controller.service.external.enabled: true
controller.service.clusterIPs:
- 10.0.0.1
- fd00::1
asserts:
- equal:
path: spec.clusterIPs
value:
- 10.0.0.1
- fd00::1

View file

@ -30,3 +30,23 @@ tests:
- equal:
path: spec.ports[0].port
value: 80
- it: should create a Service without `clusterIPs` if `defaultBackend.service.clusterIPs` is not set
set:
defaultBackend.enabled: true
asserts:
- notExists:
path: spec.clusterIPs
- it: should create a Service with `clusterIPs` if `defaultBackend.service.clusterIPs` is set
set:
defaultBackend.enabled: true
defaultBackend.service.clusterIPs:
- 10.0.0.1
- fd00::1
asserts:
- equal:
path: spec.clusterIPs
value:
- 10.0.0.1
- fd00::1

View file

@ -497,6 +497,10 @@ controller:
# 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
clusterIP: ""
# -- 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
clusterIPs: []
# -- List of node IP addresses at which the external controller service is available.
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips
externalIPs: []
@ -577,6 +581,10 @@ controller:
# 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
clusterIP: ""
# -- 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
clusterIPs: []
# -- List of node IP addresses at which the internal controller service is available.
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips
externalIPs: []
@ -1155,6 +1163,10 @@ defaultBackend:
service:
annotations: {}
# clusterIP: ""
# -- 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
clusterIPs: []
# -- List of IP addresses at which the default backend service is available
## Ref: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips