You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/06/02 03:49:15 UTC

[GitHub] [incubator-devlake] klesh commented on a diff in pull request #1999: feat: support helm deployment

klesh commented on code in PR #1999:
URL: https://github.com/apache/incubator-devlake/pull/1999#discussion_r887533193


##########
deployment/helm/templates/statefulsets.yaml:
##########
@@ -0,0 +1,128 @@
+---
+# mysql statefulset
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: {{ include "devlake.fullname" . }}-mysql
+  labels:
+    {{- include "devlake.labels" . | nindent 4 }}
+spec:
+  replicas: 1
+  serviceName: {{ include "devlake.fullname" . }}-mysql
+  selector:
+    matchLabels:
+      {{- include "devlake.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      labels:
+        {{- include "devlake.selectorLabels" . | nindent 8 }}
+        devlakeComponent: mysql
+    spec:
+      containers:
+        - name: {{ .Chart.Name }}-mysql
+          image: "{{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.tag }}"
+          imagePullPolicy: {{ .Values.mysql.image.pullPolicy }}
+          ports:
+            - name: mysql
+              containerPort: 3306
+              protocol: TCP
+          livenessProbe:
+            exec:
+              command:
+                - "sh"
+                - "-c"
+                - "mysqladmin ping -u root -p{{ .Values.mysql.rootPassword }}"
+            initialDelaySeconds: 60
+            timeoutSeconds: 30
+          {{- with .Values.mysql.resources }}
+          resources:
+            {{- toYaml . | nindent 12 }}
+          {{- end }}
+          envFrom:
+            - configMapRef:
+                name: {{ include "devlake.fullname" . }}-config
+          volumeMounts:
+            - mountPath: /var/lib/mysql
+              name: {{ include "devlake.fullname" . }}-mysql-data
+      {{- with .Values.mysql.nodeSelector }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.mysql.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.mysql.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+  volumeClaimTemplates:
+    - metadata:
+        name: {{ include "devlake.fullname" . }}-mysql-data
+      spec:
+        accessModes: [ "ReadWriteOnce" ]
+        {{- with .Values.mysql.storage.class }}
+        storageClassName: "{{ . }}"
+        {{- end }}
+        resources:
+          requests:
+            storage: "{{ .Values.mysql.storage.size }}"
+
+
+---
+# devlake
+# TODO: graceful startup: init container for waiting mysql ready
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: {{ include "devlake.fullname" . }}-lake
+  labels:
+    {{- include "devlake.labels" . | nindent 4 }}
+spec:
+  replicas: 1
+  serviceName: {{ include "devlake.fullname" . }}-lake
+  selector:
+    matchLabels:
+      {{- include "devlake.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      labels:
+        {{- include "devlake.selectorLabels" . | nindent 8 }}
+        devlakeComponent: lake
+    spec:
+      containers:
+        - name: {{ .Chart.Name }}-lake
+          image: "{{ .Values.lake.image.repository }}:{{ .Values.lake.image.tag }}"
+          imagePullPolicy: {{ .Values.lake.image.pullPolicy }}
+          ports:
+            - containerPort: 8080
+          livenessProbe:
+            httpGet:
+              path: /blueprints
+              port: 8080
+              scheme: HTTP
+            initialDelaySeconds: 60
+            timeoutSeconds: 30
+          envFrom:
+            - configMapRef:
+                name: {{ include "devlake.fullname" . }}-config
+          env:
+            - name: DB_URL
+              value: mysql://{{ .Values.mysql.username }}:{{ .Values.mysql.password }}@{{ include "devlake.fullname" . }}-mysql:3306/{{ .Values.mysql.database }}?charset=utf8mb4&parseTime=True
+          command: ["/bin/sh"]
+          # workaround for keep .env in in pv
+          args: ["-c", "touch /app/config/.env; ln -s /app/config/.env /app/.env; lake"]

Review Comment:
   Neat! 
   But we had added `ENV_PATH` environment variable for specifying the location of  `.env` file, would you kindly consider using this variable?



##########
deployment/helm/templates/deployments.yaml:
##########
@@ -0,0 +1,82 @@
+---
+# grafana
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "devlake.fullname" . }}-grafana
+  labels:
+    {{- include "devlake.labels" . | nindent 4 }}
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      {{- include "devlake.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      labels:
+        {{- include "devlake.selectorLabels" . | nindent 8 }}
+        devlakeComponent: grafana
+    spec:
+      containers:
+        - name: {{ .Chart.Name }}-grafana
+          image: "{{ .Values.grafana.image.repository }}:{{ .Values.grafana.image.tag }}"
+          imagePullPolicy: {{ .Values.grafana.image.pullPolicy }}
+          ports:
+            - containerPort: 3000
+          livenessProbe:
+            httpGet:
+              path: /api/health
+              port: 3000
+            initialDelaySeconds: 30
+            timeoutSeconds: 30
+          envFrom:
+            - 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: MYSQL_URL
+              value: {{ include "devlake.fullname" . }}-mysql:3306
+
+---
+# devlake-ui
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "devlake.fullname" . }}-ui
+  labels:
+    {{- include "devlake.labels" . | nindent 4 }}
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      {{- include "devlake.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      labels:
+        {{- include "devlake.selectorLabels" . | nindent 8 }}
+        devlakeComponent: ui
+    spec:
+      containers:
+        - name: {{ .Chart.Name }}-ui
+          image: "{{ .Values.ui.image.repository }}:{{ .Values.ui.image.tag }}"
+          imagePullPolicy: {{ .Values.ui.image.pullPolicy }}
+          ports:
+            - containerPort: 80
+          envFrom:
+            - 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

Review Comment:
   This should be the public URL of Grafana, which will be sent directly to the user's browser, for the user to click and open up grafana dashboard.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org