Skip to content

Commit

Permalink
allow customization of service http and https port names through helm (
Browse files Browse the repository at this point in the history
…#7318)

* allow customization of service http and https port names through helm chart

This change allows users to customize the names of the NIC service's http and https ports through a helm chart. It adds defaults which are the same as the previous hardcoded values in the helm chart, thereby ensuring backwards compatibility.

This change will enable users of NIC to more smoothly integrate with NGINXaaS's AKS functionality. Our load balancer for kubernetes discovers the upstream name and upstream type that it needs to update by parsing service port names, so we need to allow users of our service to easily customize port names.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
arussellf5 and pre-commit-ci[bot] authored Feb 13, 2025
1 parent b1e6af7 commit 3dc3616
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
4 changes: 2 additions & 2 deletions charts/nginx-ingress/templates/controller-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
- port: {{ .Values.controller.service.httpPort.port }}
targetPort: {{ .Values.controller.service.httpPort.targetPort }}
protocol: TCP
name: http
name: {{ .Values.controller.service.httpPort.name }}
{{- if or (eq .Values.controller.service.type "LoadBalancer") (eq .Values.controller.service.type "NodePort") }}
nodePort: {{ .Values.controller.service.httpPort.nodePort }}
{{- end }}
Expand All @@ -58,7 +58,7 @@ spec:
- port: {{ .Values.controller.service.httpsPort.port }}
targetPort: {{ .Values.controller.service.httpsPort.targetPort }}
protocol: TCP
name: https
name: {{ .Values.controller.service.httpsPort.name }}
{{- if or (eq .Values.controller.service.type "LoadBalancer") (eq .Values.controller.service.type "NodePort") }}
nodePort: {{ .Values.controller.service.httpsPort.nodePort }}
{{- end }}
Expand Down
28 changes: 24 additions & 4 deletions charts/nginx-ingress/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1346,14 +1346,23 @@
"examples": [
80
]
},
"name": {
"type": "string",
"default": "http",
"title": "The httpPort name",
"examples": [
"http"
]
}
},
"examples": [
{
"enable": true,
"port": 80,
"nodePort": "",
"targetPort": 80
"targetPort": 80,
"name": "http"
}
]
},
Expand Down Expand Up @@ -1396,12 +1405,21 @@
]
}
},
"name": {
"type": "string",
"default": "https",
"title": "The httpsPort name",
"examples": [
"https"
]
},
"examples": [
{
"enable": true,
"port": 443,
"nodePort": "",
"targetPort": 443
"targetPort": 443,
"name": "https"
}
]
},
Expand Down Expand Up @@ -1432,12 +1450,14 @@
"httpPort": {
"enable": true,
"port": 80,
"targetPort": 80
"targetPort": 80,
"name": "http"
},
"httpsPort": {
"enable": true,
"port": 443,
"targetPort": 443
"targetPort": 443,
"name": "https"
},
"customPorts": []
}
Expand Down
6 changes: 6 additions & 0 deletions charts/nginx-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,9 @@ controller:
## The HTTP port on the POD where the Ingress Controller service is running.
targetPort: 80

## The name of the HTTP port.
name: "http"

httpsPort:
## Enables the HTTPS port for the Ingress Controller service.
enable: true
Expand All @@ -491,6 +494,9 @@ controller:
## The HTTPS port on the POD where the Ingress Controller service is running.
targetPort: 443

## The name of the HTTPS port.
name: "https"

## A list of custom ports to expose through the Ingress Controller service. Follows the conventional Kubernetes yaml syntax for service ports.
customPorts: []

Expand Down

0 comments on commit 3dc3616

Please sign in to comment.