diff --git a/charts/ingress-nginx/README.md b/charts/ingress-nginx/README.md index f69d2951b5..dd976ae590 100644 --- a/charts/ingress-nginx/README.md +++ b/charts/ingress-nginx/README.md @@ -441,12 +441,14 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu | controller.service.external.enabled | bool | `true` | Enable the external controller service or not. Useful for internal-only deployments. | | controller.service.externalIPs | list | `[]` | List of node IP addresses at which the external controller service is available. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips | | controller.service.externalTrafficPolicy | string | `""` | External traffic policy of the external 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 | +| controller.service.internalTrafficPolicy | string | `""` | Internal traffic policy of the internal controller service. Set to "Local" to route internal traffic to endpoints within the node the traffic originated from. Ref: https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy | | 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.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 | +| controller.service.internal.internalTrafficPolicy | string | `""` | Internal traffic policy of the internal controller service. Set to "Local" to route internal traffic to endpoints within the node the traffic originated from. Ref: https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy | | controller.service.internal.ipFamilies | list | `["IPv4"]` | List of IP families (e.g. IPv4, IPv6) assigned to the internal controller service. This field is usually assigned automatically based on cluster configuration and the `ipFamilyPolicy` field. Ref: https://kubernetes.io/docs/concepts/services-networking/dual-stack/#services | | controller.service.internal.ipFamilyPolicy | string | `"SingleStack"` | Represents the dual-stack capabilities of the internal controller service. Possible values are SingleStack, PreferDualStack or RequireDualStack. Fields `ipFamilies` and `clusterIP` depend on the value of this field. Ref: https://kubernetes.io/docs/concepts/services-networking/dual-stack/#services | | controller.service.internal.loadBalancerClass | string | `""` | Load balancer class of the internal controller service. Used by cloud providers to select a load balancer implementation other than the cloud provider default. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#load-balancer-class | diff --git a/charts/ingress-nginx/templates/controller-service-internal.yaml b/charts/ingress-nginx/templates/controller-service-internal.yaml index 6d0b47caf6..567d788899 100644 --- a/charts/ingress-nginx/templates/controller-service-internal.yaml +++ b/charts/ingress-nginx/templates/controller-service-internal.yaml @@ -37,6 +37,9 @@ spec: {{- if .Values.controller.service.internal.externalTrafficPolicy }} externalTrafficPolicy: {{ .Values.controller.service.internal.externalTrafficPolicy }} {{- end }} +{{- if .Values.controller.service.internal.internalTrafficPolicy }} + internalTrafficPolicy: {{ .Values.controller.service.internal.internalTrafficPolicy }} +{{- end }} {{- if .Values.controller.service.internal.sessionAffinity }} sessionAffinity: {{ .Values.controller.service.internal.sessionAffinity }} {{- end }} diff --git a/charts/ingress-nginx/templates/controller-service.yaml b/charts/ingress-nginx/templates/controller-service.yaml index cb78a7035f..6a72e14fa0 100644 --- a/charts/ingress-nginx/templates/controller-service.yaml +++ b/charts/ingress-nginx/templates/controller-service.yaml @@ -37,6 +37,9 @@ spec: {{- if .Values.controller.service.externalTrafficPolicy }} externalTrafficPolicy: {{ .Values.controller.service.externalTrafficPolicy }} {{- end }} +{{- if .Values.controller.service.internalTrafficPolicy }} + internalTrafficPolicy: {{ .Values.controller.service.internalTrafficPolicy }} +{{- end }} {{- if .Values.controller.service.sessionAffinity }} sessionAffinity: {{ .Values.controller.service.sessionAffinity }} {{- end }} diff --git a/charts/ingress-nginx/tests/controller-service-internal_test.yaml b/charts/ingress-nginx/tests/controller-service-internal_test.yaml index 5465e1a2b8..8d3b9cc651 100644 --- a/charts/ingress-nginx/tests/controller-service-internal_test.yaml +++ b/charts/ingress-nginx/tests/controller-service-internal_test.yaml @@ -23,3 +23,14 @@ tests: - equal: path: metadata.name value: RELEASE-NAME-ingress-nginx-controller-internal + + - it: should create an internal Service with internalTrafficPolicy set to "Local" if `controller.service.internal.enabled` is true and `controller.service.internal.internalTrafficPolicy` is "Local" + set: + controller.service.internal.enabled: true + controller.service.internal.internalTrafficPolicy: Local + controller.service.internal.annotations: + test.annotation: "true" + asserts: + - equal: + path: spec.internalTrafficPolicy + value: Local diff --git a/charts/ingress-nginx/tests/controller-service_test.yaml b/charts/ingress-nginx/tests/controller-service_test.yaml index 10574f227d..7635ba2542 100644 --- a/charts/ingress-nginx/tests/controller-service_test.yaml +++ b/charts/ingress-nginx/tests/controller-service_test.yaml @@ -30,3 +30,12 @@ tests: - equal: path: spec.type value: NodePort + + - it: should create a Service with internalTrafficPolicy set to "Local" if `controller.service.external.enabled` is true and `controller.service.external.internalTrafficPolicy` is "Local" + set: + controller.service.external.enabled: true + controller.service.internalTrafficPolicy: Local + asserts: + - equal: + path: spec.internalTrafficPolicy + value: Local \ No newline at end of file diff --git a/charts/ingress-nginx/values.yaml b/charts/ingress-nginx/values.yaml index 89cb718c4b..5e1a8c0bfe 100644 --- a/charts/ingress-nginx/values.yaml +++ b/charts/ingress-nginx/values.yaml @@ -504,6 +504,9 @@ controller: # -- External traffic policy of the external 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 externalTrafficPolicy: "" + # -- Internal traffic policy of the internal controller service. Set to "Local" to route internal traffic to endpoints within the node the traffic originated from. + # Ref: https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy/ + internalTrafficPolicy: "" # -- Session affinity of the external controller service. Must be either "None" or "ClientIP" if set. Defaults to "None". # Ref: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity sessionAffinity: "" @@ -584,6 +587,9 @@ controller: # -- 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 externalTrafficPolicy: "" + # -- Internal traffic policy of the internal controller service. Set to "Local" to route internal traffic to endpoints within the node the traffic originated from. + # Ref: https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy/ + internalTrafficPolicy: "" # -- Session affinity of the internal controller service. Must be either "None" or "ClientIP" if set. Defaults to "None". # Ref: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity sessionAffinity: ""