/
deployment-scheduler.yaml
110 lines (110 loc) · 4.71 KB
/
deployment-scheduler.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
{{- if .Values.scheduler.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "substra.fullname" . }}-scheduler
labels:
{{ include "substra.labels" . | nindent 4 }}
app.kubernetes.io/name: {{ template "substra.name" . }}-scheduler
spec:
replicas: {{ .Values.scheduler.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ template "substra.name" . }}-scheduler
{{ include "substra.selectorLabels" . | nindent 8}}
template:
metadata:
labels:
app.kubernetes.io/name: {{ template "substra.name" . }}-scheduler
{{ include "substra.labels" . | nindent 8 }}
annotations:
# This will cause the pod to restart if the content of the ConfigMap is updated through Helm
checksum-cm-orchestrator: {{ include (print $.Template.BasePath "/configmap-orchestrator.yaml") . | sha256sum }}
checksum-cm-settings: {{ include (print $.Template.BasePath "/configmap-settings.yaml") . | sha256sum }}
checksum-cm-db: {{ include (print $.Template.BasePath "/configmap-database.yaml") . | sha256sum }}
checksum-cm-redis: {{ include (print $.Template.BasePath "/configmap-redis.yaml") . | sha256sum }}
checksum-cm-registry: {{ include (print $.Template.BasePath "/configmap-registry.yaml") . | sha256sum }}
checksum-secret-database : {{ include (print $.Template.BasePath "/secret-database.yaml") . | sha256sum }}
checksum-secret-redis : {{ include (print $.Template.BasePath "/secret-redis.yaml") . | sha256sum }}
spec:
{{- with .Values.scheduler.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.scheduler.podSecurityContext.enabled }}
securityContext:
fsGroup: {{ .Values.scheduler.podSecurityContext.fsGroup }}
runAsGroup: {{ .Values.scheduler.podSecurityContext.runAsGroup }}
runAsUser: {{ .Values.scheduler.podSecurityContext.runAsUser }}
{{- end }}
containers:
- name: scheduler
image: {{ include "substra-backend.images.name" (dict "img" .Values.scheduler.image "defaultTag" $.Chart.AppVersion) }}
imagePullPolicy: {{ .Values.scheduler.image.pullPolicy }}
command: ["/bin/bash"]
args: ["-c", "celery -A backend beat -l debug --schedule /var/substra/runtime-db/celerybeat-scheduler"]
envFrom:
- configMapRef:
name: {{ include "substra.fullname" . }}-orchestrator
- configMapRef:
name: {{ include "substra.fullname" . }}-settings
- configMapRef:
name: {{ include "substra.fullname" . }}-database
- configMapRef:
name: {{ include "substra.fullname" . }}-redis
- configMapRef:
name: {{ include "substra.fullname" . }}-registry
- secretRef:
name: {{ include "substra.fullname" . }}-redis
- secretRef:
name: {{ include "substra-backend.database.secret-name" . }}
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: DJANGO_SETTINGS_MODULE
value: backend.settings.celery.{{ .Values.settings }}
volumeMounts:
- name: runtime-db
mountPath: /var/substra/runtime-db
{{ if .Values.orchestrator.tls.enabled }}
- name: orchestrator-tls-cacert
mountPath: /var/substra/orchestrator/tls/server
{{ if .Values.orchestrator.tls.mtls.enabled }}
- name: orchestrator-tls-client-pair
mountPath: /var/substra/orchestrator/tls/client
{{ end }}
{{ end }}
resources:
{{- toYaml .Values.scheduler.resources | nindent 12 }}
volumes:
- name: runtime-db
emptyDir: {}
{{ if.Values.orchestrator.tls.enabled }}
- name: orchestrator-tls-cacert
secret:
secretName: {{ $.Values.orchestrator.tls.cacert }}
{{ if .Values.orchestrator.tls.mtls.enabled }}
- name: orchestrator-tls-client-pair
secret:
secretName: {{ .Values.orchestrator.tls.mtls.clientCertificate }}
{{ end }}
{{ end }}
{{- with .Values.scheduler.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.scheduler.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.scheduler.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}