diff --git a/charts/devlake/README.md b/charts/devlake/README.md index deac7903..3542420f 100644 --- a/charts/devlake/README.md +++ b/charts/devlake/README.md @@ -74,44 +74,44 @@ After deployed, visit devlake: https://devlake-0.example.com:8443, and grafana a Some useful parameters for the chart, you could also check them in values.yaml -| Parameter | Description | Default | -|-----------|-------------|---------| -| replicaCount | Replica Count for devlake, currently not used | 1 | -| mysql.useExternal | If use external mysql server, currently not used | false | -| mysql.externalServer | External mysql server address | 127.0.0.1 | -| mysql.externalPort | External mysql server port | 3306 | -| mysql.username | username for mysql | merico | -| mysql.password | password for mysql | merico | -| mysql.database | database for mysql | lake | -| mysql.rootPassword | root password for mysql | admin | -| mysql.storage.class | storage class for mysql's volume | "" | -| mysql.storage.size | volume size for mysql's data | 5Gi | -| mysql.image.repository | repository for mysql's image | mysql | -| mysql.image.tag | image tag for mysql's image | 8.0.26 | -| mysql.image.pullPolicy | pullPolicy for mysql's image | IfNotPresent | -| grafana.image.repository | repository for grafana's image | mericodev/grafana | -| grafana.image.tag | image tag for grafana's image | latest | -| grafana.image.pullPolicy | pullPolicy for grafana's image | Always | -| lake.storage.class | storage class for lake's volume | "" | -| lake.storage.size | volume size for lake's data | 100Mi | -| lake.image.repository | repository for lake's image | mericodev/lake | -| lake.image.tag | image tag for lake's image | latest | -| lake.image.pullPolicy | pullPolicy for lake's image | Always | -| ui.image.repository | repository for ui's image | mericodev/config-ui | -| ui.image.tag | image tag for ui's image | latest | -| ui.image.pullPolicy | pullPolicy for ui's image | Always | -| ui.basicAuth.enabled | If the basic auth in ui is enabled | false | -| ui.basicAuth.user | The user name for the basic auth | "admin" | -| ui.basicAuth.password | The password for the basic auth | "admin" | -| service.type | Service type for exposed service | NodePort | -| service.uiPort | Service port for config ui | 32001 | -| service.ingress.enabled | If enable ingress | false | -| service.ingress.enableHttps | If enable https | false | -| service.ingress.className | The class name for ingressClass. If leave empty, the default IngressClass will be used | "" | -| service.ingress.hostname | The hostname/domainname for ingress | localhost | -| service.ingress.prefix | The prefix for endpoints, currently not supported due to devlake's implementation | / | -| service.ingress.tlsSecretName | The secret name for tls's certificate, required when https enabled | "" | -| service.ingress.httpPort | The http port for ingress | 80 | -| service.ingress.httpsPort | The https port for ingress | 443 | -| option.localtime | The hostpath for mount as /etc/localtime | /etc/localtime | +| Parameter | Description | Default | +|-----------|----------------------------------------------------------------------------------------|---------| +| replicaCount | Replica Count for devlake, currently not used | 1 | +| mysql.useExternal | If use external mysql server, set true | false | +| mysql.externalServer | External mysql server address | 127.0.0.1 | +| mysql.externalPort | External mysql server port | 3306 | +| mysql.username | username for mysql | merico | +| mysql.password | password for mysql | merico | +| mysql.database | database for mysql | lake | +| mysql.rootPassword | root password for mysql | admin | +| mysql.storage.class | storage class for mysql's volume | "" | +| mysql.storage.size | volume size for mysql's data | 5Gi | +| mysql.image.repository | repository for mysql's image | mysql | +| mysql.image.tag | image tag for mysql's image | 8.0.26 | +| mysql.image.pullPolicy | pullPolicy for mysql's image | IfNotPresent | +| grafana.image.repository | repository for grafana's image | mericodev/grafana | +| grafana.image.tag | image tag for grafana's image | latest | +| grafana.image.pullPolicy | pullPolicy for grafana's image | Always | +| lake.storage.class | storage class for lake's volume | "" | +| lake.storage.size | volume size for lake's data | 100Mi | +| lake.image.repository | repository for lake's image | mericodev/lake | +| lake.image.tag | image tag for lake's image | latest | +| lake.image.pullPolicy | pullPolicy for lake's image | Always | +| ui.image.repository | repository for ui's image | mericodev/config-ui | +| ui.image.tag | image tag for ui's image | latest | +| ui.image.pullPolicy | pullPolicy for ui's image | Always | +| ui.basicAuth.enabled | If the basic auth in ui is enabled | false | +| ui.basicAuth.user | The user name for the basic auth | "admin" | +| ui.basicAuth.password | The password for the basic auth | "admin" | +| service.type | Service type for exposed service | NodePort | +| service.uiPort | Service port for config ui | 32001 | +| service.ingress.enabled | If enable ingress | false | +| service.ingress.enableHttps | If enable https | false | +| service.ingress.className | The class name for ingressClass. If leave empty, the default IngressClass will be used | "" | +| service.ingress.hostname | The hostname/domainname for ingress | localhost | +| service.ingress.prefix | The prefix for endpoints, currently not supported due to devlake's implementation | / | +| service.ingress.tlsSecretName | The secret name for tls's certificate, required when https enabled | "" | +| service.ingress.httpPort | The http port for ingress | 80 | +| service.ingress.httpsPort | The https port for ingress | 443 | +| option.localtime | The hostpath for mount as /etc/localtime | /etc/localtime | diff --git a/charts/devlake/templates/_helpers.tpl b/charts/devlake/templates/_helpers.tpl index 5167bfd1..e7866422 100644 --- a/charts/devlake/templates/_helpers.tpl +++ b/charts/devlake/templates/_helpers.tpl @@ -1,20 +1,3 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - {{/* Expand the name of the chart. */}} @@ -112,3 +95,26 @@ The ui endpoint {{- end }} {{- end }} {{- end }} + +{{/* +The mysql server +*/}} +{{- define "mysql.server" -}} +{{- if .Values.mysql.useExternal }} +{{- .Values.mysql.externalServer }} +{{- else }} +{{- print (include "devlake.fullname" . ) "-mysql" }} +{{- end }} +{{- end }} + + +{{/* +The mysql port +*/}} +{{- define "mysql.port" -}} +{{- if .Values.mysql.useExternal }} +{{- .Values.mysql.externalPort }} +{{- else }} +{{- 3306 }} +{{- end }} +{{- end }} diff --git a/charts/devlake/templates/deployments.yaml b/charts/devlake/templates/deployments.yaml index 62c0db58..b3ac074b 100644 --- a/charts/devlake/templates/deployments.yaml +++ b/charts/devlake/templates/deployments.yaml @@ -42,9 +42,11 @@ spec: - 'sh' - '-c' - | - until nc -z -w 2 {{ include "devlake.fullname" . }}-mysql 3306 && echo mysql is ready ; do + until nc -z -w 2 {{ include "mysql.server" . }} {{ include "mysql.port" . }} ; do + echo wait for mysql ready ... sleep 2 done + echo mysql is ready containers: - name: grafana image: "{{ .Values.grafana.image.repository }}:{{ .Values.grafana.image.tag }}" @@ -67,16 +69,16 @@ spec: - configMapRef: name: {{ include "devlake.fullname" . }}-config env: - - name: GF_SERVER_ROOT_URL - value: "%(protocol)s://%(domain)s:%(http_port)s/grafana/" - - name: MYSQL_URL - value: {{ include "devlake.fullname" . }}-mysql:3306 + - name: GF_SERVER_ROOT_URL + value: "%(protocol)s://%(domain)s:%(http_port)s/grafana/" + - name: MYSQL_URL + value: {{ include "mysql.server" . }}:{{ include "mysql.port" . }} volumes: - {{- if ne .Values.option.localtime "" }} - - name: {{ include "devlake.fullname" . }}-grafana-localtime - hostPath: - path: {{ .Values.option.localtime }} - type: File + {{- if ne .Values.option.localtime "" }} + - name: {{ include "devlake.fullname" . }}-grafana-localtime + hostPath: + path: {{ .Values.option.localtime }} + type: File {{- end }} --- @@ -108,20 +110,16 @@ spec: - configMapRef: name: {{ include "devlake.fullname" . }}-config env: - - name: DEVLAKE_ENDPOINT - # TODO: remove hardcoded `cluster.local` - value: {{ include "devlake.fullname" . }}-lake.{{ .Release.Namespace }}.svc.cluster.local:8080 - - name: GRAFANA_ENDPOINT - value: {{ include "devlake.fullname" . }}-grafana.{{ .Release.Namespace }}.svc.cluster.local:3000 - # - name: ADMIN_USER - # value: "admin" - # - name: ADMIN_PASS - # value: "admin" + - name: DEVLAKE_ENDPOINT + # TODO: remove hardcoded `cluster.local` + value: {{ include "devlake.fullname" . }}-lake.{{ .Release.Namespace }}.svc.cluster.local:8080 + - name: GRAFANA_ENDPOINT + value: {{ include "devlake.fullname" . }}-grafana.{{ .Release.Namespace }}.svc.cluster.local:3000 volumeMounts: - {{- if ne .Values.option.localtime "" }} - - name: {{ include "devlake.fullname" . }}-ui-localtime - mountPath: /etc/localtime - readOnly: true + {{- if ne .Values.option.localtime "" }} + - name: {{ include "devlake.fullname" . }}-ui-localtime + mountPath: /etc/localtime + readOnly: true {{- end }} volumes: {{- if ne .Values.option.localtime "" }} diff --git a/charts/devlake/templates/services.yaml b/charts/devlake/templates/services.yaml index 8921f235..73e9662d 100644 --- a/charts/devlake/templates/services.yaml +++ b/charts/devlake/templates/services.yaml @@ -16,6 +16,7 @@ # # mysql services --- +{{- if not .Values.mysql.useExternal }} apiVersion: v1 kind: Service metadata: @@ -31,6 +32,7 @@ spec: name: mysql port: 3306 targetPort: 3306 +{{- end }} # grafana services --- diff --git a/charts/devlake/templates/statefulsets.yaml b/charts/devlake/templates/statefulsets.yaml index cbb68603..74a7f82f 100644 --- a/charts/devlake/templates/statefulsets.yaml +++ b/charts/devlake/templates/statefulsets.yaml @@ -16,6 +16,7 @@ # --- # mysql statefulset +{{- if not .Values.mysql.useExternal }} apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/charts/devlake/values.yaml b/charts/devlake/values.yaml index 09d2ad11..c8c91cf2 100644 --- a/charts/devlake/values.yaml +++ b/charts/devlake/values.yaml @@ -21,7 +21,6 @@ replicaCount: 1 mysql: # if use external mysql server, please set true # by default using false, chart will create a single mysql instance - # TODO(matrixji): add support external mysql server useExternal: false # the external mysql server address