Repository navigation
spike(proxy): Envoy hot-restart — 3 upgrade strategies + Strategy A impl - #104
Merged
Merged
Conversation
Spike groundwork for hot-restarting the aether-proxy Envoy without dropping connections (bootstrap-config changes and binary upgrades). See docs/proposals/001_proxy-hot-restart.md for the full plan, constraints (shared /dev/shm + base-id IPC -> supervisor owns both epochs in one container) and validation/exit criteria. - docs/proposals/001_proxy-hot-restart.md: spike plan. - agent/internal/proxy/hotrestart: supervisor scaffold replicating hot-restarter.py in Go (epoch fork/exec, SIGHUP hot restart, SIGUSR1 forward, parent-shutdown timer, newest-epoch-death-is-fatal). fsnotify config-watch trigger and graceful-terminate deadline are left as TODOs. - agent proxy-supervisor cobra subcommand wiring it into the agent binary. Builds and existing cmd tests pass; not yet wired into the chart. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Expands the hot-restart proposal to compare three deployment/upgrade strategies and commits to: spike A (in-place Envoy hot restart, no pod replacement) first, target B (cross-pod surge upgrade) as the goal, C (dual-Envoy pod + operator) as the future end state. Strategy A implementation: - hotrestart supervisor: fsnotify bootstrap-config watch (debounced) that self-triggers a hot restart, plus graceful shutdown with a drain deadline and SIGKILL fallback. SIGHUP/SIGUSR1 handling and newest-epoch-death-fatal as before. - proxy-supervisor --install-path: the static supervisor self-copies onto a shared volume from an initContainer, so the runtime container can stay the Envoy image (which carries Envoy + its shared libs) with the supervisor injected alongside. - chart: proxy.hotRestart.enabled gate (off by default) wires the supervisor as the proxy entrypoint, the self-install initContainer, a memory /dev/shm emptyDir, and routes Envoy service flags through --envoy-arg. - tests: buildEnvoyCmd args + a lifecycle test driving a stub Envoy through a config-change-triggered hot restart and a clean shutdown. Builds, unit tests, and `helm template` (both gate states) pass. Not yet deployed; talos-main validation (zero-drop + stat continuity) is the next step. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hot-restart the aether-proxy Envoy so bootstrap-config changes and image upgrades preserve in-flight connections (dynamic listeners/clusters/endpoints already update live via xDS — hot restart is specifically for the static bootstrap + binary).
Full design:
docs/proposals/001_proxy-hot-restart.md.Core constraint
Hot restart hands off listen-socket FDs + stats from epoch N → N+1 via a shared
/dev/shm(--base-id) and an abstract domain socket in a shared netns. A vanilla image bump deletes/recreates the Pod and shares neither — so each strategy is a different way to arrange that overlap. The existinghostNetwork: truealready gives shared netns for free.Three strategies (documented + compared)
maxSurge)OnDelete)Strategy A — implemented in this PR
agent/internal/proxy/hotrestart): forks Envoy per restart epoch; fsnotify bootstrap-config watch (debounced) self-triggers a hot restart; SIGHUP/SIGUSR1; newest-epoch-death → exit non-zero (k8s recreates pod); graceful shutdown with drain deadline + SIGKILL fallback.agent proxy-supervisorsubcommand, plus--install-pathso the static supervisor self-copies onto a shared volume from an initContainer — the runtime container stays the Envoy image (which carries Envoy + its shared libs) with the supervisor injected.proxy.hotRestart.enabledgate (off by default) wires the supervisor entrypoint, the self-install initContainer, a memory/dev/shmemptyDir, and routes Envoy service flags via--envoy-arg.buildEnvoyCmdargs + a lifecycle test driving a stub Envoy through a config-change-triggered hot restart and clean shutdown.Not in this PR (next steps)
hot_restart_generation, zero dropped connections, stat continuity.maxSurgeDaemonSet, hostPath/dev/shm,/run/aether/hotrestart/epochcoordination (+ live-predecessor probe → epoch-0 reset), readiness gate.Test plan
bazel build //agent/...✅bazel test //agent/internal/proxy/hotrestart/... //agent/internal/cmd/...✅helm templaterenders both gate states correctly (off = unchanged direct-Envoy; on = supervisor + initContainer + /dev/shm) ✅🤖 Generated with Claude Code