Skip to content

Commit

Permalink
helm: add cronjob to update disk quota nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidalgarcia committed Oct 14, 2020
1 parent 5c1e5c3 commit 51683f3
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
10 changes: 10 additions & 0 deletions helm/reana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ This Helm automatically prefixes all names using the release name to avoid colli
| `notifications.email_config.smtp_server` | SMTP email server host | None |
| `notifications.email_config.smtp_port` | SMTP email server port | None |
| `notifications.enabled` | Enable REANA system events notifications | false |
<<<<<<< HEAD
| `notifications.system_status` | Cronjob pattern representing how often the system status notification should be sent. Leave it empty to deactivate it | "0 0 * * *" |
=======
| `notifications.system_status` | Cronjob pattern representing how often the system status notification should be sent. Leave it empty to deactivate it | "0 0 * * *" |
>>>>>>> helm: add cronjob to update disk quota nightly
| `reana_hostname` | REANA hostname (e.g. reana.example.org) | None |
| `namespace_runtime` | Namespace in which the REANA runtime pods (workflow engines, jobs etc...) will run | `.Release.Namespace` |
| `naming_scheme` | REANA component naming scheme | None |
Expand Down Expand Up @@ -82,3 +86,9 @@ This Helm automatically prefixes all names using the release name to avoid colli
| `shared_storage.hostpath.root_path` | Path to the REANA directory inside the underlying storage volume | /var/reana |
| `traefik.*` | Pass any value from [Traefik Helm chart values](https://github.com/helm/charts/tree/master/stable/traefik#configuration) here, e.g. `traefik.rbac.enabled=true` | - |
| `traefik.enabled` | Install Traefik in the cluster when installing REANA | true |
<<<<<<< HEAD
=======
| `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.disk_update` | Cronjob pattern representing how often the users disk quota usage should be updated. Leave it empty to deactivate it | "0 3 * * *" |
>>>>>>> helm: add cronjob to update disk quota nightly
70 changes: 70 additions & 0 deletions helm/reana/templates/cronjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,73 @@ spec:
path: /code/reana-server
{{- end }}
{{- end }}
---
{{- if .Values.quota.disk_update }}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ include "reana.prefix" . }}-disk-quota-update
namespace: {{ .Release.Namespace }}
spec:
schedule: "{{ .Values.quota.disk_update }}"
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
containers:
- name: {{ include "reana.prefix" . }}-disk-quota-update
image: {{ .Values.components.reana_server.image }}
command:
- '/bin/sh'
- '-c'
args:
- 'reana-db quota disk-usage-update'
{{- if .Values.debug.enabled }}
tty: true
stdin: true
{{- end }}
env:
{{- range $key, $value := .Values.db_env_config }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- if .Values.debug.enabled }}
- name: FLASK_ENV
value: "development"
{{- else }}
- name: REANA_DB_USERNAME
valueFrom:
secretKeyRef:
name: {{ include "reana.prefix" . }}-db-secrets
key: user
- name: REANA_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "reana.prefix" . }}-db-secrets
key: password
{{- end }}
volumeMounts:
{{- if .Values.debug.enabled }}
- mountPath: /code/
name: reana-code
{{- end }}
- mountPath: {{ .Values.shared_storage.shared_volume_mount_path }}
name: reana-shared-volume
imagePullPolicy: IfNotPresent
restartPolicy: Never
volumes:
- name: reana-shared-volume
{{- if not (eq .Values.shared_storage.backend "hostpath") }}
persistentVolumeClaim:
claimName: {{ include "reana.prefix" . }}-shared-persistent-volume
readOnly: false
{{- else }}
hostPath:
path: {{ .Values.shared_storage.hostpath.root_path }}
{{- end }}
- name: reana-code
hostPath:
path: /code/reana-server
{{- end }}
4 changes: 4 additions & 0 deletions helm/reana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@ traefik:
ssl:
enabled: true
generateTLS: true

# Quota
quota:
disk_update: "0 3 * * *" # everyday at 3am

0 comments on commit 51683f3

Please sign in to comment.