Skip to content

feat: support externalTrafficPolicy / internalTrafficPolicy on the Service#117

Merged
levkk merged 1 commit into
pgdogdev:mainfrom
osiris-ratings:external-traffic-policy
Jul 8, 2026
Merged

feat: support externalTrafficPolicy / internalTrafficPolicy on the Service#117
levkk merged 1 commit into
pgdogdev:mainfrom
osiris-ratings:external-traffic-policy

Conversation

@hydeta

@hydeta hydeta commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What

Adds two optional values to the Service, rendered only when set (same pattern as trafficDistribution):

  • service.externalTrafficPolicyCluster or Local
  • service.internalTrafficPolicyCluster or Local

Also adds test/values-traffic-policy.yaml, which the existing test/test.sh loop picks up; the full suite passes with strict kubeconform validation.

Why

When pgdog is exposed through a LoadBalancer Service, the default externalTrafficPolicy: Cluster makes every cluster node an LB backend, with kube-proxy relaying connections that land on pod-less nodes. For a connection pooler holding long-lived Postgres sessions this puts every node in the cluster on the data path: we run pgdog on GKE Autopilot, where routine node recycling was killing established client connections relayed through unrelated dying nodes (ConnectionDoesNotExistError on long-held sessions, ConnectionRefusedError against booting/draining nodes), while pgdog itself was healthy with clean logs.

externalTrafficPolicy: Local restricts LB backends to the nodes actually running pgdog pods, taking unrelated node churn off the data path (and preserving client source IPs). The chart currently offers no way to set it, so we were patching the Service after every helm upgrade. internalTrafficPolicy is included as the natural sibling for in-cluster clients.

Both fields default to empty, so existing rendered output is unchanged unless a user opts in.

…rvice

Adds optional service.externalTrafficPolicy and
service.internalTrafficPolicy values, rendered only when set (mirroring
trafficDistribution). externalTrafficPolicy: Local restricts LoadBalancer
backends to nodes running pgdog pods, which keeps unrelated node churn
(e.g. GKE Autopilot node recycling) off the pooler's data path and
preserves client source IPs.

Includes a test values file exercising both fields.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DHReZbtuSyGsAh3cskY6Tq

@levkk levkk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you very much!

@levkk levkk merged commit c46e7c0 into pgdogdev:main Jul 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants