From 009f42cf9991abfe25faf5ff12b5f8df6e7443d9 Mon Sep 17 00:00:00 2001 From: TOGEP Date: Thu, 20 Aug 2026 14:57:03 +0900 Subject: [PATCH] fix: make service ports configurable --- HelmSetup.md | 2 ++ charts/devlake/templates/_helpers.tpl | 2 +- charts/devlake/templates/deployments.yaml | 11 ++++++----- charts/devlake/templates/ingresses.yaml | 8 ++++---- charts/devlake/templates/services.yaml | 10 +++++----- charts/devlake/values.yaml | 12 ++++++++---- 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/HelmSetup.md b/HelmSetup.md index 0e7e6ebe..224be664 100644 --- a/HelmSetup.md +++ b/HelmSetup.md @@ -167,6 +167,7 @@ Some useful parameters for the chart, you could also check them in values.yaml | mysql.securityContext | pod security context values | {} | | mysql.containerSecurityContext | container security context values | {} | | mysql.service.type | mysql service type | ClusterIP | +| mysql.service.port | port exposed by the internal mysql service | 3306 | | mysql.service.nodePort | specify mysql nodeport | "" | | grafana | dashboard, datasource, etc. settings for grafana, installed by grafana official chart | | | lake.replicaCount | Replica count can only be 0 or 1 | 1 | @@ -200,6 +201,7 @@ Some useful parameters for the chart, you could also check them in values.yaml | ui.livenessProbe | container livenessprobe | see Values.yaml | | ui.readinessProbe | container readinessProbe | see Values.yaml | | ui.deployment.extraLabels | extra labels for ui's deployment metadata | {} | +| ui.service.port | port exposed by the ui service; the container still listens on port 4000 | 4000 | | service.type | Service type for exposed service | NodePort | | service.uiPort | Node port for config ui | 32001 | | ingress.enabled | If enable ingress | false | diff --git a/charts/devlake/templates/_helpers.tpl b/charts/devlake/templates/_helpers.tpl index 731af593..60e5b72f 100644 --- a/charts/devlake/templates/_helpers.tpl +++ b/charts/devlake/templates/_helpers.tpl @@ -147,7 +147,7 @@ The mysql port {{- if .Values.mysql.useExternal }} {{- .Values.mysql.externalPort }} {{- else }} -{{- 3306 }} +{{- .Values.mysql.service.port }} {{- end }} {{- end }} diff --git a/charts/devlake/templates/deployments.yaml b/charts/devlake/templates/deployments.yaml index a81c8c55..ffab607f 100644 --- a/charts/devlake/templates/deployments.yaml +++ b/charts/devlake/templates/deployments.yaml @@ -70,7 +70,8 @@ spec: {{- end }} imagePullPolicy: {{ .Values.ui.image.pullPolicy }} ports: - - containerPort: 4000 + - name: ui + containerPort: 4000 {{- with .Values.ui.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} @@ -86,7 +87,7 @@ spec: {{- end }} env: - name: DEVLAKE_ENDPOINT - value: {{ include "devlake.fullname" . }}-lake.{{ .Release.Namespace }}.svc.cluster.local:8080 + value: {{ include "devlake.fullname" . }}-lake.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.lake.port }} {{- if not .Values.grafana.enabled }} - name: GRAFANA_ENDPOINT value: {{ .Values.grafana.external.url }} @@ -94,7 +95,7 @@ spec: value: "true" {{- else }} - name: GRAFANA_ENDPOINT - value: {{ .Release.Name }}-grafana.{{ .Release.Namespace }}.svc.cluster.local:80 + value: {{ .Release.Name }}-grafana.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.grafana.service.port }} {{- end }} {{- range $key, $value := .Values.commonEnvs }} - name: "{{ tpl $key $ }}" @@ -183,7 +184,8 @@ spec: {{- end }} imagePullPolicy: {{ .Values.lake.image.pullPolicy }} ports: - - containerPort: {{ .Values.lake.port }} + - name: lake + containerPort: {{ .Values.lake.port }} {{- with .Values.lake.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} @@ -255,4 +257,3 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} - diff --git a/charts/devlake/templates/ingresses.yaml b/charts/devlake/templates/ingresses.yaml index 3bce0c44..a7076d41 100644 --- a/charts/devlake/templates/ingresses.yaml +++ b/charts/devlake/templates/ingresses.yaml @@ -81,10 +81,10 @@ spec: service: name: {{ $uiServiceName }} port: - number: 4000 + number: {{ .Values.ui.service.port }} {{- else }} serviceName: {{ $uiServiceName }} - servicePort: 4000 + servicePort: {{ .Values.ui.service.port }} {{- end }} {{- if .Values.ingress.extraPaths }} {{- toYaml .Values.ingress.extraPaths | nindent 10 }} @@ -133,10 +133,10 @@ spec: service: name: {{ $uiServiceName }} port: - number: 4000 + number: {{ .Values.ui.service.port }} {{- else }} serviceName: {{ $uiServiceName }} - servicePort: 4000 + servicePort: {{ .Values.ui.service.port }} {{- end }} {{- end }} {{- end }} diff --git a/charts/devlake/templates/services.yaml b/charts/devlake/templates/services.yaml index eb8c6ec5..ce1260eb 100644 --- a/charts/devlake/templates/services.yaml +++ b/charts/devlake/templates/services.yaml @@ -39,8 +39,8 @@ spec: ports: - protocol: TCP name: mysql - port: 3306 - targetPort: 3306 + port: {{ .Values.mysql.service.port }} + targetPort: mysql {{- if and (eq .Values.mysql.service.type "NodePort") .Values.mysql.service.nodePort }} nodePort: {{ .Values.mysql.service.nodePort }} {{- end }} @@ -65,7 +65,7 @@ spec: - protocol: TCP name: devlake port: {{ .Values.lake.port }} - targetPort: {{ .Values.lake.port }} + targetPort: lake --- # ui @@ -86,8 +86,8 @@ spec: ports: - protocol: TCP name: ui - port: 4000 - targetPort: 4000 + port: {{ .Values.ui.service.port }} + targetPort: ui {{- if eq .Values.service.type "NodePort" }} nodePort: {{ .Values.service.uiPort }} {{- end }} diff --git a/charts/devlake/values.yaml b/charts/devlake/values.yaml index 1d3f582b..0698c731 100644 --- a/charts/devlake/values.yaml +++ b/charts/devlake/values.yaml @@ -123,6 +123,8 @@ mysql: service: type: "ClusterIP" + # Port exposed by the in-cluster MySQL service. + port: 3306 nodePort: "" loadBalancerIP: "" extraLabels: {} @@ -224,7 +226,7 @@ lake: livenessProbe: httpGet: path: /ping - port: 8080 + port: lake scheme: HTTP failureThreshold: 5 initialDelaySeconds: 30 @@ -235,7 +237,7 @@ lake: readinessProbe: httpGet: path: /ping - port: 8080 + port: lake scheme: HTTP failureThreshold: 3 initialDelaySeconds: 5 @@ -290,7 +292,7 @@ ui: livenessProbe: httpGet: path: /health/ - port: 4000 + port: ui scheme: HTTP failureThreshold: 5 initialDelaySeconds: 15 @@ -301,7 +303,7 @@ ui: readinessProbe: httpGet: path: /health/ - port: 4000 + port: ui scheme: HTTP failureThreshold: 3 initialDelaySeconds: 5 @@ -343,6 +345,8 @@ ui: extraLabels: {} service: + # Port exposed by the UI service. The UI container listens on port 4000. + port: 4000 extraLabels: {} ## Side Contaainer Configuration