From c0d2e926381baa06bb037451dd4932acd5e771fa Mon Sep 17 00:00:00 2001 From: Alputer Date: Sun, 11 Aug 2024 23:16:18 +0200 Subject: [PATCH] feat(helm): add initial Dask support (#821) --- helm/reana/Chart.yaml | 6 ++++++ helm/reana/README.md | 5 +++++ helm/reana/templates/reana-server.yaml | 12 ++++++++++++ helm/reana/templates/reana-workflow-controller.yaml | 12 ++++++++++++ helm/reana/templates/roles.yaml | 12 ++++++++++++ helm/reana/values.yaml | 7 +++++++ 6 files changed, 54 insertions(+) diff --git a/helm/reana/Chart.yaml b/helm/reana/Chart.yaml index 6253e1e0..605888ed 100644 --- a/helm/reana/Chart.yaml +++ b/helm/reana/Chart.yaml @@ -43,3 +43,9 @@ dependencies: version: 0.47.7 repository: https://fluent.github.io/helm-charts condition: fluent-bit.enabled + - name: dask-kubernetes-operator + version: 2024.8.0 + repository: https://helm.dask.org + condition: dask.enabled + tags: + - dask diff --git a/helm/reana/README.md b/helm/reana/README.md index d07e33f0..8e2073b1 100644 --- a/helm/reana/README.md +++ b/helm/reana/README.md @@ -68,6 +68,11 @@ This Helm automatically prefixes all names using the release name to avoid colli | `components.reana_workflow_engine_snakemake.environment` | [REANA-Workflow-Engine-Snakemake](https://github.com/reanahub/reana-workflow-engine-snakemake) environment variables | `{}` | | `components.reana_workflow_engine_snakemake.image` | [REANA-Workflow-Engine-Snakemake image](https://hub.docker.com/r/reanahub/reana-workflow-engine-snakemake) to use | `docker.io/reanahub/reana-workflow-engine-snakemake:` | | `compute_backends` | List of supported compute backends (kubernetes, htcondorcern, slurmcern) | "kubernetes" | +| `dask.enabled` | Enable support for running Dask workflows | false | +| `dask.cluster_max_memory_limit` | The maximum memory limit for Dask clusters created by users | "16Gi" | +| `dask.cluster_default_number_of_workers` | The number of Dask workers created by default | 2 | +| `dask.cluster_default_single_worker_memory` | The amount of memory used by default by a single Dask worker | "2Gi" | +| `dask.cluster_max_single_worker_memory` | The maximum amount of memory that users can ask for the single Dask worker | "8Gi" | | `db_env_config.REANA_DB_HOST` | Environment variable to connect to external databases | `-db` | | `db_env_config.REANA_DB_NAME` | Environment variable to connect to external databases | reana | | `db_env_config.REANA_DB_PORT` | Environment variable to connect to external databases | "5432" | diff --git a/helm/reana/templates/reana-server.yaml b/helm/reana/templates/reana-server.yaml index df723d26..eea36da4 100644 --- a/helm/reana/templates/reana-server.yaml +++ b/helm/reana/templates/reana-server.yaml @@ -98,6 +98,18 @@ spec: value: !!str {{ .Values.kubernetes_jobs_timeout_limit | default 604800 }} # 604800 seconds = 7 days - name: REANA_KUBERNETES_JOBS_MEMORY_LIMIT value: {{ .Values.kubernetes_jobs_memory_limit | default "4Gi" }} + - name: DASK_ENABLED + value: {{ .Values.dask.enabled | quote }} + {{- if .Values.dask.enabled }} + - name: REANA_DASK_CLUSTER_MAX_MEMORY_LIMIT + value: {{ .Values.dask.cluster_max_memory_limit | default "16Gi" }} + - name: REANA_DASK_CLUSTER_DEFAULT_NUMBER_OF_WORKERS + value: !!str {{ .Values.dask.cluster_default_number_of_workers | default 2 }} + - name: REANA_DASK_CLUSTER_DEFAULT_SINGLE_WORKER_MEMORY + value: {{ .Values.dask.cluster_default_single_worker_memory | default "2Gi" }} + - name: REANA_DASK_CLUSTER_MAX_SINGLE_WORKER_MEMORY + value: {{ .Values.dask.cluster_max_single_worker_memory | default "8Gi" }} + {{- end }} - name: WORKSPACE_PATHS value: {{ .Values.workspaces.paths | toJson | quote }} - name: WORKSPACE_RETENTION_PERIOD diff --git a/helm/reana/templates/reana-workflow-controller.yaml b/helm/reana/templates/reana-workflow-controller.yaml index a8cdc8d7..1c8502b9 100644 --- a/helm/reana/templates/reana-workflow-controller.yaml +++ b/helm/reana/templates/reana-workflow-controller.yaml @@ -179,6 +179,18 @@ spec: value: {{ .Values.components.reana_job_controller.environment | toJson | quote }} - name: REANA_INTERACTIVE_SESSIONS_ENVIRONMENTS value: {{ .Values.interactive_sessions.environments | toJson | quote }} + - name: DASK_ENABLED + value: {{ .Values.dask.enabled | quote }} + {{- if .Values.dask.enabled }} + - name: REANA_DASK_CLUSTER_MAX_MEMORY_LIMIT + value: {{ .Values.dask.cluster_max_memory_limit | default "16Gi" }} + - name: REANA_DASK_CLUSTER_DEFAULT_NUMBER_OF_WORKERS + value: !!str {{ .Values.dask.cluster_default_number_of_workers | default 2 }} + - name: REANA_DASK_CLUSTER_DEFAULT_SINGLE_WORKER_MEMORY + value: {{ .Values.dask.cluster_default_single_worker_memory | default "2Gi" }} + - name: REANA_DASK_CLUSTER_MAX_SINGLE_WORKER_MEMORY + value: {{ .Values.dask.cluster_max_single_worker_memory | default "8Gi" }} + {{- end }} {{- if .Values.reana_hostname }} - name: REANA_HOSTNAME value: {{ .Values.reana_hostname }} diff --git a/helm/reana/templates/roles.yaml b/helm/reana/templates/roles.yaml index 8a664c88..6af871f7 100644 --- a/helm/reana/templates/roles.yaml +++ b/helm/reana/templates/roles.yaml @@ -22,6 +22,18 @@ rules: - apiGroups: ["metrics.k8s.io"] resources: ["pods", "nodes"] verbs: ["get", "list", "watch"] +# Custom dask kubernetes resources +{{- if .Values.dask.enabled }} +- apiGroups: ["kubernetes.dask.org"] + resources: ["daskclusters", "daskautoscalers"] + verbs: ["create", "get", "list", "watch", "update", "patch", "delete"] +{{- end }} +# Traefik Middleware permissions +{{- if and .Values.traefik.enabled .Values.dask.enabled }} +- apiGroups: ["traefik.io"] + resources: ["middlewares"] + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] +{{- end }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding diff --git a/helm/reana/values.yaml b/helm/reana/values.yaml index 0b3471b1..22b3b25e 100644 --- a/helm/reana/values.yaml +++ b/helm/reana/values.yaml @@ -178,6 +178,13 @@ traefik: enabled: true isDefaultClass: true +dask: + enabled: false + cluster_max_memory_limit: "16Gi" + cluster_default_number_of_workers: 2 + cluster_default_single_worker_memory: "2Gi" + cluster_max_single_worker_memory: "8Gi" + pgbouncer: enabled: false image: docker.io/bitnami/pgbouncer:1.23.1