deployment-dolphinscheduler-alert.yaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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. {{- if .Values.alert.annotations }}
  47. annotations:
  48. {{- toYaml .Values.alert.annotations | nindent 8 }}
  49. {{- end }}
  50. spec:
  51. {{- if .Values.alert.affinity }}
  52. affinity: {{- toYaml .Values.alert.affinity | nindent 8 }}
  53. {{- end }}
  54. {{- if .Values.alert.nodeSelector }}
  55. nodeSelector: {{- toYaml .Values.alert.nodeSelector | nindent 8 }}
  56. {{- end }}
  57. {{- if .Values.alert.tolerations }}
  58. tolerations: {{- toYaml . | nindent 8 }}
  59. {{- end }}
  60. initContainers:
  61. - name: init-database
  62. image: busybox:1.31.0
  63. command:
  64. - /bin/sh
  65. - -ec
  66. - |
  67. while ! nc -z ${DATABASE_HOST} ${DATABASE_PORT}; do
  68. counter=$((counter+1))
  69. if [ $counter == 5 ]; then
  70. echo "Error: Couldn't connect to database."
  71. exit 1
  72. fi
  73. echo "Trying to connect to database at ${DATABASE_HOST}:${DATABASE_PORT}. Attempt $counter."
  74. sleep 60
  75. done
  76. env:
  77. - name: DATABASE_HOST
  78. {{- if .Values.postgresql.enabled }}
  79. value: {{ template "dolphinscheduler.postgresql.fullname" . }}
  80. {{- else }}
  81. value: {{ .Values.externalDatabase.host | quote }}
  82. {{- end }}
  83. - name: DATABASE_PORT
  84. {{- if .Values.postgresql.enabled }}
  85. value: "5432"
  86. {{- else }}
  87. value: {{ .Values.externalDatabase.port | quote }}
  88. {{- end }}
  89. {{- if .Values.image.pullSecrets }}
  90. imagePullSecrets:
  91. - name: {{ include "dolphinscheduler.image.pullSecrets" . }}
  92. {{- end }}
  93. containers:
  94. - name: {{ include "dolphinscheduler.fullname" . }}-alert
  95. image: {{ include "dolphinscheduler.image.repository" . | quote }}
  96. args:
  97. - "alert-server"
  98. imagePullPolicy: {{ .Values.image.pullPolicy }}
  99. env:
  100. - name: DOLPHINSCHEDULER_OPTS
  101. value: {{ default "" .Values.alert.jvmOptions }}
  102. - name: TZ
  103. value: {{ .Values.timezone }}
  104. - name: ALERT_PLUGIN_DIR
  105. valueFrom:
  106. configMapKeyRef:
  107. key: ALERT_PLUGIN_DIR
  108. name: {{ include "dolphinscheduler.fullname" . }}-alert
  109. - name: XLS_FILE_PATH
  110. valueFrom:
  111. configMapKeyRef:
  112. key: XLS_FILE_PATH
  113. name: {{ include "dolphinscheduler.fullname" . }}-alert
  114. - name: MAIL_SERVER_HOST
  115. valueFrom:
  116. configMapKeyRef:
  117. key: MAIL_SERVER_HOST
  118. name: {{ include "dolphinscheduler.fullname" . }}-alert
  119. - name: MAIL_SERVER_PORT
  120. valueFrom:
  121. configMapKeyRef:
  122. key: MAIL_SERVER_PORT
  123. name: {{ include "dolphinscheduler.fullname" . }}-alert
  124. - name: MAIL_SENDER
  125. valueFrom:
  126. configMapKeyRef:
  127. key: MAIL_SENDER
  128. name: {{ include "dolphinscheduler.fullname" . }}-alert
  129. - name: MAIL_USER
  130. valueFrom:
  131. configMapKeyRef:
  132. key: MAIL_USER
  133. name: {{ include "dolphinscheduler.fullname" . }}-alert
  134. - name: MAIL_PASSWD
  135. valueFrom:
  136. configMapKeyRef:
  137. key: MAIL_PASSWD
  138. name: {{ include "dolphinscheduler.fullname" . }}-alert
  139. - name: MAIL_SMTP_STARTTLS_ENABLE
  140. valueFrom:
  141. configMapKeyRef:
  142. key: MAIL_SMTP_STARTTLS_ENABLE
  143. name: {{ include "dolphinscheduler.fullname" . }}-alert
  144. - name: MAIL_SMTP_SSL_ENABLE
  145. valueFrom:
  146. configMapKeyRef:
  147. key: MAIL_SMTP_SSL_ENABLE
  148. name: {{ include "dolphinscheduler.fullname" . }}-alert
  149. - name: MAIL_SMTP_SSL_TRUST
  150. valueFrom:
  151. configMapKeyRef:
  152. key: MAIL_SMTP_SSL_TRUST
  153. name: {{ include "dolphinscheduler.fullname" . }}-alert
  154. - name: ENTERPRISE_WECHAT_ENABLE
  155. valueFrom:
  156. configMapKeyRef:
  157. key: ENTERPRISE_WECHAT_ENABLE
  158. name: {{ include "dolphinscheduler.fullname" . }}-alert
  159. - name: ENTERPRISE_WECHAT_CORP_ID
  160. valueFrom:
  161. configMapKeyRef:
  162. key: ENTERPRISE_WECHAT_CORP_ID
  163. name: {{ include "dolphinscheduler.fullname" . }}-alert
  164. - name: ENTERPRISE_WECHAT_SECRET
  165. valueFrom:
  166. configMapKeyRef:
  167. key: ENTERPRISE_WECHAT_SECRET
  168. name: {{ include "dolphinscheduler.fullname" . }}-alert
  169. - name: ENTERPRISE_WECHAT_AGENT_ID
  170. valueFrom:
  171. configMapKeyRef:
  172. key: ENTERPRISE_WECHAT_AGENT_ID
  173. name: {{ include "dolphinscheduler.fullname" . }}-alert
  174. - name: ENTERPRISE_WECHAT_USERS
  175. valueFrom:
  176. configMapKeyRef:
  177. key: ENTERPRISE_WECHAT_USERS
  178. name: {{ include "dolphinscheduler.fullname" . }}-alert
  179. - name: DATABASE_TYPE
  180. {{- if .Values.postgresql.enabled }}
  181. value: "postgresql"
  182. {{- else }}
  183. value: {{ .Values.externalDatabase.type | quote }}
  184. {{- end }}
  185. - name: DATABASE_DRIVER
  186. {{- if .Values.postgresql.enabled }}
  187. value: "org.postgresql.Driver"
  188. {{- else }}
  189. value: {{ .Values.externalDatabase.driver | quote }}
  190. {{- end }}
  191. - name: DATABASE_HOST
  192. {{- if .Values.postgresql.enabled }}
  193. value: {{ template "dolphinscheduler.postgresql.fullname" . }}
  194. {{- else }}
  195. value: {{ .Values.externalDatabase.host | quote }}
  196. {{- end }}
  197. - name: DATABASE_PORT
  198. {{- if .Values.postgresql.enabled }}
  199. value: "5432"
  200. {{- else }}
  201. value: {{ .Values.externalDatabase.port | quote }}
  202. {{- end }}
  203. - name: DATABASE_USERNAME
  204. {{- if .Values.postgresql.enabled }}
  205. value: {{ .Values.postgresql.postgresqlUsername }}
  206. {{- else }}
  207. value: {{ .Values.externalDatabase.username | quote }}
  208. {{- end }}
  209. - name: DATABASE_PASSWORD
  210. valueFrom:
  211. secretKeyRef:
  212. {{- if .Values.postgresql.enabled }}
  213. name: {{ template "dolphinscheduler.postgresql.fullname" . }}
  214. key: postgresql-password
  215. {{- else }}
  216. name: {{ printf "%s-%s" .Release.Name "externaldb" }}
  217. key: db-password
  218. {{- end }}
  219. - name: DATABASE_DATABASE
  220. {{- if .Values.postgresql.enabled }}
  221. value: {{ .Values.postgresql.postgresqlDatabase }}
  222. {{- else }}
  223. value: {{ .Values.externalDatabase.database | quote }}
  224. {{- end }}
  225. - name: DATABASE_PARAMS
  226. {{- if .Values.postgresql.enabled }}
  227. value: "characterEncoding=utf8"
  228. {{- else }}
  229. value: {{ .Values.externalDatabase.params | quote }}
  230. {{- end }}
  231. - name: RESOURCE_STORAGE_TYPE
  232. valueFrom:
  233. configMapKeyRef:
  234. key: RESOURCE_STORAGE_TYPE
  235. name: {{ include "dolphinscheduler.fullname" . }}-common
  236. - name: RESOURCE_UPLOAD_PATH
  237. valueFrom:
  238. configMapKeyRef:
  239. key: RESOURCE_UPLOAD_PATH
  240. name: {{ include "dolphinscheduler.fullname" . }}-common
  241. - name: FS_DEFAULT_FS
  242. valueFrom:
  243. configMapKeyRef:
  244. key: FS_DEFAULT_FS
  245. name: {{ include "dolphinscheduler.fullname" . }}-common
  246. - name: FS_S3A_ENDPOINT
  247. valueFrom:
  248. configMapKeyRef:
  249. key: FS_S3A_ENDPOINT
  250. name: {{ include "dolphinscheduler.fullname" . }}-common
  251. - name: FS_S3A_ACCESS_KEY
  252. valueFrom:
  253. configMapKeyRef:
  254. key: FS_S3A_ACCESS_KEY
  255. name: {{ include "dolphinscheduler.fullname" . }}-common
  256. - name: FS_S3A_SECRET_KEY
  257. valueFrom:
  258. configMapKeyRef:
  259. key: FS_S3A_SECRET_KEY
  260. name: {{ include "dolphinscheduler.fullname" . }}-common
  261. {{- if .Values.alert.resources }}
  262. resources:
  263. limits:
  264. memory: {{ .Values.alert.resources.limits.memory }}
  265. cpu: {{ .Values.alert.resources.limits.cpu }}
  266. requests:
  267. memory: {{ .Values.alert.resources.requests.memory }}
  268. cpu: {{ .Values.alert.resources.requests.cpu }}
  269. {{- end }}
  270. {{- if .Values.alert.livenessProbe.enabled }}
  271. livenessProbe:
  272. exec:
  273. command:
  274. - sh
  275. - /root/checkpoint.sh
  276. - AlertServer
  277. initialDelaySeconds: {{ .Values.alert.livenessProbe.initialDelaySeconds }}
  278. periodSeconds: {{ .Values.alert.livenessProbe.periodSeconds }}
  279. timeoutSeconds: {{ .Values.alert.livenessProbe.timeoutSeconds }}
  280. successThreshold: {{ .Values.alert.livenessProbe.successThreshold }}
  281. failureThreshold: {{ .Values.alert.livenessProbe.failureThreshold }}
  282. {{- end }}
  283. {{- if .Values.alert.readinessProbe.enabled }}
  284. readinessProbe:
  285. exec:
  286. command:
  287. - sh
  288. - /root/checkpoint.sh
  289. - AlertServer
  290. initialDelaySeconds: {{ .Values.alert.readinessProbe.initialDelaySeconds }}
  291. periodSeconds: {{ .Values.alert.readinessProbe.periodSeconds }}
  292. timeoutSeconds: {{ .Values.alert.readinessProbe.timeoutSeconds }}
  293. successThreshold: {{ .Values.alert.readinessProbe.successThreshold }}
  294. failureThreshold: {{ .Values.alert.readinessProbe.failureThreshold }}
  295. {{- end }}
  296. volumeMounts:
  297. - mountPath: "/opt/dolphinscheduler/logs"
  298. name: {{ include "dolphinscheduler.fullname" . }}-alert
  299. volumes:
  300. - name: {{ include "dolphinscheduler.fullname" . }}-alert
  301. {{- if .Values.alert.persistentVolumeClaim.enabled }}
  302. persistentVolumeClaim:
  303. claimName: {{ include "dolphinscheduler.fullname" . }}-alert
  304. {{- else }}
  305. emptyDir: {}
  306. {{- end }}