From 01ee2b32110371b9588e7e69984a2db8e8ac599e Mon Sep 17 00:00:00 2001 From: chengshiwen Date: Wed, 17 Feb 2021 01:37:55 +0800 Subject: [PATCH] [Improvement][K8s] Adapt to the latest alert-server with updated config and port 50052 --- .../dolphinscheduler/templates/NOTES.txt | 9 ++- .../configmap-dolphinscheduler-alert.yaml | 14 ---- .../deployment-dolphinscheduler-alert.yaml | 73 +---------------- .../deployment-dolphinscheduler-api.yaml | 2 +- .../statefulset-dolphinscheduler-worker.yaml | 79 +------------------ .../templates/svc-dolphinscheduler-alert.yaml | 35 ++++++++ .../kubernetes/dolphinscheduler/values.yaml | 30 ++----- 7 files changed, 55 insertions(+), 187 deletions(-) create mode 100644 docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-alert.yaml diff --git a/docker/kubernetes/dolphinscheduler/templates/NOTES.txt b/docker/kubernetes/dolphinscheduler/templates/NOTES.txt index 8afe766d27..6e2800a9cc 100644 --- a/docker/kubernetes/dolphinscheduler/templates/NOTES.txt +++ b/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 }} diff --git a/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-alert.yaml b/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-alert.yaml index 2c7dd67c57..b5ffadd4bd 100644 --- a/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-alert.yaml +++ b/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 }} \ No newline at end of file diff --git a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-alert.yaml b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-alert.yaml index e4a2b21ffa..f66427e470 100644 --- a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-alert.yaml +++ b/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" diff --git a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml index f4b4795c28..b6af321d73 100644 --- a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml +++ b/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 }} diff --git a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml index 7ca548c763..0b12ed714d 100644 --- a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml +++ b/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: diff --git a/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-alert.yaml b/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-alert.yaml new file mode 100644 index 0000000000..404c2e4827 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/docker/kubernetes/dolphinscheduler/values.yaml b/docker/kubernetes/dolphinscheduler/values.yaml index 99979af9d4..da282d8698 100644 --- a/docker/kubernetes/dolphinscheduler/values.yaml +++ b/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: