deployment-dolphinscheduler-api.yaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. {{- if and .Values.api.enabled }}
  18. apiVersion: apps/v1
  19. kind: Deployment
  20. metadata:
  21. name: {{ include "dolphinscheduler.fullname" . }}-api
  22. labels:
  23. {{- include "dolphinscheduler.api.labels" . | nindent 4 }}
  24. spec:
  25. replicas: {{ .Values.api.replicas }}
  26. selector:
  27. matchLabels:
  28. {{- include "dolphinscheduler.api.labels" . | nindent 6 }}
  29. strategy:
  30. type: {{ .Values.api.strategy.type | quote }}
  31. rollingUpdate:
  32. maxSurge: {{ .Values.api.strategy.rollingUpdate.maxSurge | quote }}
  33. maxUnavailable: {{ .Values.api.strategy.rollingUpdate.maxUnavailable | quote }}
  34. template:
  35. metadata:
  36. labels:
  37. {{- include "dolphinscheduler.api.labels" . | nindent 8 }}
  38. {{- if or .Values.api.annotations .Values.conf.auto }}
  39. annotations:
  40. {{- if .Values.conf.auto }}
  41. checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
  42. {{- end }}
  43. {{- if .Values.api.annotations }}
  44. {{- toYaml .Values.api.annotations | nindent 8 }}
  45. {{- end }}
  46. {{- end }}
  47. spec:
  48. serviceAccountName: {{ template "dolphinscheduler.fullname" . }}
  49. {{- if .Values.api.affinity }}
  50. affinity:
  51. {{- toYaml .Values.api.affinity | nindent 8 }}
  52. {{- end }}
  53. {{- if .Values.api.nodeSelector }}
  54. nodeSelector:
  55. {{- toYaml .Values.api.nodeSelector | nindent 8 }}
  56. {{- end }}
  57. {{- if .Values.api.tolerations }}
  58. tolerations:
  59. {{- toYaml .Values.api.tolerations | nindent 8 }}
  60. {{- end }}
  61. {{- if .Values.image.pullSecret }}
  62. imagePullSecrets:
  63. - name: {{ .Values.image.pullSecret }}
  64. {{- end }}
  65. containers:
  66. - name: {{ include "dolphinscheduler.fullname" . }}-api
  67. image: {{ include "dolphinscheduler.image.fullname.api" . }}
  68. imagePullPolicy: {{ .Values.image.pullPolicy }}
  69. ports:
  70. - containerPort: 12345
  71. name: "api-port"
  72. - containerPort: 25333
  73. name: "python-api-port"
  74. env:
  75. - name: TZ
  76. value: {{ .Values.timezone }}
  77. - name: SPRING_JACKSON_TIME_ZONE
  78. value: {{ .Values.timezone }}
  79. {{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
  80. {{- include "dolphinscheduler.registry.env_vars" . | nindent 12 }}
  81. {{- include "dolphinscheduler.security.env_vars" . | nindent 12 }}
  82. {{ range $key, $value := .Values.api.env }}
  83. - name: {{ $key }}
  84. value: {{ $value | quote }}
  85. {{ end }}
  86. envFrom:
  87. - configMapRef:
  88. name: {{ include "dolphinscheduler.fullname" . }}-common
  89. {{- if .Values.api.resources }}
  90. resources:
  91. {{- toYaml .Values.api.resources | nindent 12 }}
  92. {{- end }}
  93. {{- if .Values.api.livenessProbe.enabled }}
  94. livenessProbe:
  95. exec:
  96. command: ["curl", "-s", "http://localhost:12345/dolphinscheduler/actuator/health/liveness"]
  97. initialDelaySeconds: {{ .Values.api.livenessProbe.initialDelaySeconds }}
  98. periodSeconds: {{ .Values.api.livenessProbe.periodSeconds }}
  99. timeoutSeconds: {{ .Values.api.livenessProbe.timeoutSeconds }}
  100. successThreshold: {{ .Values.api.livenessProbe.successThreshold }}
  101. failureThreshold: {{ .Values.api.livenessProbe.failureThreshold }}
  102. {{- end }}
  103. {{- if .Values.api.readinessProbe.enabled }}
  104. readinessProbe:
  105. exec:
  106. command: ["curl", "-s", "http://localhost:12345/dolphinscheduler/actuator/health/readiness"]
  107. initialDelaySeconds: {{ .Values.api.readinessProbe.initialDelaySeconds }}
  108. periodSeconds: {{ .Values.api.readinessProbe.periodSeconds }}
  109. timeoutSeconds: {{ .Values.api.readinessProbe.timeoutSeconds }}
  110. successThreshold: {{ .Values.api.readinessProbe.successThreshold }}
  111. failureThreshold: {{ .Values.api.readinessProbe.failureThreshold }}
  112. {{- end }}
  113. volumeMounts:
  114. - mountPath: "/opt/dolphinscheduler/logs"
  115. name: {{ include "dolphinscheduler.fullname" . }}-api
  116. - name: config-volume
  117. mountPath: /opt/dolphinscheduler/conf/common.properties
  118. subPath: common_properties
  119. {{- if .Values.api.taskTypeFilter.enabled }}
  120. - name: config-volume
  121. mountPath: /opt/dolphinscheduler/conf/task-type-config.yaml
  122. subPath: task-type-config.yaml
  123. {{- end }}
  124. {{- include "dolphinscheduler.sharedStorage.volumeMount" . | nindent 12 }}
  125. {{- include "dolphinscheduler.fsFileResource.volumeMount" . | nindent 12 }}
  126. {{- include "dolphinscheduler.ldap.ssl.volumeMount" . | nindent 12 }}
  127. {{- include "dolphinscheduler.etcd.ssl.volumeMount" . | nindent 12 }}
  128. volumes:
  129. - name: {{ include "dolphinscheduler.fullname" . }}-api
  130. {{- if .Values.api.persistentVolumeClaim.enabled }}
  131. persistentVolumeClaim:
  132. claimName: {{ include "dolphinscheduler.fullname" . }}-api
  133. {{- else }}
  134. emptyDir: {}
  135. {{- end }}
  136. - name: config-volume
  137. configMap:
  138. name: {{ include "dolphinscheduler.fullname" . }}-configs
  139. {{- include "dolphinscheduler.sharedStorage.volume" . | nindent 8 }}
  140. {{- include "dolphinscheduler.fsFileResource.volume" . | nindent 8 }}
  141. {{- include "dolphinscheduler.ldap.ssl.volume" . | nindent 8 }}
  142. {{- include "dolphinscheduler.etcd.ssl.volume" . | nindent 8 }}
  143. {{- end }}