Browse Source

[Improvement][K8s] Support resource storage when fs.defaultFS=file:/// (#4777)

pull/3/MERGE
Shiwen Cheng 4 years ago committed by GitHub
parent
commit
f166de1798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      docker/kubernetes/dolphinscheduler/templates/_helpers.tpl
  2. 2
      docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-common.yaml
  3. 9
      docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
  4. 37
      docker/kubernetes/dolphinscheduler/templates/pvc-dolphinscheduler-fs-file.yaml
  5. 11
      docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml
  6. 8
      docker/kubernetes/dolphinscheduler/values.yaml

9
docker/kubernetes/dolphinscheduler/templates/_helpers.tpl

@ -130,12 +130,3 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- $port := default "2181" (.Values.zookeeper.service.port | toString) -}} {{- $port := default "2181" (.Values.zookeeper.service.port | toString) -}}
{{- printf "%s:%s" (include "dolphinscheduler.zookeeper.fullname" .) $port | trunc 63 | trimSuffix "-" -}} {{- printf "%s:%s" (include "dolphinscheduler.zookeeper.fullname" .) $port | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/*
Create a default dolphinscheduler worker base dir.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "dolphinscheduler.data.basedir.path" -}}
{{- $name := default "/tmp/dolphinscheduler" .Values.common.configmap.DOLPHINSCHEDULER_DATA_BASEDIR_PATH -}}
{{- printf "%s" $name | trunc 63 | trimSuffix "/" -}}
{{- end -}}

2
docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-common.yaml

@ -28,7 +28,7 @@ data:
{{- range .Values.common.configmap.DOLPHINSCHEDULER_ENV }} {{- range .Values.common.configmap.DOLPHINSCHEDULER_ENV }}
{{ . }} {{ . }}
{{- end }} {{- end }}
DOLPHINSCHEDULER_DATA_BASEDIR_PATH: {{ include "dolphinscheduler.data.basedir.path" . | quote }} DOLPHINSCHEDULER_DATA_BASEDIR_PATH: {{ .Values.common.configmap.DOLPHINSCHEDULER_DATA_BASEDIR_PATH | quote }}
RESOURCE_STORAGE_TYPE: {{ .Values.common.configmap.RESOURCE_STORAGE_TYPE | quote }} RESOURCE_STORAGE_TYPE: {{ .Values.common.configmap.RESOURCE_STORAGE_TYPE | quote }}
RESOURCE_UPLOAD_PATH: {{ .Values.common.configmap.RESOURCE_UPLOAD_PATH | quote }} RESOURCE_UPLOAD_PATH: {{ .Values.common.configmap.RESOURCE_UPLOAD_PATH | quote }}
FS_DEFAULT_FS: {{ .Values.common.configmap.FS_DEFAULT_FS | quote }} FS_DEFAULT_FS: {{ .Values.common.configmap.FS_DEFAULT_FS | quote }}

9
docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml

@ -206,6 +206,10 @@ spec:
volumeMounts: volumeMounts:
- mountPath: "/opt/dolphinscheduler/logs" - mountPath: "/opt/dolphinscheduler/logs"
name: {{ include "dolphinscheduler.fullname" . }}-api name: {{ include "dolphinscheduler.fullname" . }}-api
{{- if .Values.common.fsFileResourcePersistence.enabled }}
- mountPath: {{ .Values.common.configmap.RESOURCE_UPLOAD_PATH | quote }}
name: {{ include "dolphinscheduler.fullname" . }}-fs-file
{{- end }}
volumes: volumes:
- name: {{ include "dolphinscheduler.fullname" . }}-api - name: {{ include "dolphinscheduler.fullname" . }}-api
{{- if .Values.api.persistentVolumeClaim.enabled }} {{- if .Values.api.persistentVolumeClaim.enabled }}
@ -214,3 +218,8 @@ spec:
{{- else }} {{- else }}
emptyDir: {} emptyDir: {}
{{- end }} {{- end }}
{{- if .Values.common.fsFileResourcePersistence.enabled }}
- name: {{ include "dolphinscheduler.fullname" . }}-fs-file
persistentVolumeClaim:
claimName: {{ include "dolphinscheduler.fullname" . }}-fs-file
{{- end }}

37
docker/kubernetes/dolphinscheduler/templates/pvc-dolphinscheduler-fs-file.yaml

@ -0,0 +1,37 @@
#
# 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 .Values.common.fsFileResourcePersistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "dolphinscheduler.fullname" . }}-fs-file
labels:
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-fs-file
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
annotations:
"helm.sh/resource-policy": keep
spec:
accessModes:
{{- range .Values.common.fsFileResourcePersistence.accessModes }}
- {{ . | quote }}
{{- end }}
storageClassName: {{ .Values.common.fsFileResourcePersistence.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.common.fsFileResourcePersistence.storage | quote }}
{{- end }}

11
docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml

@ -324,13 +324,17 @@ spec:
failureThreshold: {{ .Values.worker.readinessProbe.failureThreshold }} failureThreshold: {{ .Values.worker.readinessProbe.failureThreshold }}
{{- end }} {{- end }}
volumeMounts: volumeMounts:
- mountPath: {{ include "dolphinscheduler.data.basedir.path" . | quote }} - mountPath: {{ .Values.common.configmap.DOLPHINSCHEDULER_DATA_BASEDIR_PATH | quote }}
name: {{ include "dolphinscheduler.fullname" . }}-worker-data name: {{ include "dolphinscheduler.fullname" . }}-worker-data
- mountPath: "/opt/dolphinscheduler/logs" - mountPath: "/opt/dolphinscheduler/logs"
name: {{ include "dolphinscheduler.fullname" . }}-worker-logs name: {{ include "dolphinscheduler.fullname" . }}-worker-logs
- mountPath: "/opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh" - mountPath: "/opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh"
subPath: "dolphinscheduler_env.sh" subPath: "dolphinscheduler_env.sh"
name: {{ include "dolphinscheduler.fullname" . }}-common-env name: {{ include "dolphinscheduler.fullname" . }}-common-env
{{- if .Values.common.fsFileResourcePersistence.enabled }}
- mountPath: {{ .Values.common.configmap.RESOURCE_UPLOAD_PATH | quote }}
name: {{ include "dolphinscheduler.fullname" . }}-fs-file
{{- end }}
volumes: volumes:
- name: {{ include "dolphinscheduler.fullname" . }}-worker-data - name: {{ include "dolphinscheduler.fullname" . }}-worker-data
{{- if .Values.worker.persistentVolumeClaim.dataPersistentVolume.enabled }} {{- if .Values.worker.persistentVolumeClaim.dataPersistentVolume.enabled }}
@ -353,6 +357,11 @@ spec:
items: items:
- key: DOLPHINSCHEDULER_ENV - key: DOLPHINSCHEDULER_ENV
path: dolphinscheduler_env.sh path: dolphinscheduler_env.sh
{{- if .Values.common.fsFileResourcePersistence.enabled }}
- name: {{ include "dolphinscheduler.fullname" . }}-fs-file
persistentVolumeClaim:
claimName: {{ include "dolphinscheduler.fullname" . }}-fs-file
{{- end }}
{{- if .Values.worker.persistentVolumeClaim.enabled }} {{- if .Values.worker.persistentVolumeClaim.enabled }}
volumeClaimTemplates: volumeClaimTemplates:
{{- if .Values.worker.persistentVolumeClaim.dataPersistentVolume.enabled }} {{- if .Values.worker.persistentVolumeClaim.dataPersistentVolume.enabled }}

8
docker/kubernetes/dolphinscheduler/values.yaml

@ -94,6 +94,14 @@ common:
FS_S3A_ENDPOINT: "s3.xxx.amazonaws.com" FS_S3A_ENDPOINT: "s3.xxx.amazonaws.com"
FS_S3A_ACCESS_KEY: "xxxxxxx" FS_S3A_ACCESS_KEY: "xxxxxxx"
FS_S3A_SECRET_KEY: "xxxxxxx" FS_S3A_SECRET_KEY: "xxxxxxx"
## If RESOURCE_STORAGE_TYPE is HDFS and FS_DEFAULT_FS is file:///, fsFileResourcePersistence should be enabled for resource storage
fsFileResourcePersistence:
enabled: false
accessModes:
- "ReadWriteMany"
## storageClassName must support the access mode: ReadWriteMany
storageClassName: "-"
storage: "20Gi"
master: master:
## PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. ## PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down.

Loading…
Cancel
Save