fix: make service ports configurable (#380)
diff --git a/HelmSetup.md b/HelmSetup.md
index 0e7e6eb..224be66 100644
--- a/HelmSetup.md
+++ b/HelmSetup.md
@@ -167,6 +167,7 @@
| 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 @@
| 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 731af59..60e5b72 100644
--- a/charts/devlake/templates/_helpers.tpl
+++ b/charts/devlake/templates/_helpers.tpl
@@ -147,7 +147,7 @@
{{- 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 a81c8c5..ffab607 100644
--- a/charts/devlake/templates/deployments.yaml
+++ b/charts/devlake/templates/deployments.yaml
@@ -70,7 +70,8 @@
{{- 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 @@
{{- 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 @@
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 @@
{{- 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 @@
{{- toYaml . | nindent 8 }}
{{- end }}
-
diff --git a/charts/devlake/templates/ingresses.yaml b/charts/devlake/templates/ingresses.yaml
index 3bce0c4..a7076d4 100644
--- a/charts/devlake/templates/ingresses.yaml
+++ b/charts/devlake/templates/ingresses.yaml
@@ -81,10 +81,10 @@
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 @@
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 eb8c6ec..ce1260e 100644
--- a/charts/devlake/templates/services.yaml
+++ b/charts/devlake/templates/services.yaml
@@ -39,8 +39,8 @@
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 @@
- protocol: TCP
name: devlake
port: {{ .Values.lake.port }}
- targetPort: {{ .Values.lake.port }}
+ targetPort: lake
---
# ui
@@ -86,8 +86,8 @@
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 1d3f582..0698c73 100644
--- a/charts/devlake/values.yaml
+++ b/charts/devlake/values.yaml
@@ -123,6 +123,8 @@
service:
type: "ClusterIP"
+ # Port exposed by the in-cluster MySQL service.
+ port: 3306
nodePort: ""
loadBalancerIP: ""
extraLabels: {}
@@ -224,7 +226,7 @@
livenessProbe:
httpGet:
path: /ping
- port: 8080
+ port: lake
scheme: HTTP
failureThreshold: 5
initialDelaySeconds: 30
@@ -235,7 +237,7 @@
readinessProbe:
httpGet:
path: /ping
- port: 8080
+ port: lake
scheme: HTTP
failureThreshold: 3
initialDelaySeconds: 5
@@ -290,7 +292,7 @@
livenessProbe:
httpGet:
path: /health/
- port: 4000
+ port: ui
scheme: HTTP
failureThreshold: 5
initialDelaySeconds: 15
@@ -301,7 +303,7 @@
readinessProbe:
httpGet:
path: /health/
- port: 4000
+ port: ui
scheme: HTTP
failureThreshold: 3
initialDelaySeconds: 5
@@ -343,6 +345,8 @@
extraLabels: {}
service:
+ # Port exposed by the UI service. The UI container listens on port 4000.
+ port: 4000
extraLabels: {}
## Side Contaainer Configuration