deployment-dolphinscheduler-alert.yaml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. apiVersion: apps/v1
  18. kind: Deployment
  19. metadata:
  20. name: {{ include "dolphinscheduler.fullname" . }}-alert
  21. labels:
  22. app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-alert
  23. app.kubernetes.io/instance: {{ .Release.Name }}
  24. app.kubernetes.io/managed-by: {{ .Release.Service }}
  25. app.kubernetes.io/component: alert
  26. spec:
  27. replicas: {{ .Values.alert.replicas }}
  28. selector:
  29. matchLabels:
  30. app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-alert
  31. app.kubernetes.io/instance: {{ .Release.Name }}
  32. app.kubernetes.io/managed-by: {{ .Release.Service }}
  33. app.kubernetes.io/component: alert
  34. strategy:
  35. type: {{ .Values.alert.strategy.type | quote }}
  36. rollingUpdate:
  37. maxSurge: {{ .Values.alert.strategy.rollingUpdate.maxSurge | quote }}
  38. maxUnavailable: {{ .Values.alert.strategy.rollingUpdate.maxUnavailable | quote }}
  39. template:
  40. metadata:
  41. labels:
  42. app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-alert
  43. app.kubernetes.io/instance: {{ .Release.Name }}
  44. app.kubernetes.io/managed-by: {{ .Release.Service }}
  45. app.kubernetes.io/component: alert
  46. spec:
  47. {{- if .Values.alert.affinity }}
  48. affinity: {{- toYaml .Values.alert.affinity | nindent 8 }}
  49. {{- end }}
  50. {{- if .Values.alert.nodeSelector }}
  51. nodeSelector: {{- toYaml .Values.alert.nodeSelector | nindent 8 }}
  52. {{- end }}
  53. {{- if .Values.alert.tolerations }}
  54. tolerations: {{- toYaml . | nindent 8 }}
  55. {{- end }}
  56. initContainers:
  57. - name: init-postgresql
  58. image: busybox:1.31.0
  59. command:
  60. - /bin/sh
  61. - -ec
  62. - |
  63. while ! nc -z ${POSTGRESQL_HOST} ${POSTGRESQL_PORT}; do
  64. counter=$((counter+1))
  65. if [ $counter == 5 ]; then
  66. echo "Error: Couldn't connect to postgresql."
  67. exit 1
  68. fi
  69. echo "Trying to connect to postgresql at ${POSTGRESQL_HOST}:${POSTGRESQL_PORT}. Attempt $counter."
  70. sleep 60
  71. done
  72. env:
  73. - name: POSTGRESQL_HOST
  74. {{- if .Values.postgresql.enabled }}
  75. value: {{ template "dolphinscheduler.postgresql.fullname" . }}
  76. {{- else }}
  77. value: {{ .Values.externalDatabase.host | quote }}
  78. {{- end }}
  79. - name: POSTGRESQL_PORT
  80. {{- if .Values.postgresql.enabled }}
  81. value: "5432"
  82. {{- else }}
  83. value: {{ .Values.externalDatabase.port }}
  84. {{- end }}
  85. containers:
  86. - name: {{ include "dolphinscheduler.fullname" . }}-alert
  87. image: {{ include "dolphinscheduler.image.repository" . | quote }}
  88. args:
  89. - "alert-server"
  90. imagePullPolicy: {{ .Values.image.pullPolicy }}
  91. env:
  92. - name: TZ
  93. value: {{ .Values.timezone }}
  94. - name: XLS_FILE_PATH
  95. valueFrom:
  96. configMapKeyRef:
  97. key: XLS_FILE_PATH
  98. name: {{ include "dolphinscheduler.fullname" . }}-alert
  99. - name: MAIL_SERVER_HOST
  100. valueFrom:
  101. configMapKeyRef:
  102. key: MAIL_SERVER_HOST
  103. name: {{ include "dolphinscheduler.fullname" . }}-alert
  104. - name: MAIL_SERVER_PORT
  105. valueFrom:
  106. configMapKeyRef:
  107. key: MAIL_SERVER_PORT
  108. name: {{ include "dolphinscheduler.fullname" . }}-alert
  109. - name: MAIL_SENDER
  110. valueFrom:
  111. configMapKeyRef:
  112. key: MAIL_SENDER
  113. name: {{ include "dolphinscheduler.fullname" . }}-alert
  114. - name: MAIL_USER
  115. valueFrom:
  116. configMapKeyRef:
  117. key: MAIL_USER
  118. name: {{ include "dolphinscheduler.fullname" . }}-alert
  119. - name: MAIL_PASSWD
  120. valueFrom:
  121. configMapKeyRef:
  122. key: MAIL_PASSWD
  123. name: {{ include "dolphinscheduler.fullname" . }}-alert
  124. - name: MAIL_SMTP_STARTTLS_ENABLE
  125. valueFrom:
  126. configMapKeyRef:
  127. key: MAIL_SMTP_STARTTLS_ENABLE
  128. name: {{ include "dolphinscheduler.fullname" . }}-alert
  129. - name: MAIL_SMTP_SSL_ENABLE
  130. valueFrom:
  131. configMapKeyRef:
  132. key: MAIL_SMTP_SSL_ENABLE
  133. name: {{ include "dolphinscheduler.fullname" . }}-alert
  134. - name: MAIL_SMTP_SSL_TRUST
  135. valueFrom:
  136. configMapKeyRef:
  137. key: MAIL_SMTP_SSL_TRUST
  138. name: {{ include "dolphinscheduler.fullname" . }}-alert
  139. - name: ENTERPRISE_WECHAT_ENABLE
  140. valueFrom:
  141. configMapKeyRef:
  142. key: ENTERPRISE_WECHAT_ENABLE
  143. name: {{ include "dolphinscheduler.fullname" . }}-alert
  144. - name: ENTERPRISE_WECHAT_CORP_ID
  145. valueFrom:
  146. configMapKeyRef:
  147. key: ENTERPRISE_WECHAT_CORP_ID
  148. name: {{ include "dolphinscheduler.fullname" . }}-alert
  149. - name: ENTERPRISE_WECHAT_SECRET
  150. valueFrom:
  151. configMapKeyRef:
  152. key: ENTERPRISE_WECHAT_SECRET
  153. name: {{ include "dolphinscheduler.fullname" . }}-alert
  154. - name: ENTERPRISE_WECHAT_AGENT_ID
  155. valueFrom:
  156. configMapKeyRef:
  157. key: ENTERPRISE_WECHAT_AGENT_ID
  158. name: {{ include "dolphinscheduler.fullname" . }}-alert
  159. - name: ENTERPRISE_WECHAT_USERS
  160. valueFrom:
  161. configMapKeyRef:
  162. key: ENTERPRISE_WECHAT_USERS
  163. name: {{ include "dolphinscheduler.fullname" . }}-alert
  164. - name: POSTGRESQL_HOST
  165. {{- if .Values.postgresql.enabled }}
  166. value: {{ template "dolphinscheduler.postgresql.fullname" . }}
  167. {{- else }}
  168. value: {{ .Values.externalDatabase.host | quote }}
  169. {{- end }}
  170. - name: POSTGRESQL_PORT
  171. {{- if .Values.postgresql.enabled }}
  172. value: "5432"
  173. {{- else }}
  174. value: {{ .Values.externalDatabase.port }}
  175. {{- end }}
  176. - name: POSTGRESQL_USERNAME
  177. {{- if .Values.postgresql.enabled }}
  178. value: {{ .Values.postgresql.postgresqlUsername }}
  179. {{- else }}
  180. value: {{ .Values.externalDatabase.username | quote }}
  181. {{- end }}
  182. - name: POSTGRESQL_PASSWORD
  183. valueFrom:
  184. secretKeyRef:
  185. {{- if .Values.postgresql.enabled }}
  186. name: {{ template "dolphinscheduler.postgresql.fullname" . }}
  187. key: postgresql-password
  188. {{- else }}
  189. name: {{ printf "%s-%s" .Release.Name "externaldb" }}
  190. key: db-password
  191. {{- end }}
  192. {{- if .Values.alert.livenessProbe.enabled }}
  193. livenessProbe:
  194. exec:
  195. command:
  196. - sh
  197. - /root/checkpoint.sh
  198. - worker-server
  199. initialDelaySeconds: {{ .Values.alert.livenessProbe.initialDelaySeconds }}
  200. periodSeconds: {{ .Values.alert.livenessProbe.periodSeconds }}
  201. timeoutSeconds: {{ .Values.alert.livenessProbe.timeoutSeconds }}
  202. successThreshold: {{ .Values.alert.livenessProbe.successThreshold }}
  203. failureThreshold: {{ .Values.alert.livenessProbe.failureThreshold }}
  204. {{- end }}
  205. {{- if .Values.alert.readinessProbe.enabled }}
  206. readinessProbe:
  207. exec:
  208. command:
  209. - sh
  210. - /root/checkpoint.sh
  211. - worker-server
  212. initialDelaySeconds: {{ .Values.alert.readinessProbe.initialDelaySeconds }}
  213. periodSeconds: {{ .Values.alert.readinessProbe.periodSeconds }}
  214. timeoutSeconds: {{ .Values.alert.readinessProbe.timeoutSeconds }}
  215. successThreshold: {{ .Values.alert.readinessProbe.successThreshold }}
  216. failureThreshold: {{ .Values.alert.readinessProbe.failureThreshold }}
  217. {{- end }}
  218. volumeMounts:
  219. - mountPath: "/opt/dolphinscheduler/logs"
  220. name: {{ include "dolphinscheduler.fullname" . }}-alert
  221. volumes:
  222. - name: {{ include "dolphinscheduler.fullname" . }}-alert
  223. {{- if .Values.alert.persistentVolumeClaim.enabled }}
  224. persistentVolumeClaim:
  225. claimName: {{ include "dolphinscheduler.fullname" . }}-alert
  226. {{- else }}
  227. emptyDir: {}
  228. {{- end }}