You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by li...@apache.org on 2021/02/21 14:45:03 UTC

[incubator-dolphinscheduler] branch dev updated: [Improvement][K8s] Support resource storage when fs.defaultFS=file:/// (#4777)

This is an automated email from the ASF dual-hosted git repository.

lidongdai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new f166de1  [Improvement][K8s] Support resource storage when fs.defaultFS=file:/// (#4777)
f166de1 is described below

commit f166de1798fb593cb395d59dcbd207f47cd12473
Author: Shiwen Cheng <ch...@gmail.com>
AuthorDate: Sun Feb 21 22:44:55 2021 +0800

    [Improvement][K8s] Support resource storage when fs.defaultFS=file:/// (#4777)
---
 .../dolphinscheduler/templates/_helpers.tpl        |  9 -------
 .../configmap-dolphinscheduler-common.yaml         |  2 +-
 .../templates/deployment-dolphinscheduler-api.yaml | 11 ++++++++-
 ...mmon.yaml => pvc-dolphinscheduler-fs-file.yaml} | 28 +++++++++++-----------
 .../statefulset-dolphinscheduler-master.yaml       |  2 +-
 .../statefulset-dolphinscheduler-worker.yaml       | 13 ++++++++--
 docker/kubernetes/dolphinscheduler/values.yaml     |  8 +++++++
 7 files changed, 45 insertions(+), 28 deletions(-)

diff --git a/docker/kubernetes/dolphinscheduler/templates/_helpers.tpl b/docker/kubernetes/dolphinscheduler/templates/_helpers.tpl
index ccfc746..542bcb2 100644
--- a/docker/kubernetes/dolphinscheduler/templates/_helpers.tpl
+++ b/docker/kubernetes/dolphinscheduler/templates/_helpers.tpl
@@ -129,13 +129,4 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
 {{- define "dolphinscheduler.zookeeper.quorum" -}}
 {{- $port := default "2181" (.Values.zookeeper.service.port | toString) -}}
 {{- printf "%s:%s" (include "dolphinscheduler.zookeeper.fullname" .) $port | trunc 63 | trimSuffix "-" -}}
-{{- 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 -}}
\ No newline at end of file
diff --git a/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-common.yaml b/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-common.yaml
index 1fcb5b5..f350055 100644
--- a/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-common.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-common.yaml
@@ -28,7 +28,7 @@ data:
   {{- range .Values.common.configmap.DOLPHINSCHEDULER_ENV }}
     {{ . }}
   {{- 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_UPLOAD_PATH: {{ .Values.common.configmap.RESOURCE_UPLOAD_PATH | quote }}
   FS_DEFAULT_FS: {{ .Values.common.configmap.FS_DEFAULT_FS | quote }}
diff --git a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
index 563f9eb..f4b4795 100644
--- a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
@@ -206,6 +206,10 @@ spec:
           volumeMounts:
             - mountPath: "/opt/dolphinscheduler/logs"
               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:
         - name: {{ include "dolphinscheduler.fullname" . }}-api
           {{- if .Values.api.persistentVolumeClaim.enabled }}
@@ -213,4 +217,9 @@ spec:
             claimName: {{ include "dolphinscheduler.fullname" . }}-api
           {{- else }}
           emptyDir: {}
-          {{- end }}
\ No newline at end of file
+          {{- end }}
+        {{- if .Values.common.fsFileResourcePersistence.enabled }}
+        - name: {{ include "dolphinscheduler.fullname" . }}-fs-file
+          persistentVolumeClaim:
+            claimName: {{ include "dolphinscheduler.fullname" . }}-fs-file
+        {{- end }}
\ No newline at end of file
diff --git a/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-common.yaml b/docker/kubernetes/dolphinscheduler/templates/pvc-dolphinscheduler-fs-file.yaml
similarity index 57%
copy from docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-common.yaml
copy to docker/kubernetes/dolphinscheduler/templates/pvc-dolphinscheduler-fs-file.yaml
index 1fcb5b5..1e277eb 100644
--- a/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-common.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/pvc-dolphinscheduler-fs-file.yaml
@@ -14,24 +14,24 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-{{- if .Values.common.configmap }}
+{{- if .Values.common.fsFileResourcePersistence.enabled }}
 apiVersion: v1
-kind: ConfigMap
+kind: PersistentVolumeClaim
 metadata:
-  name: {{ include "dolphinscheduler.fullname" . }}-common
+  name: {{ include "dolphinscheduler.fullname" . }}-fs-file
   labels:
-    app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-common
+    app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-fs-file
     app.kubernetes.io/instance: {{ .Release.Name }}
     app.kubernetes.io/managed-by: {{ .Release.Service }}
-data:
-  DOLPHINSCHEDULER_ENV: |-
-  {{- range .Values.common.configmap.DOLPHINSCHEDULER_ENV }}
-    {{ . }}
+  annotations:
+    "helm.sh/resource-policy": keep
+spec:
+  accessModes:
+  {{- range .Values.common.fsFileResourcePersistence.accessModes }}
+    - {{ . | quote }}
   {{- end }}
-  DOLPHINSCHEDULER_DATA_BASEDIR_PATH: {{ include "dolphinscheduler.data.basedir.path" . | quote }}
-  RESOURCE_STORAGE_TYPE: {{ .Values.common.configmap.RESOURCE_STORAGE_TYPE | quote }}
-  RESOURCE_UPLOAD_PATH: {{ .Values.common.configmap.RESOURCE_UPLOAD_PATH | quote }}
-  FS_DEFAULT_FS: {{ .Values.common.configmap.FS_DEFAULT_FS | quote }}
-  FS_S3A_ENDPOINT: {{ .Values.common.configmap.FS_S3A_ENDPOINT | quote }}
-  FS_S3A_ACCESS_KEY: {{ .Values.common.configmap.FS_S3A_ACCESS_KEY | quote }}
+  storageClassName: {{ .Values.common.fsFileResourcePersistence.storageClassName | quote }}
+  resources:
+    requests:
+      storage: {{ .Values.common.fsFileResourcePersistence.storage | quote }}
 {{- end }}
\ No newline at end of file
diff --git a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml
index 85633a9..55d13d7 100644
--- a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml
@@ -247,4 +247,4 @@ spec:
         resources:
           requests:
             storage: {{ .Values.master.persistentVolumeClaim.storage | quote }}
-  {{- end }}
+  {{- end }}
\ No newline at end of file
diff --git a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml
index b8a62fa..76527b7 100644
--- a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml
@@ -324,13 +324,17 @@ spec:
             failureThreshold: {{ .Values.worker.readinessProbe.failureThreshold }}
           {{- end }}
           volumeMounts:
-            - mountPath: {{ include "dolphinscheduler.data.basedir.path" . | quote }}
+            - mountPath: {{ .Values.common.configmap.DOLPHINSCHEDULER_DATA_BASEDIR_PATH | quote }}
               name: {{ include "dolphinscheduler.fullname" . }}-worker-data
             - mountPath: "/opt/dolphinscheduler/logs"
               name: {{ include "dolphinscheduler.fullname" . }}-worker-logs
             - mountPath: "/opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh"
               subPath: "dolphinscheduler_env.sh"
               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:
         - name: {{ include "dolphinscheduler.fullname" . }}-worker-data
           {{- if .Values.worker.persistentVolumeClaim.dataPersistentVolume.enabled }}
@@ -353,6 +357,11 @@ spec:
             items:
               - key: DOLPHINSCHEDULER_ENV
                 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 }}
   volumeClaimTemplates:
     {{- if .Values.worker.persistentVolumeClaim.dataPersistentVolume.enabled }}
@@ -389,4 +398,4 @@ spec:
           requests:
             storage: {{ .Values.worker.persistentVolumeClaim.logsPersistentVolume.storage | quote }}
     {{- end }}
-  {{- end }}
+  {{- end }}
\ No newline at end of file
diff --git a/docker/kubernetes/dolphinscheduler/values.yaml b/docker/kubernetes/dolphinscheduler/values.yaml
index 61201df..b99b553 100644
--- a/docker/kubernetes/dolphinscheduler/values.yaml
+++ b/docker/kubernetes/dolphinscheduler/values.yaml
@@ -94,6 +94,14 @@ common:
     FS_S3A_ENDPOINT: "s3.xxx.amazonaws.com"
     FS_S3A_ACCESS_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:
   ## PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down.