From d7dd1de24bb6fcc3e8264af44fd034daf0fc2ac2 Mon Sep 17 00:00:00 2001 From: Thomas Svensen Date: Wed, 22 Apr 2026 09:45:39 +0200 Subject: [PATCH] feat: ETU-70853 Make Cloud SQL Proxy term_timeout configurable The -term_timeout flag was hardcoded to 30s. For services that run long-lived jobs (e.g. Netex batch processing), the proxy closes database connections after 30s even though the pod's terminationGracePeriodSeconds allows much longer. This causes in-flight jobs to lose their DB connection mid-run during rolling deployments. Adding postgres.termTimeout allows each chart consumer to set a timeout appropriate for their workload, while keeping 30s as the default. --- charts/common/Chart.yaml | 2 +- charts/common/templates/_helpers.tpl | 2 +- charts/common/values.yaml | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 0141f1c..2a39503 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -80,5 +80,5 @@ description: > type: application -version: 1.21.1 +version: 1.21.2 appVersion: 0.0.1 diff --git a/charts/common/templates/_helpers.tpl b/charts/common/templates/_helpers.tpl index 81e2133..760a4ac 100644 --- a/charts/common/templates/_helpers.tpl +++ b/charts/common/templates/_helpers.tpl @@ -176,7 +176,7 @@ livenessProbe: - "-verbose=false" - "-log_debug_stdout=true" - "-structured_logs=true" - - "-term_timeout=30s" + - "-term_timeout={{ .postgres.termTimeout | default "30s" }}" envFrom: - configMapRef: {{- if .postgres.connectionConfig }} diff --git a/charts/common/values.yaml b/charts/common/values.yaml index 5e5f39a..a6f412e 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -275,6 +275,11 @@ postgres: connectionConfig: # -- Override name for credentials secret. This must at least contain `PGUSER` and `PGPASSWORD`. credentialsSecret: + # -- Override the term_timeout for the Cloud SQL Proxy. Controls how long the proxy waits for + # existing connections to close after receiving SIGTERM before force-closing them. + # Increase this if your app runs long-lived jobs that need the database during pod termination. + # @default -- 30s + termTimeout: configmap: # -- Enable or disable the configmap