Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm: expose optional workspace paths while deploying the cluster #533

Merged
merged 2 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions helm/reana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ This Helm automatically prefixes all names using the release name to avoid colli
| `quota.disk_update` | Cronjob pattern representing how often the users disk quota usage should be updated. Leave it empty to deactivate it | "0 3 * * *" |
| `quota.default_disk_limit` | Default users disk quota limit in bytes. | None |
| `quota.default_cpu_limit` | Default users CPU quota limit in milliseconds. | None |
| `workspaces.paths` | List of additional workspace paths, e.g `{cluster_node_path_1, cluster_node_path_2}`. The first one listed different from `/var/reana` will be the default workspace root path. Any POSIX filesystem mounted on cluster nodes is supported | None |
27 changes: 17 additions & 10 deletions helm/reana/templates/reana-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ spec:
{{- end }}
- mountPath: {{ .Values.shared_storage.shared_volume_mount_path }}
name: reana-shared-volume
{{- if .Values.components.reana_workflow_controller.environment.REANA_WORKSPACE_HOSTPATH_MOUNTS }}
{{- range $workspace_paths := split "," .Values.components.reana_workflow_controller.environment.REANA_WORKSPACE_HOSTPATH_MOUNTS }}
{{- $workspace_path := split ":" $workspace_paths }}
- name: {{ $workspace_path._0 | quote | replace "/" "" }}
mountPath: {{ $workspace_path._1 }}
{{- range $workspace_paths := .Values.workspaces.paths }}
{{- if not (eq $workspace_paths "/var/reana")}}
- name: {{ $workspace_paths | quote |replace "/" "" }}
mountPath: {{ $workspace_paths }}
mountPropagation: HostToContainer
{{- end }}
{{- end }}
Expand All @@ -78,6 +77,15 @@ spec:
value: {{ .Values.quota.default_disk_limit | default 0 | quote }}
- name: REANA_KUBERNETES_JOBS_MEMORY_LIMIT
value: {{ .Values.kubernetes_jobs_memory_limit | default "4Gi" }}
- name: WORKSPACE_PATHS
value: {{ join "," .Values.workspaces.paths }}
{{- if not (eq (index .Values.workspaces.paths 0) "/var/reana")}}
- name: DEFAULT_WORKSPACE_PATH
value: {{ index .Values.workspaces.paths 0 }}
{{- else if ( gt (len .Values.workspaces.paths) 1)}}
- name: DEFAULT_WORKSPACE_PATH
value: {{ index .Values.workspaces.paths 1 }}
{{- end }}
{{- range $key, $value := .Values.db_env_config }}
- name: {{ $key }}
value: {{ $value | quote }}
Expand Down Expand Up @@ -254,11 +262,10 @@ spec:
nodeSelector:
{{ $full_label._0 }}: {{ $full_label._1 }}
{{- end }}
{{- if .Values.components.reana_workflow_controller.environment.REANA_WORKSPACE_HOSTPATH_MOUNTS }}
{{- range $workspace_paths := split "," .Values.components.reana_workflow_controller.environment.REANA_WORKSPACE_HOSTPATH_MOUNTS }}
{{- $workspace_path := split ":" $workspace_paths }}
- name: {{ $workspace_path._0 | quote | replace "/" "" }}
{{- range $workspace_paths := .Values.workspaces.paths }}
{{- if not (eq $workspace_paths "/var/reana")}}
- name: {{ $workspace_paths | quote |replace "/" "" }}
hostPath:
path: {{ $workspace_path._0 }}
path: {{ $workspace_paths }}
{{- end }}
{{- end }}
29 changes: 19 additions & 10 deletions helm/reana/templates/reana-workflow-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ spec:
{{- end }}
- mountPath: {{ .Values.shared_storage.shared_volume_mount_path }}
name: reana-shared-volume
{{- if .Values.components.reana_workflow_controller.environment.REANA_WORKSPACE_HOSTPATH_MOUNTS }}
{{- range $workspace_paths := split "," .Values.components.reana_workflow_controller.environment.REANA_WORKSPACE_HOSTPATH_MOUNTS }}
{{- $workspace_path := split ":" $workspace_paths }}
- name: {{ $workspace_path._0 | quote | replace "/" "" }}
mountPath: {{ $workspace_path._1 }}
{{- range $workspace_paths := .Values.workspaces.paths }}
{{- if not (eq $workspace_paths "/var/reana")}}
- name: {{ $workspace_paths | quote |replace "/" "" }}
mountPath: {{ $workspace_paths }}
mountPropagation: HostToContainer
{{- end }}
{{- end }}
Expand All @@ -69,6 +68,10 @@ spec:
value: {{ .Values.quota.default_cpu_limit | default 0 | quote }}
- name: REANA_DEFAULT_QUOTA_DISK_LIMIT
value: {{ .Values.quota.default_disk_limit | default 0 | quote }}
{{- if .Values.workspaces }}{{ if .Values.workspaces.paths }}
- name: DEFAULT_WORKSPACE_PATH
value: {{ index .Values.workspaces.paths 0 }}
{{- end }}{{ end }}
{{- if .Values.naming_scheme }}
- name: REANA_COMPONENT_NAMING_SCHEME
value: {{ .Values.naming_scheme }}
Expand Down Expand Up @@ -179,6 +182,13 @@ spec:
value: {{ .Release.Namespace }}
- name: REANA_RUNTIME_KUBERNETES_NAMESPACE
value: {{ .Values.namespace_runtime | default .Release.Namespace }}
{{- if not (eq (index .Values.workspaces.paths 0) "/var/reana")}}
- name: DEFAULT_WORKSPACE_PATH
value: {{ index .Values.workspaces.paths 0 }}
{{- else if ( gt (len .Values.workspaces.paths) 1)}}
- name: DEFAULT_WORKSPACE_PATH
value: {{ index .Values.workspaces.paths 1 }}
{{- end }}
{{- range $key, $value := .Values.db_env_config }}
- name: {{ $key }}
value: {{ $value | quote }}
Expand Down Expand Up @@ -240,11 +250,10 @@ spec:
nodeSelector:
{{ $full_label._0 }}: {{ $full_label._1 }}
{{- end }}
{{- if .Values.components.reana_workflow_controller.environment.REANA_WORKSPACE_HOSTPATH_MOUNTS }}
{{- range $workspace_paths := split "," .Values.components.reana_workflow_controller.environment.REANA_WORKSPACE_HOSTPATH_MOUNTS }}
{{- $workspace_path := split ":" $workspace_paths }}
- name: {{ $workspace_path._0 | quote | replace "/" "" }}
{{- range $workspace_paths := .Values.workspaces.paths }}
{{- if not (eq $workspace_paths "/var/reana")}}
- name: {{ $workspace_paths | quote |replace "/" "" }}
hostPath:
path: {{ $workspace_path._0 }}
path: {{ $workspace_paths }}
{{- end }}
{{- end }}
4 changes: 4 additions & 0 deletions helm/reana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ debug:
eos:
enabled: false

workspaces:
paths:
- "/var/reana"

shared_storage:
backend: hostpath # hostpath | cephfs | nfs
volume_size: 200
Expand Down
16 changes: 0 additions & 16 deletions reana/reana_dev/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,6 @@ def cluster_build(
help="Which directories from the Kubernetes nodes to mount inside the job pods? "
"cluster_node_path:job_pod_mountpath, e.g /var/reana/mydata:/mydata",
)
@click.option(
"-w",
"--workspace-mounts",
multiple=True,
help="Which directories from the Kubernetes nodes to mount inside the cluster pods? "
"cluster_node_path:job_pod_mountpath, e.g /var/reana/mydata:/mydata",
)
@click.option(
"--mode",
default="latest",
Expand Down Expand Up @@ -267,7 +260,6 @@ def cluster_build(
def cluster_deploy(
namespace,
job_mounts,
workspace_mounts,
mode,
values,
exclude_components,
Expand Down Expand Up @@ -317,14 +309,6 @@ def job_mounts_to_config(job_mounts):
"reana_workflow_controller", {}
).setdefault("environment", {})["REANA_JOB_HOSTPATH_MOUNTS"] = job_mount_config

if workspace_mounts:
workspace_mounts = ",".join(workspace_mounts)
values_dict.setdefault("components", {}).setdefault(
"reana_workflow_controller", {}
).setdefault("environment", {})[
"REANA_WORKSPACE_HOSTPATH_MOUNTS"
] = workspace_mounts

if mode in ("debug"):
values_dict.setdefault("debug", {})["enabled"] = True

Expand Down