Pārlūkot izejas kodu

Merge pull request #4783 from chengshiwen/improve-k8s-adapt-alert-server

[Improvement][K8s] Adapt to the latest alert-server with updated config and port 50052
xingchun-chen 4 gadi atpakaļ
vecāks
revīzija
969fba8afd

+ 5 - 4
docker/kubernetes/dolphinscheduler/templates/NOTES.txt

@@ -15,17 +15,18 @@
 # limitations under the License.
 #
 
-** Please be patient while the chart Dolphinscheduler {{ .Chart.AppVersion }} is being deployed **
+** Please be patient while the chart DolphinScheduler {{ .Chart.AppVersion }} is being deployed **
 
-Get the Dolphinscheduler URL by running:
+Access DolphinScheduler by:
 
 {{- if .Values.ingress.enabled }}
 
-  export HOSTNAME=$(kubectl get ingress --namespace {{ .Release.Namespace }} {{ template "dolphinscheduler.fullname" . }} -o jsonpath='{.spec.rules[0].host}')
-  echo "Dolphinscheduler URL: http://$HOSTNAME/"
+  DolphinScheduler URL: http://{{ .Values.ingress.host }}/dolphinscheduler
 
 {{- else }}
 
   kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "dolphinscheduler.fullname" . }}-api 12345:12345
 
+  DolphinScheduler URL: http://127.0.0.1:12345/dolphinscheduler
+
 {{- end }}

+ 0 - 14
docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-alert.yaml

@@ -26,18 +26,4 @@ metadata:
 data:
   DOLPHINSCHEDULER_OPTS: {{ .Values.alert.configmap.DOLPHINSCHEDULER_OPTS | quote }}
   ALERT_PLUGIN_DIR: {{ .Values.alert.configmap.ALERT_PLUGIN_DIR | quote }}
-  XLS_FILE_PATH: {{ .Values.alert.configmap.XLS_FILE_PATH | quote }}
-  MAIL_SERVER_HOST: {{ .Values.alert.configmap.MAIL_SERVER_HOST | quote }}
-  MAIL_SERVER_PORT: {{ .Values.alert.configmap.MAIL_SERVER_PORT | quote }}
-  MAIL_SENDER: {{ .Values.alert.configmap.MAIL_SENDER | quote }}
-  MAIL_USER: {{ .Values.alert.configmap.MAIL_USER | quote }}
-  MAIL_PASSWD: {{ .Values.alert.configmap.MAIL_PASSWD | quote }}
-  MAIL_SMTP_STARTTLS_ENABLE: {{ .Values.alert.configmap.MAIL_SMTP_STARTTLS_ENABLE | quote }}
-  MAIL_SMTP_SSL_ENABLE: {{ .Values.alert.configmap.MAIL_SMTP_SSL_ENABLE | quote }}
-  MAIL_SMTP_SSL_TRUST: {{ .Values.alert.configmap.MAIL_SMTP_SSL_TRUST | quote }}
-  ENTERPRISE_WECHAT_ENABLE: {{ .Values.alert.configmap.ENTERPRISE_WECHAT_ENABLE | quote }}
-  ENTERPRISE_WECHAT_CORP_ID: {{ .Values.alert.configmap.ENTERPRISE_WECHAT_CORP_ID | quote }}
-  ENTERPRISE_WECHAT_SECRET: {{ .Values.alert.configmap.ENTERPRISE_WECHAT_SECRET | quote }}
-  ENTERPRISE_WECHAT_AGENT_ID: {{ .Values.alert.configmap.ENTERPRISE_WECHAT_AGENT_ID | quote }}
-  ENTERPRISE_WECHAT_USERS: {{ .Values.alert.configmap.ENTERPRISE_WECHAT_USERS | quote }}
 {{- end }}

+ 3 - 70
docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-alert.yaml

@@ -67,6 +67,9 @@ spec:
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           args:
             - "alert-server"
+          ports:
+            - containerPort: 50052
+              name: "alert-port"
           env:
             - name: TZ
               value: {{ .Values.timezone }}
@@ -80,76 +83,6 @@ spec:
                 configMapKeyRef:
                   key: ALERT_PLUGIN_DIR
                   name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: XLS_FILE_PATH
-              valueFrom:
-                configMapKeyRef:
-                  key: XLS_FILE_PATH
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SERVER_HOST
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SERVER_HOST
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SERVER_PORT
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SERVER_PORT
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SENDER
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SENDER
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_USER
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_USER
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_PASSWD
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_PASSWD
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SMTP_STARTTLS_ENABLE
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SMTP_STARTTLS_ENABLE
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SMTP_SSL_ENABLE
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SMTP_SSL_ENABLE
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SMTP_SSL_TRUST
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SMTP_SSL_TRUST
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: ENTERPRISE_WECHAT_ENABLE
-              valueFrom:
-                configMapKeyRef:
-                  key: ENTERPRISE_WECHAT_ENABLE
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: ENTERPRISE_WECHAT_CORP_ID
-              valueFrom:
-                configMapKeyRef:
-                  key: ENTERPRISE_WECHAT_CORP_ID
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: ENTERPRISE_WECHAT_SECRET
-              valueFrom:
-                configMapKeyRef:
-                  key: ENTERPRISE_WECHAT_SECRET
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: ENTERPRISE_WECHAT_AGENT_ID
-              valueFrom:
-                configMapKeyRef:
-                  key: ENTERPRISE_WECHAT_AGENT_ID
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: ENTERPRISE_WECHAT_USERS
-              valueFrom:
-                configMapKeyRef:
-                  key: ENTERPRISE_WECHAT_USERS
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
             - name: DATABASE_TYPE
               {{- if .Values.postgresql.enabled }}
               value: "postgresql"

+ 1 - 1
docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml

@@ -132,7 +132,7 @@ spec:
               {{- end }}
             - name: ZOOKEEPER_QUORUM
               {{- if .Values.zookeeper.enabled }}
-              value: "{{ template "dolphinscheduler.zookeeper.quorum" . }}"
+              value: {{ template "dolphinscheduler.zookeeper.quorum" . }}
               {{- else }}
               value: {{ .Values.externalZookeeper.zookeeperQuorum }}
               {{- end }}

+ 3 - 76
docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml

@@ -117,56 +117,8 @@ spec:
                 configMapKeyRef:
                   name: {{ include "dolphinscheduler.fullname" . }}-common
                   key: DOLPHINSCHEDULER_DATA_BASEDIR_PATH
-            - name: ALERT_PLUGIN_DIR
-              valueFrom:
-                configMapKeyRef:
-                  key: ALERT_PLUGIN_DIR
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: XLS_FILE_PATH
-              valueFrom:
-                configMapKeyRef:
-                  key: XLS_FILE_PATH
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SERVER_HOST
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SERVER_HOST
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SERVER_PORT
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SERVER_PORT
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SENDER
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SENDER
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_USER
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_USER
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_PASSWD
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_PASSWD
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SMTP_STARTTLS_ENABLE
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SMTP_STARTTLS_ENABLE
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SMTP_SSL_ENABLE
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SMTP_SSL_ENABLE
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: MAIL_SMTP_SSL_TRUST
-              valueFrom:
-                configMapKeyRef:
-                  key: MAIL_SMTP_SSL_TRUST
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
+            - name: ALERT_LISTEN_HOST
+              value: {{ include "dolphinscheduler.fullname" . }}-alert
             - name: DATABASE_TYPE
               {{- if .Values.postgresql.enabled }}
               value: "postgresql"
@@ -221,7 +173,7 @@ spec:
               {{- end }}
             - name: ZOOKEEPER_QUORUM
               {{- if .Values.zookeeper.enabled }}
-              value: "{{ template "dolphinscheduler.zookeeper.quorum" . }}"
+              value: {{ template "dolphinscheduler.zookeeper.quorum" . }}
               {{- else }}
               value: {{ .Values.externalZookeeper.zookeeperQuorum }}
               {{- end }}
@@ -263,31 +215,6 @@ spec:
                   key: fs-s3a-secret-key
                   name: {{ printf "%s-%s" .Release.Name "fs-s3a"  }}
             {{- end }}
-            - name: ENTERPRISE_WECHAT_ENABLE
-              valueFrom:
-                configMapKeyRef:
-                  key: ENTERPRISE_WECHAT_ENABLE
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: ENTERPRISE_WECHAT_CORP_ID
-              valueFrom:
-                configMapKeyRef:
-                  key: ENTERPRISE_WECHAT_CORP_ID
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: ENTERPRISE_WECHAT_SECRET
-              valueFrom:
-                configMapKeyRef:
-                  key: ENTERPRISE_WECHAT_SECRET
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: ENTERPRISE_WECHAT_AGENT_ID
-              valueFrom:
-                configMapKeyRef:
-                  key: ENTERPRISE_WECHAT_AGENT_ID
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
-            - name: ENTERPRISE_WECHAT_USERS
-              valueFrom:
-                configMapKeyRef:
-                  key: ENTERPRISE_WECHAT_USERS
-                  name: {{ include "dolphinscheduler.fullname" . }}-alert
           {{- if .Values.worker.resources }}
           resources:
             limits:

+ 35 - 0
docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-alert.yaml

@@ -0,0 +1,35 @@
+#
+# 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.
+#
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ include "dolphinscheduler.fullname" . }}-alert
+  labels:
+    app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-alert
+    app.kubernetes.io/instance: {{ .Release.Name }}
+    app.kubernetes.io/managed-by: {{ .Release.Service }}
+spec:
+  ports:
+    - port: 50052
+      targetPort: alert-port
+      protocol: TCP
+      name: alert-port
+  selector:
+    app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-alert
+    app.kubernetes.io/instance: {{ .Release.Name }}
+    app.kubernetes.io/managed-by: {{ .Release.Service }}
+    app.kubernetes.io/component: alert

+ 8 - 22
docker/kubernetes/dolphinscheduler/values.yaml

@@ -31,7 +31,7 @@ image:
   pullPolicy: "IfNotPresent"
   pullSecrets: []
 
-# If not exists external database, by default, Dolphinscheduler's database will use it.
+## If not exists external database, by default, Dolphinscheduler's database will use it.
 postgresql:
   enabled: true
   postgresqlUsername: "root"
@@ -42,8 +42,8 @@ postgresql:
     size: "20Gi"
     storageClass: "-"
 
-# If exists external database, and set postgresql.enable value to false.
-# external database will be used, otherwise Dolphinscheduler's database will be used.
+## If exists external database, and set postgresql.enable value to false.
+## external database will be used, otherwise Dolphinscheduler's database will be used.
 externalDatabase:
   type: "postgresql"
   driver: "org.postgresql.Driver"
@@ -52,10 +52,10 @@ externalDatabase:
   username: "root"
   password: "root"
   database: "dolphinscheduler"
-  # multi params should join with & char
+  ## multi params should join with & char
   params: "characterEncoding=utf8"
 
-# If not exists external zookeeper, by default, Dolphinscheduler's zookeeper will use it.
+## If not exists external zookeeper, by default, Dolphinscheduler's zookeeper will use it.
 zookeeper:
   enabled: true
   fourlwCommandsWhitelist: srvr,ruok,wchs,cons
@@ -67,8 +67,8 @@ zookeeper:
     storageClass: "-"
   zookeeperRoot: "/dolphinscheduler"
 
-# If exists external zookeeper, and set zookeeper.enable value to false.
-# If zookeeper.enable is false, Dolphinscheduler's zookeeper will use it.
+## If exists external zookeeper, and set zookeeper.enable value to false.
+## If zookeeper.enable is false, Dolphinscheduler's zookeeper will use it.
 externalZookeeper:
   zookeeperQuorum: "127.0.0.1:2181"
   zookeeperRoot: "/dolphinscheduler"
@@ -283,21 +283,7 @@ alert:
   ## ConfigMap
   configmap:
     DOLPHINSCHEDULER_OPTS: ""
-    ALERT_PLUGIN_DIR: "/opt/dolphinscheduler/alert/plugin"
-    XLS_FILE_PATH: "/tmp/xls"
-    MAIL_SERVER_HOST: ""
-    MAIL_SERVER_PORT: ""
-    MAIL_SENDER: ""
-    MAIL_USER: ""
-    MAIL_PASSWD: ""
-    MAIL_SMTP_STARTTLS_ENABLE: false
-    MAIL_SMTP_SSL_ENABLE: false
-    MAIL_SMTP_SSL_TRUST: ""
-    ENTERPRISE_WECHAT_ENABLE: false
-    ENTERPRISE_WECHAT_CORP_ID: ""
-    ENTERPRISE_WECHAT_SECRET: ""
-    ENTERPRISE_WECHAT_AGENT_ID: ""
-    ENTERPRISE_WECHAT_USERS: ""
+    ALERT_PLUGIN_DIR: "lib/plugin/alert"
   ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated.
   ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
   livenessProbe: