Skip to content

Commit 2f84677

Browse files
authored
feat: add liveness and readiness probes for API and Celery worker (#1104)
- Implemented liveness and readiness probes in `values.yaml` for both API and Celery worker. - Updated deployment templates to include the new probe configurations, enhancing application health monitoring.
1 parent e6da408 commit 2f84677

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

deploy/aperag/templates/api-deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,14 @@ spec:
181181
resources:
182182
{{- toYaml . | nindent 12 }}
183183
{{- end }}
184+
{{- with .Values.api.livenessProbe }}
185+
livenessProbe:
186+
{{- toYaml . | nindent 12 }}
187+
{{- end }}
188+
{{- with .Values.api.readinessProbe }}
189+
readinessProbe:
190+
{{- toYaml . | nindent 12 }}
191+
{{- end }}
184192
volumeMounts:
185193
- mountPath: /data
186194
name: data

deploy/aperag/templates/celeryworker-deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ spec:
177177
resources:
178178
{{- toYaml . | nindent 12 }}
179179
{{- end }}
180+
{{- with index .Values "celery-worker" "livenessProbe" }}
181+
livenessProbe:
182+
{{- toYaml . | nindent 12 }}
183+
{{- end }}
184+
{{- with index .Values "celery-worker" "readinessProbe" }}
185+
readinessProbe:
186+
{{- toYaml . | nindent 12 }}
187+
{{- end }}
180188
volumeMounts:
181189
- mountPath: /data
182190
name: data

deploy/aperag/values.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,24 @@ api:
192192
CACHE_ENABLED: "True"
193193
CACHE_TTL: "86400"
194194

195+
livenessProbe:
196+
httpGet:
197+
path: /health
198+
port: 8000
199+
initialDelaySeconds: 10
200+
periodSeconds: 10
201+
timeoutSeconds: 2
202+
failureThreshold: 3
203+
successThreshold: 1
204+
readinessProbe:
205+
httpGet:
206+
path: /health
207+
port: 8000
208+
initialDelaySeconds: 5
209+
periodSeconds: 5
210+
timeoutSeconds: 2
211+
failureThreshold: 3
212+
successThreshold: 1
195213

196214
celery-worker:
197215
replicaCount: 1
@@ -216,6 +234,28 @@ celery-worker:
216234
matchLabels:
217235
app.aperag.io/component: celery-worker
218236
topologyKey: kubernetes.io/hostname
237+
livenessProbe:
238+
exec:
239+
command:
240+
- sh
241+
- -c
242+
- "celery -A config.celery status -d celery@$(hostname) > /dev/null 2>&1"
243+
initialDelaySeconds: 15
244+
periodSeconds: 30
245+
timeoutSeconds: 5
246+
failureThreshold: 3
247+
successThreshold: 1
248+
readinessProbe:
249+
exec:
250+
command:
251+
- sh
252+
- -c
253+
- "celery -A config.celery status -d celery@$(hostname) > /dev/null 2>&1"
254+
initialDelaySeconds: 15
255+
periodSeconds: 30
256+
timeoutSeconds: 5
257+
failureThreshold: 3
258+
successThreshold: 1
219259

220260
celerybeat:
221261
replicaCount: 1

0 commit comments

Comments
 (0)