Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(chart): disable service links so a redis Service cannot break boot
Yudhi Armyndharis43d8e330b445
diff --git a/charts/openwa/templates/statefulset.yaml b/charts/openwa/templates/statefulset.yamlindex abb99e3f7..5e8b33035 100644--- a/charts/openwa/templates/statefulset.yaml+++ b/charts/openwa/templates/statefulset.yaml@@ -28,6 +28,9 @@ spec:serviceAccountName: {{ include "openwa.serviceAccountName" . }}# The app never calls the Kubernetes API — don't mount a token it can't use.automountServiceAccountToken: false+ # The app reads no Docker-link variables, and a Service named redis or database in the namespace+ # would otherwise set REDIS_PORT or DATABASE_PORT to tcp://<ip>:<port> and fail boot validation.+ enableServiceLinks: false{{- with .Values.podSecurityContext }}securityContext:{{- toYaml . | nindent 8 }}diff --git a/scripts/check-chart-behaviour.mjs b/scripts/check-chart-behaviour.mjsindex 7dd6d9f90..42a96568d 100644--- a/scripts/check-chart-behaviour.mjs+++ b/scripts/check-chart-behaviour.mjs@@ -260,6 +260,21 @@ const check = (id, ok, detail) => results.push({ id, ok, detail }););}+// The kubelet injects Docker-link variables for every Service in the namespace unless the pod opts+// out, so a Service named `redis` or `database` sets REDIS_PORT or DATABASE_PORT to tcp://<ip>:<port>+// and boot validation refuses it. The app reads no service-link variable.+{+ const sts = byKind(render(), 'StatefulSet')[0] ?? '';+ const links = /^\s*enableServiceLinks:\s*(\S+)/m.exec(sts)?.[1];+ check(+ 'no-service-link-env',+ links === 'false',+ links === 'false'+ ? 'enableServiceLinks: false, so no Service in the namespace can set REDIS_PORT or DATABASE_PORT'+ : `${nameOf(sts) ?? 'StatefulSet'}: enableServiceLinks is ${links ?? 'unset (defaults to true)'}, so a Service named redis or database injects REDIS_PORT or DATABASE_PORT`,+ );+}+const failed = results.filter(r => !r.ok);if (failed.length) {console.error('\n✖ Chart behaviour check failed:');