-
Notifications
You must be signed in to change notification settings - Fork 50
/
cronjobs.yaml
179 lines (179 loc) · 6.59 KB
/
cronjobs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
{{- if .Values.notifications.enabled }}
{{- if .Values.notifications.system_status }}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ include "reana.prefix" . }}-system-status
namespace: {{ .Release.Namespace }}
spec:
schedule: "{{ .Values.notifications.system_status }}"
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
serviceAccountName: {{ include "reana.prefixed_infrastructure_svaccount_name" . }}
containers:
- name: {{ include "reana.prefix" . }}-system-status
image: {{ .Values.components.reana_server.image }}
command:
- '/bin/sh'
- '-c'
args:
- 'flask reana-admin status-report --email {{ .Values.notifications.email_config.receiver }}'
{{- if .Values.debug.enabled }}
tty: true
stdin: true
{{- end }}
env:
{{- if .Values.reana_hostname }}
- name: REANA_HOSTNAME
value: {{ .Values.reana_hostname }}
{{- end }}
{{- range $key, $value := .Values.db_env_config }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- if .Values.debug.enabled }}
- name: FLASK_ENV
value: "development"
- name: REANA_EMAIL_SMTP_SERVER
value: {{ printf "%s-mail" (include "reana.prefix" .) }}
- name: REANA_EMAIL_SMTP_PORT
value: "30025"
{{- 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
- name: REANA_EMAIL_SMTP_SERVER
value: {{ .Values.notifications.email_config.smtp_server }}
- name: REANA_EMAIL_SMTP_PORT
value: "{{ .Values.notifications.email_config.smtp_port }}"
- name: REANA_EMAIL_LOGIN
valueFrom:
secretKeyRef:
name: {{ include "reana.prefix" . }}-mail-notification-sender-password
key: REANA_EMAIL_LOGIN
- name: REANA_EMAIL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "reana.prefix" . }}-mail-notification-sender-password
key: REANA_EMAIL_PASSWORD
{{- end }}
- name: REANA_COMPONENT_PREFIX
value: {{ include "reana.prefix" . }}
- name: REANA_EMAIL_SENDER
value: {{ .Values.notifications.email_config.sender }}
- name: REANA_ADMIN_ACCESS_TOKEN
valueFrom:
secretKeyRef:
name: {{ include "reana.prefix" . }}-admin-access-token
key: ADMIN_ACCESS_TOKEN
- name: REANA_INFRASTRUCTURE_KUBERNETES_NAMESPACE
value: {{ .Release.Namespace }}
- name: REANA_RUNTIME_KUBERNETES_NAMESPACE
value: {{ .Values.namespace_runtime | default .Release.Namespace }}
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 }}
{{- end }}
---
{{- if and .Values.quota.enabled .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:
- 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 }}
{{- 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 }}