# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # {{- if and .Values.api.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "dolphinscheduler.fullname" . }}-api labels: {{- include "dolphinscheduler.api.labels" . | nindent 4 }} spec: replicas: {{ .Values.api.replicas }} selector: matchLabels: {{- include "dolphinscheduler.api.labels" . | nindent 6 }} strategy: type: {{ .Values.api.strategy.type | quote }} rollingUpdate: maxSurge: {{ .Values.api.strategy.rollingUpdate.maxSurge | quote }} maxUnavailable: {{ .Values.api.strategy.rollingUpdate.maxUnavailable | quote }} template: metadata: labels: {{- include "dolphinscheduler.api.labels" . | nindent 8 }} {{- if or .Values.api.annotations .Values.conf.auto }} annotations: {{- if .Values.conf.auto }} checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} {{- end }} {{- if .Values.api.annotations }} {{- toYaml .Values.api.annotations | nindent 8 }} {{- end }} {{- end }} spec: serviceAccountName: {{ template "dolphinscheduler.fullname" . }} {{- if .Values.api.affinity }} affinity: {{- toYaml .Values.api.affinity | nindent 8 }} {{- end }} {{- if .Values.api.nodeSelector }} nodeSelector: {{- toYaml .Values.api.nodeSelector | nindent 8 }} {{- end }} {{- if .Values.api.tolerations }} tolerations: {{- toYaml .Values.api.tolerations | nindent 8 }} {{- end }} {{- if .Values.image.pullSecret }} imagePullSecrets: - name: {{ .Values.image.pullSecret }} {{- end }} containers: - name: {{ include "dolphinscheduler.fullname" . }}-api image: {{ include "dolphinscheduler.image.fullname.api" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - containerPort: 12345 name: "api-port" - containerPort: 25333 name: "python-api-port" env: - name: TZ value: {{ .Values.timezone }} - name: SPRING_JACKSON_TIME_ZONE value: {{ .Values.timezone }} {{- include "dolphinscheduler.database.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.registry.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.security.env_vars" . | nindent 12 }} {{ range $key, $value := .Values.api.env }} - name: {{ $key }} value: {{ $value | quote }} {{ end }} envFrom: - configMapRef: name: {{ include "dolphinscheduler.fullname" . }}-common {{- if .Values.api.resources }} resources: {{- toYaml .Values.api.resources | nindent 12 }} {{- end }} {{- if .Values.api.livenessProbe.enabled }} livenessProbe: exec: command: ["curl", "-s", "http://localhost:12345/dolphinscheduler/actuator/health/liveness"] initialDelaySeconds: {{ .Values.api.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.api.livenessProbe.periodSeconds }} timeoutSeconds: {{ .Values.api.livenessProbe.timeoutSeconds }} successThreshold: {{ .Values.api.livenessProbe.successThreshold }} failureThreshold: {{ .Values.api.livenessProbe.failureThreshold }} {{- end }} {{- if .Values.api.readinessProbe.enabled }} readinessProbe: exec: command: ["curl", "-s", "http://localhost:12345/dolphinscheduler/actuator/health/readiness"] initialDelaySeconds: {{ .Values.api.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.api.readinessProbe.periodSeconds }} timeoutSeconds: {{ .Values.api.readinessProbe.timeoutSeconds }} successThreshold: {{ .Values.api.readinessProbe.successThreshold }} failureThreshold: {{ .Values.api.readinessProbe.failureThreshold }} {{- end }} volumeMounts: - mountPath: "/opt/dolphinscheduler/logs" name: {{ include "dolphinscheduler.fullname" . }}-api - name: config-volume mountPath: /opt/dolphinscheduler/conf/common.properties subPath: common.properties {{- if .Values.api.taskTypeFilter.enabled }} - name: config-volume mountPath: /opt/dolphinscheduler/conf/task-type-config.yaml subPath: task-type-config.yaml {{- end }} {{- include "dolphinscheduler.sharedStorage.volumeMount" . | nindent 12 }} {{- include "dolphinscheduler.fsFileResource.volumeMount" . | nindent 12 }} {{- include "dolphinscheduler.ldap.ssl.volumeMount" . | nindent 12 }} {{- include "dolphinscheduler.etcd.ssl.volumeMount" . | nindent 12 }} volumes: - name: {{ include "dolphinscheduler.fullname" . }}-api {{- if .Values.api.persistentVolumeClaim.enabled }} persistentVolumeClaim: claimName: {{ include "dolphinscheduler.fullname" . }}-api {{- else }} emptyDir: {} {{- end }} - name: config-volume configMap: name: {{ include "dolphinscheduler.fullname" . }}-configs {{- include "dolphinscheduler.sharedStorage.volume" . | nindent 8 }} {{- include "dolphinscheduler.fsFileResource.volume" . | nindent 8 }} {{- include "dolphinscheduler.ldap.ssl.volume" . | nindent 8 }} {{- include "dolphinscheduler.etcd.ssl.volume" . | nindent 8 }} {{- end }}