You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2022/08/01 01:38:16 UTC

[incubator-devlake] branch main updated: refactor: align helm chart with docker-compose (#2643)

This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new cc9b4d9e refactor: align helm chart with docker-compose (#2643)
cc9b4d9e is described below

commit cc9b4d9e76ece78ab0436062625e4a032225d943
Author: Ji Bin <ma...@live.com>
AuthorDate: Mon Aug 1 09:38:13 2022 +0800

    refactor: align helm chart with docker-compose (#2643)
    
    - grafana is reverse-proxied since v0.12
    
    ref: https://github.com/apache/incubator-devlake/pull/2610
    
    Signed-off-by: Ji Bin <ma...@live.com>
---
 .github/workflows/deploy-test.yml          |  4 +---
 deployment/helm/README.md                  | 10 ++++------
 deployment/helm/templates/_helpers.tpl     | 22 ----------------------
 deployment/helm/templates/configmaps.yaml  | 13 -------------
 deployment/helm/templates/deployments.yaml | 17 +++--------------
 deployment/helm/templates/ingresses.yaml   |  4 ++--
 deployment/helm/templates/services.yaml    |  7 ++-----
 deployment/helm/values.yaml                | 17 +++++++----------
 8 files changed, 19 insertions(+), 75 deletions(-)

diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-test.yml
index c5e9d0c7..5922428f 100644
--- a/.github/workflows/deploy-test.yml
+++ b/.github/workflows/deploy-test.yml
@@ -67,8 +67,6 @@ jobs:
           echo Node IP: ${NODE_IP}
           helm install --wait --timeout 300s deploy-test deployment/helm \
             --set service.uiPort=30000 \
-            --set service.grafanaPort=30001 \
-            --set service.grafanaEndpoint=http://${NODE_IP}:30001 \
             --set option.localtime=""
           kubectl get pods -o wide
           kubectl get services -o wide
@@ -85,7 +83,7 @@ jobs:
             # API for devlake
             curl --fail http://${NODE_IP}:30000/api/blueprints || failed=1
             # API for grafana
-            curl --fail http://${NODE_IP}:30001/api/health || failed=1
+            curl --fail http://${NODE_IP}:30000/grafana/api/health || failed=1
             if [ $failed -eq 0 ] ; then
               break
             else
diff --git a/deployment/helm/README.md b/deployment/helm/README.md
index 559d28ec..b40c9b4d 100644
--- a/deployment/helm/README.md
+++ b/deployment/helm/README.md
@@ -1,6 +1,6 @@
 # Deploy devlake with helm
 
-## Prerequest
+## Prerequisites
 
 - Helm >= 3.6.0
 - Kubernetes >= 1.19.0
@@ -10,7 +10,7 @@
 
 clone the code, and enter the deployment/helm folder.
 ```
-helm install devlake . --set service.grafanaEndpoint=http://YOUR-NODE-IP:32000
+helm install devlake .
 ```
 
 And visit your devlake from the node port (32001 by default).
@@ -24,10 +24,10 @@ http://YOUR-NODE-IP:32001
 
 Conditions:
  - IP Address of Kubernetes node: 192.168.0.6
- - Want to visit devlake with port 30000, and grafana at port 30001
+ - Want to visit devlake with port 30000.
 
 ```
-helm install devlake . --set "service.uiPort=30000,service.grafanaPort=30001,service.grafanaEndpoint=http://192.168.0.6:30001"
+helm install devlake . --set service.uiPort=30000
 ```
 
 After deployed, visit devlake: http://192.168.0.6:30000
@@ -98,9 +98,7 @@ Some useful parameters for the chart, you could also check them in values.yaml
 | ui.image.tag  | image tag for ui's image | latest  |
 | ui.image.pullPolicy  | pullPolicy for ui's image | Always  |
 | service.type  | Service type for exposed service | NodePort  |
-| service.grafanaPort  | Service port for grafana | 32000  |
 | service.uiPort  | Service port for config ui | 32001  |
-| service.grafanaEndpoint  | The external grafana endpoint, used when ingress not configured  |  http://127.0.0.1:32000  |
 | 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  | ""  |
diff --git a/deployment/helm/templates/_helpers.tpl b/deployment/helm/templates/_helpers.tpl
index 087b3178..62bff8f6 100644
--- a/deployment/helm/templates/_helpers.tpl
+++ b/deployment/helm/templates/_helpers.tpl
@@ -76,28 +76,6 @@ The ui endpoint prefix
 {{- print .Values.ingress.prefix  "/" | replace "//" "/" | trimAll "/" -}}
 {{- end }}
 
-{{/*
-The grafana endpoint
-*/}}
-{{- define "devlake.grafanaEndpoint" -}}
-{{- if .Values.ingress.enabled }}
-{{- $grafanaPortString := "" }}
-{{- if .Values.ingress.enableHttps }}
-{{- if ne 443 ( .Values.ingress.httpsPort | int) }}
-{{- $grafanaPortString = printf ":%d" ( .Values.ingress.httpsPort | int) }}
-{{- end }}
-{{- printf "https://%s%s/%s" .Values.ingress.hostname $grafanaPortString (include "devlake.grafanaEndpointPrefix" .) }}
-{{- else }}
-{{- if ne 80 ( .Values.ingress.httpPort | int) }}
-{{- $grafanaPortString = printf ":%d" ( .Values.ingress.httpPort | int) }}
-{{- end }}
-{{- printf "http://%s%s/%s" .Values.ingress.hostname $grafanaPortString (include "devlake.grafanaEndpointPrefix" .) }}
-{{- end }}
-{{- else }}
-{{ .Values.service.grafanaEndpoint }}
-{{- end }}
-{{- end }}
-
 {{/*
 The ui endpoint
 */}}
diff --git a/deployment/helm/templates/configmaps.yaml b/deployment/helm/templates/configmaps.yaml
index 90359e38..9ba2dfb9 100644
--- a/deployment/helm/templates/configmaps.yaml
+++ b/deployment/helm/templates/configmaps.yaml
@@ -25,16 +25,3 @@ data:
   MYSQL_DATABASE: "{{ .Values.mysql.database }}"
   MYSQL_ROOT_PASSWORD: "{{ .Values.mysql.rootPassword }}"
 
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: {{ include "devlake.fullname" . }}-grafana-config
-data:
-  grafana.ini: |
-    [server]
-    {{- if .Values.ingress.enabled }}
-    domain = {{ .Values.ingress.hostname }}
-    root_url = {{ include "devlake.grafanaEndpoint" . }}
-    serve_from_sub_path = true
-    {{- end }}
diff --git a/deployment/helm/templates/deployments.yaml b/deployment/helm/templates/deployments.yaml
index fe3a2494..62c0db58 100644
--- a/deployment/helm/templates/deployments.yaml
+++ b/deployment/helm/templates/deployments.yaml
@@ -58,9 +58,6 @@ spec:
             initialDelaySeconds: 30
             timeoutSeconds: 30
           volumeMounts:
-            - mountPath: /etc/grafana/grafana.ini
-              name: {{ include "devlake.fullname" . }}-grafana-config
-              subPath: grafana.ini
             {{- if ne .Values.option.localtime "" }}
             - name: {{ include "devlake.fullname" . }}-grafana-localtime
               mountPath: /etc/localtime
@@ -70,19 +67,11 @@ spec:
             - configMapRef:
                 name: {{ include "devlake.fullname" . }}-config
           env:
-            - name: GF_USERS_ALLOW_SIGN_UP
-              value: 'false'
-            - name: GF_DASHBOARDS_JSON_ENABLED
-              value: 'true'
-            - name: GF_LIVE_ALLOWED_ORIGINS
-              value: '*'
+            - name: GF_SERVER_ROOT_URL
+              value: "%(protocol)s://%(domain)s:%(http_port)s/grafana/"
             - name: MYSQL_URL
               value: {{ include "devlake.fullname" . }}-mysql:3306
       volumes:
-        - configMap:
-            defaultMode: 420
-            name: {{ include "devlake.fullname" . }}-grafana-config
-          name: {{ include "devlake.fullname" . }}-grafana-config
         {{- if ne .Values.option.localtime "" }}
         - name: {{ include "devlake.fullname" . }}-grafana-localtime
           hostPath:
@@ -123,7 +112,7 @@ spec:
               # TODO: remove hardcoded `cluster.local`
               value: {{ include "devlake.fullname" . }}-lake.{{ .Release.Namespace }}.svc.cluster.local:8080
             - name: GRAFANA_ENDPOINT
-              value: "{{ include "devlake.grafanaEndpoint" . }}"
+              value: {{ include "devlake.fullname" . }}-grafana.{{ .Release.Namespace }}.svc.cluster.local:3000
             # - name: ADMIN_USER
             #   value: "admin"
             # - name: ADMIN_PASS
diff --git a/deployment/helm/templates/ingresses.yaml b/deployment/helm/templates/ingresses.yaml
index 124969c8..092151dd 100644
--- a/deployment/helm/templates/ingresses.yaml
+++ b/deployment/helm/templates/ingresses.yaml
@@ -62,10 +62,10 @@ spec:
               service:
                 name: {{ include "devlake.fullname" . }}-grafana
                 port:
-                  number: {{ .Values.service.grafanaPort }}
+                  number: 3000
               {{- else }}
               serviceName: {{ include "devlake.fullname" . }}-grafana
-              servicePort: {{ .Values.service.grafanaPort }}
+              servicePort: 3000
               {{- end }}
           - path: /{{ include "devlake.uiEndpointPrefix" . }}(/?|$)(.*)
             {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
diff --git a/deployment/helm/templates/services.yaml b/deployment/helm/templates/services.yaml
index 8d519f64..38b15cc5 100644
--- a/deployment/helm/templates/services.yaml
+++ b/deployment/helm/templates/services.yaml
@@ -41,18 +41,15 @@ metadata:
   labels:
     {{- include "devlake.labels" . | nindent 4 }}
 spec:
-  type: {{ .Values.service.type }}
+  type: ClusterIP
   selector:
     {{- include "devlake.selectorLabels" . | nindent 4 }}
     devlakeComponent: grafana
   ports:
     - protocol: TCP
       name: grafana
-      port: {{ .Values.service.grafanaPort }}
+      port: 3000
       targetPort: 3000
-      {{- if eq .Values.service.type "NodePort" }}
-      nodePort: {{ .Values.service.grafanaPort }}
-      {{- end }}
 
 
 
diff --git a/deployment/helm/values.yaml b/deployment/helm/values.yaml
index 81bb74b4..70d94e1d 100644
--- a/deployment/helm/values.yaml
+++ b/deployment/helm/values.yaml
@@ -70,8 +70,8 @@ mysql:
 grafana:
   # image for grafana
   image:
-    repository: mericodev/grafana
-    tag: latest
+    repository: apache/devlake-dashboard
+    tag: v0.12.0-rc2
     pullPolicy: Always
   
   resources: {}
@@ -85,8 +85,8 @@ grafana:
 
 lake:
   image:
-    repository: mericodev/lake
-    tag: latest
+    repository: apache/devlake
+    tag: v0.12.0-rc2
     pullPolicy: Always
   # storage for config
   storage:
@@ -104,8 +104,8 @@ lake:
 
 ui:
   image:
-    repository: mericodev/config-ui
-    tag: latest
+    repository: apache/devlake-config-ui
+    tag: v0.12.0-rc2
     pullPolicy: Always
 
   resources: {}
@@ -125,13 +125,10 @@ alpine:
     pullPolicy: IfNotPresent
 
 service:
+  # service type: NodePort/ClusterIP
   type: NodePort
-  # service port for grafana
-  grafanaPort: 32000
   # service port for devlake-ui
   uiPort: 32001
-  # the external endpoint for grafana, only used when ingress not enabled
-  grafanaEndpoint: http://127.0.0.1:32000
 
 ingress:
   enabled: false