Skip to content

Commit 59db2e3

Browse files
authored
feat: support auto assign node port for dp-manager (#271)
1 parent 800fe1d commit 59db2e3

4 files changed

Lines changed: 33 additions & 2 deletions

File tree

charts/api7/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.17.47
18+
version: 0.17.48
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/api7/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# api7ee3
22

3-
![Version: 0.17.47](https://img.shields.io/badge/Version-0.17.47-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.9.7](https://img.shields.io/badge/AppVersion-3.9.7-informational?style=flat-square)
3+
![Version: 0.17.48](https://img.shields.io/badge/Version-0.17.48-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.9.7](https://img.shields.io/badge/AppVersion-3.9.7-informational?style=flat-square)
44

55
A Helm chart for Kubernetes
66

@@ -208,14 +208,17 @@ A Helm chart for Kubernetes
208208
| dp_manager_configuration.server.tls.host | string | `"0.0.0.0"` | |
209209
| dp_manager_configuration.server.tls.port | int | `7943` | |
210210
| dp_manager_service.annotations | object | `{}` | |
211+
| dp_manager_service.autoAssignNodePort | bool | `false` | Whether to set nodePort to the same value as the HTTP/HTTPS port when dp_manager_service.type is NodePort, make sure the nodePort to be in the valid NodePort range of kubernetes service. |
211212
| dp_manager_service.ingress.annotations | object | `{}` | |
212213
| dp_manager_service.ingress.className | string | `""` | |
213214
| dp_manager_service.ingress.enabled | bool | `false` | |
214215
| dp_manager_service.ingress.hosts[0].host | string | `"dp-manager.local"` | |
215216
| dp_manager_service.ingress.hosts[0].paths[0].path | string | `"/"` | |
216217
| dp_manager_service.ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
217218
| dp_manager_service.ingress.tls | list | `[]` | |
219+
| dp_manager_service.nodePort | int | `nil` | The nodePort for HTTP service, only used if dp_manager_service.type is NodePort. If not set, a random port will be assigned by Kubernetes. |
218220
| dp_manager_service.port | int | `7900` | |
221+
| dp_manager_service.tlsNodePort | int | `nil` | The nodePort for HTTPS service, only used if dp_manager_service.type is NodePort. If not set, a random port will be assigned by Kubernetes. |
219222
| dp_manager_service.tlsPort | int | `7943` | |
220223
| dp_manager_service.type | string | `"ClusterIP"` | |
221224
| fullnameOverride | string | `""` | |

charts/api7/templates/dp-manager-service.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ metadata:
1111
{{- end }}
1212
spec:
1313
type: {{ .Values.dp_manager_service.type }}
14+
{{- if and (eq .Values.dp_manager_service.type "NodePort") .Values.dp_manager_service.autoAssignNodePort }}
15+
{{- if or (lt (int .Values.dp_manager_service.port) 30000) (gt (int .Values.dp_manager_service.port) 32767) }}
16+
{{- fail (printf "dp_manager_service.port (%d) must be between 30000 and 32767 when autoAssignNodePort is true" (int .Values.dp_manager_service.port)) }}
17+
{{- end }}
18+
{{- if or (lt (int .Values.dp_manager_service.tlsPort) 30000) (gt (int .Values.dp_manager_service.tlsPort) 32767) }}
19+
{{- fail (printf "dp_manager_service.tlsPort (%d) must be between 30000 and 32767 when autoAssignNodePort is true" (int .Values.dp_manager_service.tlsPort)) }}
20+
{{- end }}
21+
{{- end }}
1422
{{- if .Values.dp_manager_service.loadBalancerClass }}
1523
loadBalancerClass: {{ .Values.dp_manager_service.loadBalancerClass }}
1624
{{- end }}
@@ -19,10 +27,24 @@ spec:
1927
targetPort: http
2028
protocol: TCP
2129
name: http
30+
{{- if eq .Values.dp_manager_service.type "NodePort" }}
31+
{{- if .Values.dp_manager_service.autoAssignNodePort }}
32+
nodePort: {{ .Values.dp_manager_service.port }}
33+
{{- else if .Values.dp_manager_service.nodePort }}
34+
nodePort: {{ .Values.dp_manager_service.nodePort }}
35+
{{- end }}
36+
{{- end }}
2237
- port: {{ .Values.dp_manager_service.tlsPort }}
2338
targetPort: https
2439
protocol: TCP
2540
name: https
41+
{{- if eq .Values.dp_manager_service.type "NodePort" }}
42+
{{- if .Values.dp_manager_service.autoAssignNodePort }}
43+
nodePort: {{ .Values.dp_manager_service.tlsPort }}
44+
{{- else if .Values.dp_manager_service.tlsNodePort }}
45+
nodePort: {{ .Values.dp_manager_service.tlsNodePort }}
46+
{{- end }}
47+
{{- end }}
2648

2749
selector:
2850
{{- include "api7ee3.selectorLabels" . | nindent 4 }}

charts/api7/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ dp_manager_service:
171171
annotations: {}
172172
port: 7900
173173
tlsPort: 7943
174+
# -- Whether to set nodePort to the same value as the HTTP/HTTPS port when dp_manager_service.type is NodePort, make sure the nodePort to be in the valid NodePort range of kubernetes service.
175+
autoAssignNodePort: false
176+
# -- (int) The nodePort for HTTP service, only used if dp_manager_service.type is NodePort. If not set, a random port will be assigned by Kubernetes.
177+
nodePort: null
178+
# -- (int) The nodePort for HTTPS service, only used if dp_manager_service.type is NodePort. If not set, a random port will be assigned by Kubernetes.
179+
tlsNodePort: null
174180
ingress:
175181
enabled: false
176182
className: ""

0 commit comments

Comments
 (0)