Skip to content

Commit 72b1eb2

Browse files
committed
Adding long running worker
1 parent 85701ae commit 72b1eb2

File tree

3 files changed

+117
-1
lines changed

3 files changed

+117
-1
lines changed

Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 5.2.2
18+
version: 5.3.0
1919

2020
dependencies:
2121
- name: mongodb
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "kobo.fullname" . }}-kpi-worker-long-running
5+
labels:
6+
app.kubernetes.io/component: kpi-worker-long-running
7+
{{- include "kobo.labels" . | nindent 4 }}
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app.kubernetes.io/component: kpi-worker-long-running
13+
{{- include "kobo.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
annotations:
17+
checksum/secret: {{ include (print $.Template.BasePath "/kpi/secrets.yaml") . | sha256sum }}
18+
checksum/configmap: {{ include (print $.Template.BasePath "/kpi/configmap.yaml") . | sha256sum }}
19+
tag: "{{ .Values.kpi.version }}"
20+
labels:
21+
app.kubernetes.io/component: kpi-worker-long-running
22+
{{- include "kobo.selectorLabels" . | nindent 8 }}
23+
spec:
24+
securityContext:
25+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
26+
containers:
27+
- name: {{ .Chart.Name }}
28+
securityContext:
29+
{{- toYaml .Values.securityContext | nindent 12 }}
30+
image: "{{ .Values.kpi.image.repository }}:{{ .Values.kpi.version }}"
31+
imagePullPolicy: {{ .Values.kpi.image.pullPolicy }}
32+
{{- if .Values.kpi.workerLongRunning.livenessProbe}}
33+
livenessProbe:
34+
{{- .Values.kpi.workerLongRunning.livenessProbe | toYaml | nindent 12 }}
35+
{{- end }}
36+
resources:
37+
{{- toYaml .Values.kpi.workerLongRunning.resources | nindent 12 }}
38+
env:
39+
- name: POD_IP
40+
valueFrom:
41+
fieldRef:
42+
fieldPath: status.podIP
43+
{{- if .Values.postgresql.enabled }}
44+
- name: POSTGRES_PASSWORD
45+
valueFrom:
46+
secretKeyRef:
47+
name: {{ default (include "kobo.postgresql.fullname" .) .Values.postgresql.auth.existingSecret }}
48+
key: postgres-password
49+
- name: DATABASE_URL
50+
value: {{ (include "kobo.postgresql.url" .) }}
51+
- name: KC_DATABASE_URL
52+
value: {{ (include "kobo.postgresql.kc_url" .) }}
53+
{{- end }}
54+
{{- if .Values.mongodb.enabled }}
55+
- name: MONGODB_PASSWORD
56+
valueFrom:
57+
secretKeyRef:
58+
name: {{ default (include "kobo.mongodb.fullname" .) .Values.mongodb.auth.existingSecret }}
59+
key: mongodb-passwords
60+
- name: MONGO_DB_URL
61+
value: {{ (include "kobo.mongodb.url" .) }}
62+
{{- end }}
63+
{{- if .Values.redis.enabled }}
64+
- name: REDIS_PASSWORD
65+
valueFrom:
66+
secretKeyRef:
67+
name: {{ default (include "kobo.redis.fullname" .) .Values.redis.auth.existingSecret }}
68+
key: redis-password
69+
- name: ENKETO_REDIS_MAIN_URL
70+
value: {{ (include "kobo.redis.url" .) }}/0
71+
- name: REDIS_SESSION_URL
72+
value: {{ (include "kobo.redis.url" .) }}/1
73+
- name: SERVICE_ACCOUNT_BACKEND_URL
74+
value: {{ (include "kobo.redis.url" .) }}/6
75+
- name: CELERY_BROKER_URL
76+
value: {{ (include "kobo.redis.url" .) }}/2
77+
- name: CACHE_URL
78+
value: {{ (include "kobo.redis.url" .) }}/4
79+
- name: CELERY_WORKER_AUTOSCALE
80+
value: {{ .Values.workerLongRunning.celeryAutoscale }}
81+
{{- end }}
82+
envFrom:
83+
- secretRef:
84+
name: {{ include "kobo.fullname" . }}-kpi
85+
- configMapRef:
86+
name: {{ include "kobo.fullname" . }}-kpi
87+
command: ["celery", "-A", "kobo", "worker", "--queues=kpi_long_running_tasks_queue", "-l", "info", "--hostname=kpi_main_worker@%h"]
88+
{{- with .Values.kpi.extraVolumeMounts }}
89+
volumeMounts:
90+
{{- toYaml . | nindent 10 }}
91+
{{- end }}
92+
{{- with .Values.kpi.workerLongRunning.nodeSelector }}
93+
nodeSelector:
94+
{{- toYaml . | nindent 8 }}
95+
{{- end }}
96+
{{- with .Values.kpi.workerLongRunning.affinity }}
97+
affinity:
98+
{{- toYaml . | nindent 8 }}
99+
{{- end }}
100+
{{- with .Values.kpi.workerLongRunning.tolerations }}
101+
tolerations:
102+
{{- toYaml . | nindent 8 }}
103+
{{- end }}
104+
{{- with .Values.kpi.extraVolumes }}
105+
volumes:
106+
{{- toYaml . | nindent 6 }}
107+
{{- end }}

values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ kpi:
123123
maxReplicas: 20
124124
targetCPU: 90
125125
# targetMemory: 80
126+
workerLongRunning:
127+
celeryAutoscale: "2,10"
128+
resources:
129+
limits:
130+
cpu: 2000m
131+
memory: 2000Mi
132+
requests:
133+
cpu: 500m
134+
memory: 500Mi
126135
workerLowPriority:
127136
replicaCount: 1
128137
livenessProbe:

0 commit comments

Comments
 (0)