Skip to content

feat: lifecycle, extraContainers, shareProcessNamespace, automountServiceAccountToken, service.exposeMetrics - #161

Draft
piotr-reducto wants to merge 1 commit into
pgdogdev:mainfrom
piotr-reducto:feat/pod-extension-points
Draft

piotr-reducto wants to merge 1 commit into
pgdogdev:mainfrom
piotr-reducto:feat/pod-extension-points

Conversation

@piotr-reducto

@piotr-reducto piotr-reducto commented Nov 5, 2026 •

Copy link
Copy Markdown

New pod-level values, so deployments can do these without a post-renderer:

  • lifecycle: replaces the preStop that preStopSleepSeconds renders, e.g. a preStop that waits for clients to leave before the kubelet sends the image's stop signal (SIGINT, PgDog's graceful shutdown).
  • extraContainers: sidecars after pgdog (and prom), e.g. one that sends SIGHUP to reload a renewed TLS certificate.
  • shareProcessNamespace: lets such a sidecar signal pgdog.
  • automountServiceAccountToken: PgDog does not call the Kubernetes API, so the token can be dropped.
  • service.exposeMetrics (default true): false keeps the metrics port off the Service, e.g. off an internet-facing NLB, when pods are scraped directly with a PodMonitor.

Backward compatible. Every test values file renders byte-identical to main at the same chart version. A missing service.exposeMetrics counts as true, so helm upgrade --reuse-values from an older chart keeps the port.

Render-time checks, which only fire when the new keys are set:

  • lifecycle together with preStopSleepSeconds.
  • A lifecycle.preStop without an explicit terminationGracePeriodSeconds. The default grace period is shutdownTimeout + 5s, which would cut a longer preStop short.
  • serviceMonitor.enabled with service.exposeMetrics: false. Not in StatefulSet mode, where the headless Service still carries the port.

values.yaml explains how to combine these safely. With shareProcessNamespace, signal pgdog by name rather than PID 1, which is then the pause container. A sidecar running as pgdog's user can read pgdog's env and files through /proc.

Chart version v0.95 -> v0.96. Tests: test/values-pod-extensions.yaml and a block in test/test.sh. test.sh and configcheck pass locally.

…viceAccountToken, service.exposeMetrics

Lets a deployment replace the preStop (e.g. wait for clients to leave
before the SIGINT stop signal), run a sidecar that signals pgdog (e.g.
SIGHUP on TLS renewal), drop the API token, and keep the metrics port
off a LoadBalancer Service, without a post-renderer.

All opt-in: unset keys render exactly as before. A missing
service.exposeMetrics counts as true, so helm upgrade --reuse-values
keeps the port. The new keys fail the render on contradictions:
lifecycle with preStopSleepSeconds, a lifecycle preStop without an
explicit terminationGracePeriodSeconds, and serviceMonitor with
exposeMetrics false outside StatefulSet mode (where the headless
Service still carries the port).
@piotr-reducto
piotr-reducto force-pushed the feat/pod-extension-points branch from 525345e to 9bc30b4 Compare November 6, 2026 07:50

This branch has not been deployed

No deployments
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.

1 participant