From fe80a785c8bb059e77f46ceeef1b211c4b1dce74 Mon Sep 17 00:00:00 2001 From: Brendan Kellam Date: Mon, 1 Jun 2026 19:34:05 -0700 Subject: [PATCH 1/4] feat: add lifecycle and terminationGracePeriodSeconds values Lets a preStop hook keep the pod serving while a load balancer finishes deregistering its target during a rolling update, avoiding 502s on the scale-down side. Both default to no-ops, so behavior is unchanged unless set. Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 3 +++ charts/sourcebot/templates/deployment.yaml | 7 +++++++ charts/sourcebot/values.schema.json | 6 ++++++ charts/sourcebot/values.yaml | 7 +++++++ 4 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a034639..09d6e75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- `sourcebot.lifecycle` and `sourcebot.terminationGracePeriodSeconds` values. + ## [0.1.85] - 2026-05-30 ### Changed diff --git a/charts/sourcebot/templates/deployment.yaml b/charts/sourcebot/templates/deployment.yaml index 7dc6d2b..19ea067 100644 --- a/charts/sourcebot/templates/deployment.yaml +++ b/charts/sourcebot/templates/deployment.yaml @@ -30,6 +30,9 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "sourcebot.serviceAccountName" $ }} + {{- with $.Values.sourcebot.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ . }} + {{- end }} {{- if $.Values.sourcebot.podSecurityContext }} securityContext: {{- toYaml $.Values.sourcebot.podSecurityContext | nindent 8 }} @@ -118,6 +121,10 @@ spec: resources: {{- toYaml . | nindent 12 }} {{- end }} + {{- with $.Values.sourcebot.lifecycle }} + lifecycle: + {{- toYaml . | nindent 12 }} + {{- end }} volumeMounts: - name: sourcebot-config mountPath: /etc/sourcebot/config.json diff --git a/charts/sourcebot/values.schema.json b/charts/sourcebot/values.schema.json index d6a5135..15c2552 100644 --- a/charts/sourcebot/values.schema.json +++ b/charts/sourcebot/values.schema.json @@ -167,6 +167,12 @@ "startupProbe": { "type": "object" }, + "lifecycle": { + "type": "object" + }, + "terminationGracePeriodSeconds": { + "type": ["integer", "null"] + }, "extraVolumes": { "type": "array" }, diff --git a/charts/sourcebot/values.yaml b/charts/sourcebot/values.yaml index 80229cd..98f11b2 100644 --- a/charts/sourcebot/values.yaml +++ b/charts/sourcebot/values.yaml @@ -238,6 +238,13 @@ sourcebot: # -- Initial delay before the first probe periodSeconds: 30 + # -- Container lifecycle hooks. + lifecycle: {} + + # -- Grace period (seconds) Kubernetes waits between SIGTERM and SIGKILL on pod + # termination. + terminationGracePeriodSeconds: null + # -- Define additional volumes # See: https://kubernetes.io/docs/concepts/storage/volumes/ extraVolumes: [] From fad7a061f871ee8296ca13a3393f2085fc885316 Mon Sep 17 00:00:00 2001 From: Brendan Kellam Date: Mon, 1 Jun 2026 19:35:23 -0700 Subject: [PATCH 2/4] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09d6e75..b8152e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- `sourcebot.lifecycle` and `sourcebot.terminationGracePeriodSeconds` values. +- `sourcebot.lifecycle` and `sourcebot.terminationGracePeriodSeconds` values. [#110](https://github.com/sourcebot-dev/sourcebot-helm-chart/pull/110) ## [0.1.85] - 2026-05-30 From 792014564e8ae33e2f9f23c32b23bb42213da60e Mon Sep 17 00:00:00 2001 From: Brendan Kellam Date: Mon, 1 Jun 2026 19:44:22 -0700 Subject: [PATCH 3/4] feedback --- charts/sourcebot/templates/deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/sourcebot/templates/deployment.yaml b/charts/sourcebot/templates/deployment.yaml index 19ea067..b990eb6 100644 --- a/charts/sourcebot/templates/deployment.yaml +++ b/charts/sourcebot/templates/deployment.yaml @@ -30,8 +30,8 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "sourcebot.serviceAccountName" $ }} - {{- with $.Values.sourcebot.terminationGracePeriodSeconds }} - terminationGracePeriodSeconds: {{ . }} + {{- if ne $.Values.sourcebot.terminationGracePeriodSeconds nil }} + terminationGracePeriodSeconds: {{ $.Values.sourcebot.terminationGracePeriodSeconds }} {{- end }} {{- if $.Values.sourcebot.podSecurityContext }} securityContext: From 966ae8d3669fc2b038184b1e65412146f7feffb1 Mon Sep 17 00:00:00 2001 From: Brendan Kellam Date: Mon, 1 Jun 2026 19:46:00 -0700 Subject: [PATCH 4/4] docs --- charts/sourcebot/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/sourcebot/README.md b/charts/sourcebot/README.md index 4782972..9120fc1 100644 --- a/charts/sourcebot/README.md +++ b/charts/sourcebot/README.md @@ -87,6 +87,7 @@ Sourcebot is a self-hosted tool that helps you understand your codebase. | sourcebot.license.existingSecret | string | `""` | Use an existing secret for the license key | | sourcebot.license.existingSecretKey | string | `"key"` | Key in the existing secret that contains the license key | | sourcebot.license.value | string | `""` | License key value (or use existingSecret) | +| sourcebot.lifecycle | object | `{}` | Container lifecycle hooks. | | sourcebot.livenessProbe.failureThreshold | int | `5` | Number of consecutive failures before marking the container as unhealthy | | sourcebot.livenessProbe.httpGet | object | `{"path":"/api/health","port":"http"}` | Http GET request to check if the container is alive | | sourcebot.livenessProbe.httpGet.path | string | `"/api/health"` | Path to check | @@ -131,6 +132,7 @@ Sourcebot is a self-hosted tool that helps you understand your codebase. | sourcebot.startupProbe.httpGet.port | string | `"http"` | Port to check | | sourcebot.startupProbe.periodSeconds | int | `30` | Initial delay before the first probe | | sourcebot.strategy | object | `{"type":"RollingUpdate"}` | Deployment strategy configuration | +| sourcebot.terminationGracePeriodSeconds | string | `nil` | Grace period (seconds) Kubernetes waits between SIGTERM and SIGKILL on pod termination. | | sourcebot.tolerations | list | `[]` | Set tolerations for pod scheduling See: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ | ----------------------------------------------