Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart: Add controller.service.external.labels & controller.service.internal.labels. #12704

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions charts/ingress-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ metadata:
| 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. |
| controller.service.external.enabled | bool | `true` | Enable the external controller service or not. Useful for internal-only deployments. |
| controller.service.external.labels | object | `{}` | Labels to be added to the external controller service. |
| 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.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 |
Expand All @@ -458,6 +459,7 @@ metadata:
| 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.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.labels | object | `{}` | Labels to be added to the internal controller service. |
| 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 |
| controller.service.internal.loadBalancerIP | string | `""` | Deprecated: Pre-defined IP address of the internal controller service. Used by cloud providers to connect the resulting load balancer service to a pre-existing static IP. Ref: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer |
| controller.service.internal.loadBalancerSourceRanges | list | `[]` | Restrict access to the internal controller service. Values must be CIDRs. Allows any source address by default. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
samuelarogbonlo marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions charts/ingress-nginx/ci/controller-service-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ controller:
service:
type: NodePort

external:
labels:
external-dns.alpha.kubernetes.io/hostname: external.example.com
Gacko marked this conversation as resolved.
Show resolved Hide resolved

nodePorts:
tcp:
9000: 30090
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
samuelarogbonlo marked this conversation as resolved.
Show resolved Hide resolved
name: {{ include "ingress-nginx.controller.fullname" . }}-internal
namespace: {{ include "ingress-nginx.namespace" . }}
spec:
Expand Down
3 changes: 3 additions & 0 deletions charts/ingress-nginx/templates/controller-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ metadata:
{{- if .Values.controller.service.labels }}
{{- toYaml .Values.controller.service.labels | nindent 4 }}
{{- end }}
{{- if .Values.controller.service.external.labels }}
{{- toYaml .Values.controller.service.external.labels | nindent 4 }}
{{- end }}
name: {{ include "ingress-nginx.controller.fullname" . }}
namespace: {{ include "ingress-nginx.namespace" . }}
spec:
Expand Down
18 changes: 17 additions & 1 deletion charts/ingress-nginx/tests/controller-service-internal_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ tests:
controller.service.internal.annotations:
test.annotation: "true"
asserts:
- notExists:
- isNull:
path: spec.clusterIPs

- it: should create a Service with `clusterIPs` if `controller.service.internal.clusterIPs` is set
Expand Down Expand Up @@ -61,3 +61,19 @@ tests:
- equal:
path: spec.trafficDistribution
value: PreferClose

- it: should create a Service with labels if `controller.service.internal.labels` is set
set:
controller.service.internal.enabled: true
controller.service.internal.annotations:
test.annotation: "true"
controller.service.internal.labels:
external-dns.alpha.kubernetes.io/hostname: internal.example.com
asserts:
- hasDocuments:
count: 1
- isKind:
of: Service
- equal:
path: metadata.labels["external-dns.alpha.kubernetes.io/hostname"]
value: internal.example.com
12 changes: 11 additions & 1 deletion charts/ingress-nginx/tests/controller-service_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tests:
set:
controller.service.external.enabled: true
asserts:
- notExists:
- isNull:
path: spec.clusterIPs

- it: should create a Service with `clusterIPs` if `controller.service.clusterIPs` is set
Expand All @@ -62,3 +62,13 @@ tests:
- equal:
path: spec.trafficDistribution
value: PreferClose

- it: should create a Service with labels if `controller.service.external.labels` is set
set:
controller.service.external.enabled: true
controller.service.external.labels:
external-dns.alpha.kubernetes.io/hostname: external.example.com
asserts:
- equal:
path: metadata.labels["external-dns.alpha.kubernetes.io/hostname"]
value: external.example.com
4 changes: 4 additions & 0 deletions charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ controller:
external:
# -- Enable the external controller service or not. Useful for internal-only deployments.
enabled: true
# -- Labels to be added to the external controller service.
labels: {}
# -- Annotations to be added to the external controller service. See `controller.service.internal.annotations` for annotations to be added to the internal controller service.
annotations: {}
# -- Labels to be added to both controller services.
Expand Down Expand Up @@ -574,6 +576,8 @@ controller:
internal:
# -- Enable the internal controller service or not. Remember to configure `controller.service.internal.annotations` when enabling this.
enabled: false
# -- Labels to be added to the internal controller service.
labels: {}
# -- 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
annotations: {}
Expand Down
Loading