Skip to content

Commit 3dc3616

Browse files
allow customization of service http and https port names through helm (#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>
1 parent b1e6af7 commit 3dc3616

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ spec:
4949
- port: {{ .Values.controller.service.httpPort.port }}
5050
targetPort: {{ .Values.controller.service.httpPort.targetPort }}
5151
protocol: TCP
52-
name: http
52+
name: {{ .Values.controller.service.httpPort.name }}
5353
{{- if or (eq .Values.controller.service.type "LoadBalancer") (eq .Values.controller.service.type "NodePort") }}
5454
nodePort: {{ .Values.controller.service.httpPort.nodePort }}
5555
{{- end }}
@@ -58,7 +58,7 @@ spec:
5858
- port: {{ .Values.controller.service.httpsPort.port }}
5959
targetPort: {{ .Values.controller.service.httpsPort.targetPort }}
6060
protocol: TCP
61-
name: https
61+
name: {{ .Values.controller.service.httpsPort.name }}
6262
{{- if or (eq .Values.controller.service.type "LoadBalancer") (eq .Values.controller.service.type "NodePort") }}
6363
nodePort: {{ .Values.controller.service.httpsPort.nodePort }}
6464
{{- end }}

charts/nginx-ingress/values.schema.json

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,14 +1346,23 @@
13461346
"examples": [
13471347
80
13481348
]
1349+
},
1350+
"name": {
1351+
"type": "string",
1352+
"default": "http",
1353+
"title": "The httpPort name",
1354+
"examples": [
1355+
"http"
1356+
]
13491357
}
13501358
},
13511359
"examples": [
13521360
{
13531361
"enable": true,
13541362
"port": 80,
13551363
"nodePort": "",
1356-
"targetPort": 80
1364+
"targetPort": 80,
1365+
"name": "http"
13571366
}
13581367
]
13591368
},
@@ -1396,12 +1405,21 @@
13961405
]
13971406
}
13981407
},
1408+
"name": {
1409+
"type": "string",
1410+
"default": "https",
1411+
"title": "The httpsPort name",
1412+
"examples": [
1413+
"https"
1414+
]
1415+
},
13991416
"examples": [
14001417
{
14011418
"enable": true,
14021419
"port": 443,
14031420
"nodePort": "",
1404-
"targetPort": 443
1421+
"targetPort": 443,
1422+
"name": "https"
14051423
}
14061424
]
14071425
},
@@ -1432,12 +1450,14 @@
14321450
"httpPort": {
14331451
"enable": true,
14341452
"port": 80,
1435-
"targetPort": 80
1453+
"targetPort": 80,
1454+
"name": "http"
14361455
},
14371456
"httpsPort": {
14381457
"enable": true,
14391458
"port": 443,
1440-
"targetPort": 443
1459+
"targetPort": 443,
1460+
"name": "https"
14411461
},
14421462
"customPorts": []
14431463
}

charts/nginx-ingress/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,9 @@ controller:
478478
## The HTTP port on the POD where the Ingress Controller service is running.
479479
targetPort: 80
480480

481+
## The name of the HTTP port.
482+
name: "http"
483+
481484
httpsPort:
482485
## Enables the HTTPS port for the Ingress Controller service.
483486
enable: true
@@ -491,6 +494,9 @@ controller:
491494
## The HTTPS port on the POD where the Ingress Controller service is running.
492495
targetPort: 443
493496

497+
## The name of the HTTPS port.
498+
name: "https"
499+
494500
## A list of custom ports to expose through the Ingress Controller service. Follows the conventional Kubernetes yaml syntax for service ports.
495501
customPorts: []
496502

0 commit comments

Comments
 (0)