From 1e6f9fc6c85d5ab179a74a013d29bdfa4239137d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Vidal=20Garc=C3=ADa?= Date: Wed, 27 Oct 2021 16:55:44 +0200 Subject: [PATCH] helm: make quota accounting configurable closes #562 --- CHANGES.rst | 4 +++- helm/reana/README.md | 4 +++- helm/reana/templates/cronjobs.yaml | 4 +++- helm/reana/templates/reana-server.yaml | 6 +++++- helm/reana/templates/reana-workflow-controller.yaml | 10 +++++++++- helm/reana/values.yaml | 1 + 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 35c6d09b..fe283464 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,12 +5,14 @@ Version 0.8.0 (UNRELEASED) -------------------------- - Users: - - Adds support for Snakemake workflow engine. + - Adds support for Snakemake workflow engine. - Administrators - Adds new configuration to set node labels splitting workflow nodes, job nodes and session nodes (``node_label_runtimebatch``, ``node_label_runtimejobs``, ``node_label_runtimesessions``). - Adds a default ``kubernetes_memory_limit`` value (4Gi). - Adds configuration environment variable to set workflow scheduling policy (``REANA_WORKFLOW_SCHEDULING_POLICY``). + - Adds new configuration ``quota.enabled`` to enable or disable quota accounting. + - Adds new configuration ``quota.termination_update_policy`` to select the resources for which the quota must be calculated. - Changes Helm templates to use PostgreSQL 12.8 version. Version 0.7.4 (2021-07-07) diff --git a/helm/reana/README.md b/helm/reana/README.md index 4aea7457..35a60402 100644 --- a/helm/reana/README.md +++ b/helm/reana/README.md @@ -96,7 +96,9 @@ This Helm automatically prefixes all names using the release name to avoid colli | `traefik.enabled` | Install Traefik in the cluster when installing REANA | true | | `volume_paths.root_path` | Path to the REANA directory inside the underlying storage volume | /var/reana | | `volume_paths.shared_volume_path` | Path inside the REANA components where the shared volume will be mounted | /var/reana | +| `quota.enabled` | Enable user workflow accounting capabilities. | true | | `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.termination_update_policy` | Resources to calculate quotas on worflow termination. Possible values: "cpu" and "disk" | "cpu,disk" | | `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 as strings. Each mount string is composed by a key `hostPath`(path to the directory to be mounted from the Kubernetes nodes) and a cluster_pod_mountpath (path inside the cluster containers where the `mountPath` will be mounted) e.g. `hostPath:mountPath`. The first value listed will be the default workspace root path. Any POSIX filesystem mounted on cluster nodes is supported | None | \ No newline at end of file +| `workspaces.paths` | List of additional workspace paths as strings. Each mount string is composed by a key `hostPath`(path to the directory to be mounted from the Kubernetes nodes) and a cluster_pod_mountpath (path inside the cluster containers where the `mountPath` will be mounted) e.g. `hostPath:mountPath`. The first value listed will be the default workspace root path. Any POSIX filesystem mounted on cluster nodes is supported | None | diff --git a/helm/reana/templates/cronjobs.yaml b/helm/reana/templates/cronjobs.yaml index c6967120..93d933ce 100644 --- a/helm/reana/templates/cronjobs.yaml +++ b/helm/reana/templates/cronjobs.yaml @@ -106,7 +106,7 @@ spec: {{- end }} {{- end }} --- -{{- if .Values.quota.disk_update }} +{{- if and .Values.quota.enabled .Values.quota.disk_update }} apiVersion: batch/v1beta1 kind: CronJob metadata: @@ -133,6 +133,8 @@ spec: stdin: true {{- end }} env: + - name: REANA_WORKFLOW_TERMINATION_QUOTA_UPDATE_POLICY + value: {{ .Values.quota.termination_update_policy | default "disk,cpu" }} {{- range $key, $value := .Values.db_env_config }} - name: {{ $key }} value: {{ $value | quote }} diff --git a/helm/reana/templates/reana-server.yaml b/helm/reana/templates/reana-server.yaml index 1282e01d..11476d29 100644 --- a/helm/reana/templates/reana-server.yaml +++ b/helm/reana/templates/reana-server.yaml @@ -79,9 +79,13 @@ spec: - name: REANA_DEFAULT_QUOTA_DISK_LIMIT value: {{ .Values.quota.default_disk_limit | default 0 | quote }} - name: REANA_KUBERNETES_JOBS_MEMORY_LIMIT - value: {{ .Values.kubernetes_jobs_memory_limit | default "4Gi" }} + value: {{ .Values.kubernetes_jobs_memory_limit | default "4Gi" }} - name: WORKSPACE_PATHS value: {{ .Values.workspaces.paths | toJson | quote }} + {{- if .Values.quota.enabled }} + - name: REANA_WORKFLOW_TERMINATION_QUOTA_UPDATE_POLICY + value: {{ .Values.quota.termination_update_policy | default "disk,cpu" }} + {{- end }} {{- range $key, $value := .Values.db_env_config }} - name: {{ $key }} value: {{ $value | quote }} diff --git a/helm/reana/templates/reana-workflow-controller.yaml b/helm/reana/templates/reana-workflow-controller.yaml index 16b51fc0..2ee888db 100644 --- a/helm/reana/templates/reana-workflow-controller.yaml +++ b/helm/reana/templates/reana-workflow-controller.yaml @@ -71,10 +71,14 @@ 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.quota.enabled }} + - name: REANA_WORKFLOW_TERMINATION_QUOTA_UPDATE_POLICY + value: {{ .Values.quota.termination_update_policy | default "disk,cpu" }} + {{- end }} {{- if .Values.naming_scheme }} - name: REANA_COMPONENT_NAMING_SCHEME value: {{ .Values.naming_scheme }} - {{- end }} + {{- end }} - name: WORKSPACE_PATHS value: {{ .Values.workspaces.paths | toJson | quote }} {{- range $key, $value := .Values.db_env_config }} @@ -183,6 +187,10 @@ spec: value: {{ .Release.Namespace }} - name: REANA_RUNTIME_KUBERNETES_NAMESPACE value: {{ .Values.namespace_runtime | default .Release.Namespace }} + {{- if .Values.quota.enabled }} + - name: REANA_WORKFLOW_TERMINATION_QUOTA_UPDATE_POLICY + value: {{ .Values.quota.termination_update_policy | default "disk,cpu" }} + {{- end }} {{- range $key, $value := .Values.db_env_config }} - name: {{ $key }} value: {{ $value | quote }} diff --git a/helm/reana/values.yaml b/helm/reana/values.yaml index d9decc38..0b9107b4 100644 --- a/helm/reana/values.yaml +++ b/helm/reana/values.yaml @@ -125,4 +125,5 @@ traefik: # Quota quota: + enabled: true disk_update: "0 3 * * *" # everyday at 3am