Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(chart): render with the values of a release without startupProbe

Yudhi Armyndharis498246129eec
diff --git a/charts/openwa/templates/statefulset.yaml b/charts/openwa/templates/statefulset.yaml
index 44949ab9a..470cfb991 100644
--- a/charts/openwa/templates/statefulset.yaml
+++ b/charts/openwa/templates/statefulset.yaml
@@ -87,9 +87,9 @@ spec:
httpGet:
path: /api/health/live
port: http
- periodSeconds: {{ .Values.startupProbe.periodSeconds }}
+ periodSeconds: {{ (.Values.startupProbe | default dict).periodSeconds | default 5 }}
timeoutSeconds: 5
- failureThreshold: {{ .Values.startupProbe.failureThreshold }}
+ failureThreshold: {{ (.Values.startupProbe | default dict).failureThreshold | default 60 }}
livenessProbe:
httpGet:
path: /api/health/live
diff --git a/docs/11-operational-runbooks.md b/docs/11-operational-runbooks.md
index da3b4028c..f23a5e95d 100644
--- a/docs/11-operational-runbooks.md
+++ b/docs/11-operational-runbooks.md
@@ -583,9 +583,12 @@ curl -X POST http://localhost:2785/api/sessions/{sessionId}/messages/send-text \
> On Kubernetes with the chart in `charts/openwa`, take the step 2 backup with the Helm lines in
> Runbook: Database Backup and the step 3 export first, then replace steps 4-8 with checking out the
-> new release and running `helm upgrade openwa ./charts/openwa --reuse-values`. The image tag defaults
-> to the chart's `appVersion`, so the checkout moves it, unless `image.tag` was set at install:
-> `--reuse-values` keeps that value, so pass `--set image.tag=<new-version>` in that case.
+> new release and running `helm upgrade openwa ./charts/openwa --reset-then-reuse-values` (Helm 3.14
+> or later). It takes the new chart's defaults and re-applies the values you set. Plain
+> `--reuse-values` renders the new templates with the old release's defaults instead, which keeps a
+> 45 s `terminationGracePeriodSeconds` and a capability list without `KILL`, so a stop never reaches
+> the app. The image tag defaults to the chart's `appVersion`, so the checkout moves it, unless
+> `image.tag` was set at install: that value is kept, so pass `--set image.tag=<new-version>` then.
> Run steps 9-12 through `kubectl port-forward` to the release's Service. `helm rollback` keeps the
> volume, so read the notes on restoring `sessions/` below before relying on it.
diff --git a/scripts/check-chart-behaviour.mjs b/scripts/check-chart-behaviour.mjs
index f3a475445..c8cb2dd29 100644
--- a/scripts/check-chart-behaviour.mjs
+++ b/scripts/check-chart-behaviour.mjs
@@ -309,6 +309,24 @@ const check = (id, ok, detail) => results.push({ id, ok, detail });
);
}
+// `helm upgrade --reuse-values` renders the new templates with the PREVIOUS release's values, which hold
+// none of the keys a newer chart added. A template that reads one without a default fails the upgrade
+// with a nil pointer, and so does a chart that stops rendering when a block is removed.
+{
+ let detail;
+ let ok = false;
+ try {
+ const probe = mapAt(byKind(render('--set', 'startupProbe=null'), 'StatefulSet')[0] ?? '', ['startupProbe']);
+ ok = probe?.periodSeconds === '5' && probe?.failureThreshold === '60';
+ detail = ok
+ ? 'values without the startupProbe block render with the 5 s period and 60 failures'
+ : `values without startupProbe rendered periodSeconds ${probe?.periodSeconds}, failureThreshold ${probe?.failureThreshold}`;
+ } catch (error) {
+ detail = `the chart does not render with values that predate startupProbe: ${String(error.stderr ?? error.message).split('\n')[0]}`;
+ }
+ check('renders-with-previous-release-values', ok, detail);
+}
+
const failed = results.filter(r => !r.ok);
if (failed.length) {
console.error('\n✖ Chart behaviour check failed:');