deployment-dolphinscheduler-api.yaml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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" . }}-api
  21. labels:
  22. app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api
  23. app.kubernetes.io/instance: {{ .Release.Name }}
  24. app.kubernetes.io/managed-by: {{ .Release.Service }}
  25. app.kubernetes.io/component: api
  26. spec:
  27. replicas: {{ .Values.api.replicas }}
  28. selector:
  29. matchLabels:
  30. app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api
  31. app.kubernetes.io/instance: {{ .Release.Name }}
  32. app.kubernetes.io/managed-by: {{ .Release.Service }}
  33. app.kubernetes.io/component: api
  34. strategy:
  35. type: {{ .Values.api.strategy.type | quote }}
  36. rollingUpdate:
  37. maxSurge: {{ .Values.api.strategy.rollingUpdate.maxSurge | quote }}
  38. maxUnavailable: {{ .Values.api.strategy.rollingUpdate.maxUnavailable | quote }}
  39. template:
  40. metadata:
  41. labels:
  42. app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api
  43. app.kubernetes.io/instance: {{ .Release.Name }}
  44. app.kubernetes.io/managed-by: {{ .Release.Service }}
  45. app.kubernetes.io/component: api
  46. {{- if .Values.alert.annotations }}
  47. annotations:
  48. {{- toYaml .Values.alert.annotations | nindent 8 }}
  49. {{- end }}
  50. spec:
  51. {{- if .Values.api.affinity }}
  52. affinity: {{- toYaml .Values.api.affinity | nindent 8 }}
  53. {{- end }}
  54. {{- if .Values.api.nodeSelector }}
  55. nodeSelector: {{- toYaml .Values.api.nodeSelector | nindent 8 }}
  56. {{- end }}
  57. {{- if .Values.api.tolerations }}
  58. tolerations: {{- toYaml . | nindent 8 }}
  59. {{- end }}
  60. {{- if .Values.image.pullSecret }}
  61. imagePullSecrets:
  62. - name: {{ .Values.image.pullSecret }}
  63. {{- end }}
  64. containers:
  65. - name: {{ include "dolphinscheduler.fullname" . }}-api
  66. image: {{ include "dolphinscheduler.image.fullname" . }}
  67. imagePullPolicy: {{ .Values.image.pullPolicy }}
  68. args:
  69. - "api-server"
  70. ports:
  71. - containerPort: 12345
  72. name: "api-port"
  73. env:
  74. - name: TZ
  75. value: {{ .Values.timezone }}
  76. - name: DOLPHINSCHEDULER_OPTS
  77. valueFrom:
  78. configMapKeyRef:
  79. key: DOLPHINSCHEDULER_OPTS
  80. name: {{ include "dolphinscheduler.fullname" . }}-api
  81. - name: DATABASE_TYPE
  82. {{- if .Values.postgresql.enabled }}
  83. value: "postgresql"
  84. {{- else }}
  85. value: {{ .Values.externalDatabase.type | quote }}
  86. {{- end }}
  87. - name: DATABASE_DRIVER
  88. {{- if .Values.postgresql.enabled }}
  89. value: "org.postgresql.Driver"
  90. {{- else }}
  91. value: {{ .Values.externalDatabase.driver | quote }}
  92. {{- end }}
  93. - name: DATABASE_HOST
  94. {{- if .Values.postgresql.enabled }}
  95. value: {{ template "dolphinscheduler.postgresql.fullname" . }}
  96. {{- else }}
  97. value: {{ .Values.externalDatabase.host | quote }}
  98. {{- end }}
  99. - name: DATABASE_PORT
  100. {{- if .Values.postgresql.enabled }}
  101. value: "5432"
  102. {{- else }}
  103. value: {{ .Values.externalDatabase.port | quote }}
  104. {{- end }}
  105. - name: DATABASE_USERNAME
  106. {{- if .Values.postgresql.enabled }}
  107. value: {{ .Values.postgresql.postgresqlUsername }}
  108. {{- else }}
  109. value: {{ .Values.externalDatabase.username | quote }}
  110. {{- end }}
  111. - name: DATABASE_PASSWORD
  112. valueFrom:
  113. secretKeyRef:
  114. {{- if .Values.postgresql.enabled }}
  115. name: {{ template "dolphinscheduler.postgresql.fullname" . }}
  116. key: postgresql-password
  117. {{- else }}
  118. name: {{ include "dolphinscheduler.fullname" . }}-externaldb
  119. key: database-password
  120. {{- end }}
  121. - name: DATABASE_DATABASE
  122. {{- if .Values.postgresql.enabled }}
  123. value: {{ .Values.postgresql.postgresqlDatabase }}
  124. {{- else }}
  125. value: {{ .Values.externalDatabase.database | quote }}
  126. {{- end }}
  127. - name: DATABASE_PARAMS
  128. {{- if .Values.postgresql.enabled }}
  129. value: "characterEncoding=utf8"
  130. {{- else }}
  131. value: {{ .Values.externalDatabase.params | quote }}
  132. {{- end }}
  133. - name: ZOOKEEPER_QUORUM
  134. {{- if .Values.zookeeper.enabled }}
  135. value: {{ template "dolphinscheduler.zookeeper.quorum" . }}
  136. {{- else }}
  137. value: {{ .Values.externalZookeeper.zookeeperQuorum }}
  138. {{- end }}
  139. - name: ZOOKEEPER_ROOT
  140. {{- if .Values.zookeeper.enabled }}
  141. value: {{ .Values.zookeeper.zookeeperRoot }}
  142. {{- else }}
  143. value: {{ .Values.externalZookeeper.zookeeperRoot }}
  144. {{- end }}
  145. - name: RESOURCE_STORAGE_TYPE
  146. valueFrom:
  147. configMapKeyRef:
  148. key: RESOURCE_STORAGE_TYPE
  149. name: {{ include "dolphinscheduler.fullname" . }}-common
  150. - name: RESOURCE_UPLOAD_PATH
  151. valueFrom:
  152. configMapKeyRef:
  153. key: RESOURCE_UPLOAD_PATH
  154. name: {{ include "dolphinscheduler.fullname" . }}-common
  155. - name: FS_DEFAULT_FS
  156. valueFrom:
  157. configMapKeyRef:
  158. key: FS_DEFAULT_FS
  159. name: {{ include "dolphinscheduler.fullname" . }}-common
  160. {{- if eq .Values.common.configmap.RESOURCE_STORAGE_TYPE "S3" }}
  161. - name: FS_S3A_ENDPOINT
  162. valueFrom:
  163. configMapKeyRef:
  164. key: FS_S3A_ENDPOINT
  165. name: {{ include "dolphinscheduler.fullname" . }}-common
  166. - name: FS_S3A_ACCESS_KEY
  167. valueFrom:
  168. configMapKeyRef:
  169. key: FS_S3A_ACCESS_KEY
  170. name: {{ include "dolphinscheduler.fullname" . }}-common
  171. - name: FS_S3A_SECRET_KEY
  172. valueFrom:
  173. secretKeyRef:
  174. key: fs-s3a-secret-key
  175. name: {{ include "dolphinscheduler.fullname" . }}-fs-s3a
  176. {{- end }}
  177. {{- if .Values.api.resources }}
  178. resources:
  179. limits:
  180. memory: {{ .Values.api.resources.limits.memory | quote }}
  181. cpu: {{ .Values.api.resources.limits.cpu | quote }}
  182. requests:
  183. memory: {{ .Values.api.resources.requests.memory | quote }}
  184. cpu: {{ .Values.api.resources.requests.cpu | quote }}
  185. {{- end }}
  186. {{- if .Values.api.livenessProbe.enabled }}
  187. livenessProbe:
  188. tcpSocket:
  189. port: 12345
  190. initialDelaySeconds: {{ .Values.api.livenessProbe.initialDelaySeconds }}
  191. periodSeconds: {{ .Values.api.livenessProbe.periodSeconds }}
  192. timeoutSeconds: {{ .Values.api.livenessProbe.timeoutSeconds }}
  193. successThreshold: {{ .Values.api.livenessProbe.successThreshold }}
  194. failureThreshold: {{ .Values.api.livenessProbe.failureThreshold }}
  195. {{- end }}
  196. {{- if .Values.api.readinessProbe.enabled }}
  197. readinessProbe:
  198. tcpSocket:
  199. port: 12345
  200. initialDelaySeconds: {{ .Values.api.readinessProbe.initialDelaySeconds }}
  201. periodSeconds: {{ .Values.api.readinessProbe.periodSeconds }}
  202. timeoutSeconds: {{ .Values.api.readinessProbe.timeoutSeconds }}
  203. successThreshold: {{ .Values.api.readinessProbe.successThreshold }}
  204. failureThreshold: {{ .Values.api.readinessProbe.failureThreshold }}
  205. {{- end }}
  206. volumeMounts:
  207. - mountPath: "/opt/dolphinscheduler/logs"
  208. name: {{ include "dolphinscheduler.fullname" . }}-api
  209. {{- if .Values.common.fsFileResourcePersistence.enabled }}
  210. - mountPath: {{ .Values.common.configmap.RESOURCE_UPLOAD_PATH | quote }}
  211. name: {{ include "dolphinscheduler.fullname" . }}-fs-file
  212. {{- end }}
  213. volumes:
  214. - name: {{ include "dolphinscheduler.fullname" . }}-api
  215. {{- if .Values.api.persistentVolumeClaim.enabled }}
  216. persistentVolumeClaim:
  217. claimName: {{ include "dolphinscheduler.fullname" . }}-api
  218. {{- else }}
  219. emptyDir: {}
  220. {{- end }}
  221. {{- if .Values.common.fsFileResourcePersistence.enabled }}
  222. - name: {{ include "dolphinscheduler.fullname" . }}-fs-file
  223. persistentVolumeClaim:
  224. claimName: {{ include "dolphinscheduler.fullname" . }}-fs-file
  225. {{- end }}