|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: StatefulSet
|
|
|
|
metadata:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
|
|
app.kubernetes.io/component: master
|
|
|
|
spec:
|
|
|
|
podManagementPolicy: {{ .Values.master.podManagementPolicy }}
|
|
|
|
replicas: {{ .Values.master.replicas }}
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
|
|
app.kubernetes.io/component: master
|
|
|
|
serviceName: {{ template "dolphinscheduler.fullname" . }}-master-headless
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
|
|
app.kubernetes.io/component: master
|
|
|
|
{{- if .Values.alert.annotations }}
|
|
|
|
annotations:
|
|
|
|
{{- toYaml .Values.alert.annotations | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
spec:
|
|
|
|
{{- if .Values.master.affinity }}
|
|
|
|
affinity: {{- toYaml .Values.master.affinity | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.master.nodeSelector }}
|
|
|
|
nodeSelector: {{- toYaml .Values.master.nodeSelector | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.master.tolerations }}
|
|
|
|
tolerations: {{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
initContainers:
|
|
|
|
- name: init-zookeeper
|
|
|
|
image: busybox:1.31.0
|
|
|
|
command:
|
|
|
|
- /bin/sh
|
|
|
|
- -ec
|
|
|
|
- |
|
|
|
|
echo "${ZOOKEEPER_QUORUM}" | awk -F ',' 'BEGIN{ i=1 }{ while( i <= NF ){ print $i; i++ } }' | while read line; do
|
|
|
|
while ! nc -z ${line%:*} ${line#*:}; do
|
|
|
|
counter=$((counter+1))
|
|
|
|
if [ $counter == 5 ]; then
|
|
|
|
echo "Error: Couldn't connect to zookeeper."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "Trying to connect to zookeeper at ${line}. Attempt $counter."
|
|
|
|
sleep 60
|
|
|
|
done
|
|
|
|
done
|
|
|
|
env:
|
|
|
|
- name: ZOOKEEPER_QUORUM
|
|
|
|
{{- if .Values.zookeeper.enabled }}
|
|
|
|
value: "{{ template "dolphinscheduler.zookeeper.quorum" . }}"
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalZookeeper.zookeeperQuorum }}
|
|
|
|
{{- end }}
|
|
|
|
- name: init-database
|
|
|
|
image: busybox:1.31.0
|
|
|
|
command:
|
|
|
|
- /bin/sh
|
|
|
|
- -ec
|
|
|
|
- |
|
|
|
|
while ! nc -z ${DATABASE_HOST} ${DATABASE_PORT}; do
|
|
|
|
counter=$((counter+1))
|
|
|
|
if [ $counter == 5 ]; then
|
|
|
|
echo "Error: Couldn't connect to database."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "Trying to connect to database at ${DATABASE_HOST}:${DATABASE_PORT}. Attempt $counter."
|
|
|
|
sleep 60
|
|
|
|
done
|
|
|
|
env:
|
|
|
|
- name: DATABASE_HOST
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
value: {{ template "dolphinscheduler.postgresql.fullname" . }}
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalDatabase.host | quote }}
|
|
|
|
{{- end }}
|
|
|
|
- name: DATABASE_PORT
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
value: "5432"
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalDatabase.port | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.image.pullSecrets }}
|
|
|
|
imagePullSecrets:
|
|
|
|
- name: {{ include "dolphinscheduler.image.pullSecrets" . }}
|
|
|
|
{{- end }}
|
|
|
|
containers:
|
|
|
|
- name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
image: {{ include "dolphinscheduler.image.repository" . | quote }}
|
|
|
|
args:
|
|
|
|
- "master-server"
|
|
|
|
ports:
|
|
|
|
- containerPort: {{ .Values.master.configmap.MASTER_LISTEN_PORT }}
|
|
|
|
name: "master-port"
|
|
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
|
|
env:
|
|
|
|
- name: DOLPHINSCHEDULER_OPTS
|
|
|
|
value: {{ default "" .Values.master.jvmOptions }}
|
|
|
|
- name: TZ
|
|
|
|
value: {{ .Values.timezone }}
|
|
|
|
- name: MASTER_EXEC_THREADS
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
key: MASTER_EXEC_THREADS
|
|
|
|
- name: MASTER_EXEC_TASK_NUM
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
key: MASTER_EXEC_TASK_NUM
|
|
|
|
- name: MASTER_HEARTBEAT_INTERVAL
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
key: MASTER_HEARTBEAT_INTERVAL
|
|
|
|
- name: MASTER_TASK_COMMIT_RETRYTIMES
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
key: MASTER_TASK_COMMIT_RETRYTIMES
|
|
|
|
- name: MASTER_TASK_COMMIT_INTERVAL
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
key: MASTER_TASK_COMMIT_INTERVAL
|
|
|
|
- name: MASTER_MAX_CPULOAD_AVG
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
key: MASTER_MAX_CPULOAD_AVG
|
|
|
|
- name: MASTER_RESERVED_MEMORY
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
key: MASTER_RESERVED_MEMORY
|
|
|
|
- name: MASTER_LISTEN_PORT
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
key: MASTER_LISTEN_PORT
|
|
|
|
- name: DOLPHINSCHEDULER_DATA_BASEDIR_PATH
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
key: DOLPHINSCHEDULER_DATA_BASEDIR_PATH
|
|
|
|
- name: DATABASE_TYPE
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
value: "postgresql"
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalDatabase.type | quote }}
|
|
|
|
{{- end }}
|
|
|
|
- name: DATABASE_DRIVER
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
value: "org.postgresql.Driver"
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalDatabase.driver | quote }}
|
|
|
|
{{- end }}
|
|
|
|
- name: DATABASE_HOST
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
value: {{ template "dolphinscheduler.postgresql.fullname" . }}
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalDatabase.host | quote }}
|
|
|
|
{{- end }}
|
|
|
|
- name: DATABASE_PORT
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
value: "5432"
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalDatabase.port | quote }}
|
|
|
|
{{- end }}
|
|
|
|
- name: DATABASE_USERNAME
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
value: {{ .Values.postgresql.postgresqlUsername }}
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalDatabase.username | quote }}
|
|
|
|
{{- end }}
|
|
|
|
- name: DATABASE_PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
name: {{ template "dolphinscheduler.postgresql.fullname" . }}
|
|
|
|
key: postgresql-password
|
|
|
|
{{- else }}
|
|
|
|
name: {{ printf "%s-%s" .Release.Name "externaldb" }}
|
|
|
|
key: db-password
|
|
|
|
{{- end }}
|
|
|
|
- name: DATABASE_DATABASE
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
value: {{ .Values.postgresql.postgresqlDatabase }}
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalDatabase.database | quote }}
|
|
|
|
{{- end }}
|
|
|
|
- name: DATABASE_PARAMS
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
value: "characterEncoding=utf8"
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalDatabase.params | quote }}
|
|
|
|
{{- end }}
|
|
|
|
- name: ZOOKEEPER_QUORUM
|
|
|
|
{{- if .Values.zookeeper.enabled }}
|
|
|
|
value: {{ template "dolphinscheduler.zookeeper.quorum" . }}
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.externalZookeeper.zookeeperQuorum }}
|
|
|
|
{{- end }}
|
|
|
|
- name: RESOURCE_STORAGE_TYPE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: RESOURCE_STORAGE_TYPE
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-common
|
|
|
|
- name: RESOURCE_UPLOAD_PATH
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: RESOURCE_UPLOAD_PATH
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-common
|
|
|
|
- name: FS_DEFAULT_FS
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: FS_DEFAULT_FS
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-common
|
|
|
|
- name: FS_S3A_ENDPOINT
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: FS_S3A_ENDPOINT
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-common
|
|
|
|
- name: FS_S3A_ACCESS_KEY
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: FS_S3A_ACCESS_KEY
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-common
|
|
|
|
- name: FS_S3A_SECRET_KEY
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: FS_S3A_SECRET_KEY
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-common
|
|
|
|
{{- if .Values.master.resources }}
|
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
memory: {{ .Values.master.resources.limits.memory | quote }}
|
|
|
|
cpu: {{ .Values.master.resources.limits.cpu | quote }}
|
|
|
|
requests:
|
|
|
|
memory: {{ .Values.master.resources.requests.memory | quote }}
|
|
|
|
cpu: {{ .Values.master.resources.requests.cpu | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.master.livenessProbe.enabled }}
|
|
|
|
livenessProbe:
|
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- sh
|
|
|
|
- /root/checkpoint.sh
|
|
|
|
- MasterServer
|
|
|
|
initialDelaySeconds: {{ .Values.master.livenessProbe.initialDelaySeconds }}
|
|
|
|
periodSeconds: {{ .Values.master.livenessProbe.periodSeconds }}
|
|
|
|
timeoutSeconds: {{ .Values.master.livenessProbe.timeoutSeconds }}
|
|
|
|
successThreshold: {{ .Values.master.livenessProbe.successThreshold }}
|
|
|
|
failureThreshold: {{ .Values.master.livenessProbe.failureThreshold }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.master.readinessProbe.enabled }}
|
|
|
|
readinessProbe:
|
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- sh
|
|
|
|
- /root/checkpoint.sh
|
|
|
|
- MasterServer
|
|
|
|
initialDelaySeconds: {{ .Values.master.readinessProbe.initialDelaySeconds }}
|
|
|
|
periodSeconds: {{ .Values.master.readinessProbe.periodSeconds }}
|
|
|
|
timeoutSeconds: {{ .Values.master.readinessProbe.timeoutSeconds }}
|
|
|
|
successThreshold: {{ .Values.master.readinessProbe.successThreshold }}
|
|
|
|
failureThreshold: {{ .Values.master.readinessProbe.failureThreshold }}
|
|
|
|
{{- end }}
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: "/opt/dolphinscheduler/logs"
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
volumes:
|
|
|
|
- name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
{{- if .Values.master.persistentVolumeClaim.enabled }}
|
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
{{- else }}
|
|
|
|
emptyDir: {}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.master.persistentVolumeClaim.enabled }}
|
|
|
|
volumeClaimTemplates:
|
|
|
|
- metadata:
|
|
|
|
name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-master
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
|
|
spec:
|
|
|
|
accessModes:
|
|
|
|
{{- range .Values.master.persistentVolumeClaim.accessModes }}
|
|
|
|
- {{ . | quote }}
|
|
|
|
{{- end }}
|
|
|
|
storageClassName: {{ .Values.master.persistentVolumeClaim.storageClassName | quote }}
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: {{ .Values.master.persistentVolumeClaim.storage | quote }}
|
|
|
|
{{- end }}
|