Skip to content

Add HTTP ingress drain control#5094

Draft
pcholakov wants to merge 2 commits into
mainfrom
codex/ingress-prestop-drain
Draft

Add HTTP ingress drain control#5094
pcholakov wants to merge 2 commits into
mainfrom
codex/ingress-prestop-drain

Conversation

@pcholakov

@pcholakov pcholakov commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Why\n\nToday, HTTP ingress begins graceful shutdown only after the Restate Server process receives SIGTERM. It closes its listeners and asks existing HTTP/2 connections to stop accepting new work, but the normal shutdown path has a five-second final drain deadline. Long-running streams that remain at that point are force-cancelled.\n\nFor a rolling update, that makes the pod termination window do two jobs at once: diverting new traffic and waiting for old traffic. Under load, there may not be enough time for both.\n\n## What changes\n\nThis PR adds an explicit, runtime-local HTTP ingress drain operation. A future Kubernetes preStop hook can call it before allowing process termination:\n\n\n\nThe operation:\n\n1. Stops accepting new HTTP ingress connections/streams.\n2. Gracefully shuts down existing HTTP connections (including HTTP/2 GOAWAY behavior).\n3. Reports progress, including active requests and connections.\n4. Leaves the server process and ingress role running while existing connection work drains.\n\nThe preStop integration can therefore wait for within its own budget, and only then let SIGTERM begin the existing shutdown path. SIGTERM still retains the five-second force-cancellation deadline as the final safety net.\n\nThis does not migrate an already-running stream. Streams that outlive the eventual termination budget still need retry handling.\n\n## Safety and operator behavior\n\n- The drain state is local to the running process, monotonic (), and does not write cluster metadata.\n- requires ; it calls on that same local channel and uses the returned exact generational node ID for the drain RPC.\n- The generation fence prevents a delayed request from draining a restarted process with the same plain node ID.\n- remains available for explicitly targeted operator use.\n\n## Validation\n\n- \n- \n- \n- \n-

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

Test Results

  8 files  ±0    8 suites  ±0   4m 49s ⏱️ +3s
 61 tests ±0   61 ✅ ±0  0 💤 ±0  0 ❌ ±0 
268 runs  ±0  268 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 9f2743e. ± Comparison against base commit 778805e.

♻️ This comment has been updated with latest results.

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