From 38b9a6e8aaffa59eefd18aaea99005a859190fa9 Mon Sep 17 00:00:00 2001 From: Nick Aldwin Date: Tue, 10 Mar 2026 22:16:27 -0400 Subject: [PATCH] Fix TCP keepalive configuration Fix key name inconsistency: the inner guard checked "tcpKeepalives" (plural) while the value rendered `.Values.tcpKeepalive` (singular), causing `keepalive = ` when `tcpKeepalives` was set. Standardize on singular to match Linux convention (`SO_KEEPALIVE`, `tcp_keepalive_time`) and the pgdog TOML key. Also fix commented-out defaults in `values.yaml` and `README.md`: `tcpTime` and `tcpInterval` were in seconds (Linux kernel defaults) but pgdog expects milliseconds. --- README.md | 7 ++++--- templates/config.yaml | 2 +- values.yaml | 9 +++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8d29337..991e37b 100644 --- a/README.md +++ b/README.md @@ -242,13 +242,14 @@ Configure socket-level TCP keep-alive behavior (optional): ```yaml tcpKeepalive: true -tcpTime: 7200 # Time (in seconds) before first keepalive probe -tcpInterval: 75 # Interval (in seconds) between keepalive probes +tcpTime: 7200000 # 2 hours (ms) before first keepalive probe +tcpInterval: 75000 # 75 seconds (ms) between keepalive probes tcpRetries: 9 # Number of keepalive probes before connection is dropped ``` These settings control the TCP keep-alive behavior for database -connections. If not specified, system defaults are used. +connections. All time values are in milliseconds. If not specified, +system defaults are used. ## Contributions diff --git a/templates/config.yaml b/templates/config.yaml index 81c8731..1ea9373 100644 --- a/templates/config.yaml +++ b/templates/config.yaml @@ -239,7 +239,7 @@ data: {{- if or (hasKey .Values "tcpKeepalive") (hasKey .Values "tcpTime") (hasKey .Values "tcpInterval") (hasKey .Values "tcpRetries") }} [tcp] - {{- if hasKey .Values "tcpKeepalives" }} + {{- if hasKey .Values "tcpKeepalive" }} keepalive = {{ .Values.tcpKeepalive }} {{- end }} {{- if hasKey .Values "tcpTime" }} diff --git a/values.yaml b/values.yaml index 0ada9a4..96374dc 100644 --- a/values.yaml +++ b/values.yaml @@ -465,10 +465,11 @@ control: # lsnCheckInterval: 1000 # How frequently to re-fetch replication status # TCP keep-alive configuration (optional) -# These settings control socket-level keep-alive behavior -# tcpKeepalives: true -# tcpTime: 7200 -# tcpInterval: 75 +# These settings control socket-level keep-alive behavior. +# All time values are in milliseconds. +# tcpKeepalive: true +# tcpTime: 7200000 # 2 hours (Linux default: 7200s) +# tcpInterval: 75000 # 75 seconds (Linux default: 75s) # tcpRetries: 9 # Memory configuration (optional)