From c8967db200e3922c954db27ae1c2fceff54cb8d4 Mon Sep 17 00:00:00 2001 From: Diego Rodriguez Date: Wed, 24 Jun 2020 14:22:16 +0200 Subject: [PATCH] config: central optional hostpath mounts for jobs --- reana_commons/config.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/reana_commons/config.py b/reana_commons/config.py index 17f1f698..d173b89a 100644 --- a/reana_commons/config.py +++ b/reana_commons/config.py @@ -8,6 +8,7 @@ """REANA Commons configuration.""" +import json import logging import os @@ -224,6 +225,35 @@ ) """Name of the shared CEPHFS PVC which will be used by all REANA jobs.""" +REANA_JOB_HOSTPATH_MOUNTS = json.loads(os.getenv("REANA_JOB_HOSTPATH_MOUNTS", "[]")) +"""List of dictionaries composed of name, hostPath and mountPath. + +- ``name``: name of the mount. +- ``hostPath``: path in the Kubernetes cluster host nodes that will be mounted into job pods. +- ``mountPath``: path inside job pods where hostPath will get mounted. + This is optional, by default the same path as the hostPath will be used + +This configuration should be used only when one knows for sure that the +specified locations exist in all the cluster nodes. For example, in Minikube: + +.. code-block:: + + $ minikube mount $HOME/mydata:/usr/local/share/mydata + +And pass the following configuration: + +.. code-block:: + + REANA_JOB_HOSTPATH_MOUNTS = [ + {"name": "mydata", + "hostPath": "/usr/local/share/mydata", + "mountPath": "/mydata"}, + ] + +This way all jobs will have ``/mydata`` mounted with the content of +``/usr/local/share/mydata`` in the Minikube Kubernetes node. +""" + REANA_WORKFLOW_UMASK = 0o0002 """Umask used for workflow worksapce."""