From 9c947b09d5a67713c79eaaacb8b73f7f0c97232f Mon Sep 17 00:00:00 2001 From: Hong Hai Nguyen Date: Wed, 5 Nov 2025 16:22:10 +0100 Subject: [PATCH 1/3] feat(sentry): use lightweight liveness & add Celery readiness probe for worker --- charts/sentry/README.md | 7 +++++++ .../worker/deployment-sentry-worker.yaml | 19 +++++++++++++++---- charts/sentry/values.yaml | 9 +++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/charts/sentry/README.md b/charts/sentry/README.md index 0967cde69..70661257c 100644 --- a/charts/sentry/README.md +++ b/charts/sentry/README.md @@ -788,8 +788,15 @@ Note: this table is incomplete, so have a look at the values.yaml in case you mi | sentry.worker.existingSecretEnv | string | `""` | | | sentry.worker.livenessProbe.enabled | bool | `true` | | | sentry.worker.livenessProbe.failureThreshold | int | `3` | | +| ssentry.worker.livenessProbe.initialDelaySeconds | int | `10` | | | sentry.worker.livenessProbe.periodSeconds | int | `60` | | | sentry.worker.livenessProbe.timeoutSeconds | int | `10` | | +| sentry.worker.readinessProbe.enabled | bool | `true` | | +| sentry.worker.readinessProbe.failureThreshold | int | `3` | | +| ssentry.worker.readinessProbe.initialDelaySeconds | int | `10` | | +| sentry.worker.readinessProbe.periodSeconds | int | `60` | | +| sentry.worker.readinessProbe.timeoutSeconds | int | `10` | | +| sentry.worker.readinessProbe.celeryTimeoutSeconds | int | `5` | | | sentry.worker.nodeSelector | object | `{}` | | | sentry.worker.replicas | int | `1` | | | sentry.worker.resources | object | `{}` | | diff --git a/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml b/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml index 9f0833d80..767dc104a 100644 --- a/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml +++ b/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml @@ -131,19 +131,30 @@ spec: {{ end }} {{- if .Values.sentry.worker.volumeMounts }} {{ toYaml .Values.sentry.worker.volumeMounts | indent 8 }} -{{- end }} - {{- if .Values.sentry.worker.livenessProbe.enabled }} +{{- if .Values.sentry.worker.livenessProbe.enabled }} livenessProbe: periodSeconds: {{ .Values.sentry.worker.livenessProbe.periodSeconds }} - initialDelaySeconds: 10 + initialDelaySeconds: {{ .Values.sentry.worker.livenessProbe.initialDelaySeconds }} timeoutSeconds: {{ .Values.sentry.worker.livenessProbe.timeoutSeconds }} failureThreshold: {{ .Values.sentry.worker.livenessProbe.failureThreshold }} + exec: + command: + - rm + - -f + - /tmp/health.txt +{{- end }} +{{- if .Values.sentry.worker.readinessProbe.enabled }} + readinessProbe: + periodSeconds: {{ .Values.sentry.worker.readinessProbe.periodSeconds }} + initialDelaySeconds: {{ .Values.sentry.worker.readinessProbe.initialDelaySeconds }} + timeoutSeconds: {{ .Values.sentry.worker.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.sentry.worker.readinessProbe.failureThreshold }} exec: command: - sentry - exec - -c - - 'from sentry.celery import app; import os; dest="celery@{}".format(os.environ["HOSTNAME"]); print(app.control.ping(destination=[dest], timeout=5)[0][dest]["ok"])' + - 'from sentry.celery import app; import os; dest="celery@{}".format(os.environ["HOSTNAME"]); print(app.control.ping(destination=[dest], timeout={{ default .Values.sentry.worker.readinessProbe.celeryTimeoutSeconds }})[0][dest]["ok"])' {{- end }} resources: {{ toYaml .Values.sentry.worker.resources | indent 12 }} diff --git a/charts/sentry/values.yaml b/charts/sentry/values.yaml index 67c33d265..23349b540 100644 --- a/charts/sentry/values.yaml +++ b/charts/sentry/values.yaml @@ -340,8 +340,17 @@ sentry: livenessProbe: enabled: true periodSeconds: 60 + initialDelaySeconds: 10 timeoutSeconds: 10 failureThreshold: 3 + readinessProbe: + enabled: true + periodSeconds: 60 + initialDelaySeconds: 10 + timeoutSeconds: 10 + failureThreshold: 3 + # time to wait for celery to respond + celeryTimeoutSeconds: 5 sidecars: [] # securityContext: {} # containerSecurityContext: {} From dd0a25636c86d80fa6bff52ea80f87365c512586 Mon Sep 17 00:00:00 2001 From: Hong Hai Nguyen Date: Wed, 5 Nov 2025 16:31:12 +0100 Subject: [PATCH 2/3] fix: missing condition end --- .../sentry/templates/sentry/worker/deployment-sentry-worker.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml b/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml index 767dc104a..25f210279 100644 --- a/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml +++ b/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml @@ -131,6 +131,7 @@ spec: {{ end }} {{- if .Values.sentry.worker.volumeMounts }} {{ toYaml .Values.sentry.worker.volumeMounts | indent 8 }} +{{- end }} {{- if .Values.sentry.worker.livenessProbe.enabled }} livenessProbe: periodSeconds: {{ .Values.sentry.worker.livenessProbe.periodSeconds }} From 12d936c758526533890c08afd72c9408d82a9bd9 Mon Sep 17 00:00:00 2001 From: Hong Hai Nguyen Date: Wed, 5 Nov 2025 17:01:18 +0100 Subject: [PATCH 3/3] refactor: remove default key --- .../templates/sentry/worker/deployment-sentry-worker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml b/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml index 25f210279..d062c1128 100644 --- a/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml +++ b/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml @@ -155,7 +155,7 @@ spec: - sentry - exec - -c - - 'from sentry.celery import app; import os; dest="celery@{}".format(os.environ["HOSTNAME"]); print(app.control.ping(destination=[dest], timeout={{ default .Values.sentry.worker.readinessProbe.celeryTimeoutSeconds }})[0][dest]["ok"])' + - 'from sentry.celery import app; import os; dest="celery@{}".format(os.environ["HOSTNAME"]); print(app.control.ping(destination=[dest], timeout={{ .Values.sentry.worker.readinessProbe.celeryTimeoutSeconds }})[0][dest]["ok"])' {{- end }} resources: {{ toYaml .Values.sentry.worker.resources | indent 12 }}