statefulset-dolphinscheduler-worker.yaml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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: StatefulSet
  19. metadata:
  20. name: {{ include "dolphinscheduler.fullname" . }}-worker
  21. labels:
  22. {{- include "dolphinscheduler.worker.labels" . | nindent 4 }}
  23. spec:
  24. podManagementPolicy: {{ .Values.worker.podManagementPolicy }}
  25. replicas: {{ .Values.worker.replicas }}
  26. selector:
  27. matchLabels:
  28. {{- include "dolphinscheduler.worker.labels" . | nindent 6 }}
  29. serviceName: {{ template "dolphinscheduler.fullname" . }}-worker-headless
  30. template:
  31. metadata:
  32. labels:
  33. {{- include "dolphinscheduler.worker.labels" . | nindent 8 }}
  34. {{- if .Values.worker.annotations }}
  35. annotations:
  36. {{- toYaml .Values.worker.annotations | nindent 8 }}
  37. {{- end }}
  38. spec:
  39. {{- if .Values.worker.affinity }}
  40. affinity:
  41. {{- toYaml .Values.worker.affinity | nindent 8 }}
  42. {{- end }}
  43. {{- if .Values.worker.nodeSelector }}
  44. nodeSelector:
  45. {{- toYaml .Values.worker.nodeSelector | nindent 8 }}
  46. {{- end }}
  47. {{- if .Values.worker.tolerations }}
  48. tolerations:
  49. {{- toYaml .Values.worker.tolerations | nindent 8 }}
  50. {{- end }}
  51. {{- if .Values.image.pullSecret }}
  52. imagePullSecrets:
  53. - name: {{ .Values.image.pullSecret }}
  54. {{- end }}
  55. containers:
  56. - name: {{ include "dolphinscheduler.fullname" . }}-worker
  57. image: {{ include "dolphinscheduler.image.fullname.worker" . }}
  58. imagePullPolicy: {{ .Values.image.pullPolicy }}
  59. ports:
  60. - containerPort: 1234
  61. name: "worker-port"
  62. env:
  63. - name: TZ
  64. value: {{ .Values.timezone }}
  65. - name: SPRING_JACKSON_TIME_ZONE
  66. value: {{ .Values.timezone }}
  67. - name: ALERT_LISTEN_HOST
  68. value: {{ include "dolphinscheduler.fullname" . }}-alert
  69. {{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
  70. {{- include "dolphinscheduler.registry.env_vars" . | nindent 12 }}
  71. {{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }}
  72. {{ range $key, $value := .Values.worker.env }}
  73. - name: {{ $key }}
  74. value: {{ $value | quote }}
  75. {{ end }}
  76. envFrom:
  77. - configMapRef:
  78. name: {{ include "dolphinscheduler.fullname" . }}-common
  79. {{- if .Values.worker.resources }}
  80. resources:
  81. {{- toYaml .Values.worker.resources | nindent 12 }}
  82. {{- end }}
  83. {{- if .Values.worker.livenessProbe.enabled }}
  84. livenessProbe:
  85. exec:
  86. command: ["curl", "-s", "http://localhost:1235/actuator/health/liveness"]
  87. initialDelaySeconds: {{ .Values.worker.livenessProbe.initialDelaySeconds }}
  88. periodSeconds: {{ .Values.worker.livenessProbe.periodSeconds }}
  89. timeoutSeconds: {{ .Values.worker.livenessProbe.timeoutSeconds }}
  90. successThreshold: {{ .Values.worker.livenessProbe.successThreshold }}
  91. failureThreshold: {{ .Values.worker.livenessProbe.failureThreshold }}
  92. {{- end }}
  93. {{- if .Values.worker.readinessProbe.enabled }}
  94. readinessProbe:
  95. exec:
  96. command: ["curl", "-s", "http://localhost:1235/actuator/health/readiness"]
  97. initialDelaySeconds: {{ .Values.worker.readinessProbe.initialDelaySeconds }}
  98. periodSeconds: {{ .Values.worker.readinessProbe.periodSeconds }}
  99. timeoutSeconds: {{ .Values.worker.readinessProbe.timeoutSeconds }}
  100. successThreshold: {{ .Values.worker.readinessProbe.successThreshold }}
  101. failureThreshold: {{ .Values.worker.readinessProbe.failureThreshold }}
  102. {{- end }}
  103. volumeMounts:
  104. - mountPath: {{ default "/tmp/dolphinscheduler" .Values.common.configmap.DATA_BASEDIR_PATH | quote }}
  105. name: {{ include "dolphinscheduler.fullname" . }}-worker-data
  106. - mountPath: "/opt/dolphinscheduler/logs"
  107. name: {{ include "dolphinscheduler.fullname" . }}-worker-logs
  108. - name: config-volume
  109. mountPath: /opt/dolphinscheduler/conf/common.properties
  110. subPath: common_properties
  111. {{- include "dolphinscheduler.sharedStorage.volumeMount" . | nindent 12 }}
  112. {{- include "dolphinscheduler.fsFileResource.volumeMount" . | nindent 12 }}
  113. volumes:
  114. - name: {{ include "dolphinscheduler.fullname" . }}-worker-data
  115. {{- if .Values.worker.persistentVolumeClaim.dataPersistentVolume.enabled }}
  116. persistentVolumeClaim:
  117. claimName: {{ include "dolphinscheduler.fullname" . }}-worker-data
  118. {{- else }}
  119. emptyDir: {}
  120. {{- end }}
  121. - name: {{ include "dolphinscheduler.fullname" . }}-worker-logs
  122. {{- if .Values.worker.persistentVolumeClaim.logsPersistentVolume.enabled }}
  123. persistentVolumeClaim:
  124. claimName: {{ include "dolphinscheduler.fullname" . }}-worker-logs
  125. {{- else }}
  126. emptyDir: {}
  127. {{- end }}
  128. - name: config-volume
  129. configMap:
  130. name: {{ include "dolphinscheduler.fullname" . }}-configs
  131. {{- include "dolphinscheduler.sharedStorage.volume" . | nindent 8 }}
  132. {{- include "dolphinscheduler.fsFileResource.volume" . | nindent 8 }}
  133. {{- if .Values.worker.persistentVolumeClaim.enabled }}
  134. volumeClaimTemplates:
  135. {{- if .Values.worker.persistentVolumeClaim.dataPersistentVolume.enabled }}
  136. - metadata:
  137. name: {{ include "dolphinscheduler.fullname" . }}-worker-data
  138. labels:
  139. app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-worker-data
  140. {{- include "dolphinscheduler.common.labels" . | nindent 10 }}
  141. spec:
  142. accessModes:
  143. {{- range .Values.worker.persistentVolumeClaim.dataPersistentVolume.accessModes }}
  144. - {{ . | quote }}
  145. {{- end }}
  146. storageClassName: {{ .Values.worker.persistentVolumeClaim.dataPersistentVolume.storageClassName | quote }}
  147. resources:
  148. requests:
  149. storage: {{ .Values.worker.persistentVolumeClaim.dataPersistentVolume.storage | quote }}
  150. {{- end }}
  151. {{- if .Values.worker.persistentVolumeClaim.logsPersistentVolume.enabled }}
  152. - metadata:
  153. name: {{ include "dolphinscheduler.fullname" . }}-worker-logs
  154. labels:
  155. app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-worker-logs
  156. {{- include "dolphinscheduler.common.labels" . | nindent 10 }}
  157. spec:
  158. accessModes:
  159. {{- range .Values.worker.persistentVolumeClaim.logsPersistentVolume.accessModes }}
  160. - {{ . | quote }}
  161. {{- end }}
  162. storageClassName: {{ .Values.worker.persistentVolumeClaim.logsPersistentVolume.storageClassName | quote }}
  163. resources:
  164. requests:
  165. storage: {{ .Values.worker.persistentVolumeClaim.logsPersistentVolume.storage | quote }}
  166. {{- end }}
  167. {{- end }}