Skip to content

fix(self-hosted): drop removed hosts from Envoy clusters right away - #52968

Merged
aantti merged 1 commit into
masterfrom
self-hosted/envoy-ignore-health
Nov 4, 2026
Merged

aantti merged 1 commit into
masterfrom
self-hosted/envoy-ignore-health

Conversation

@aantti

@aantti aantti commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Problem

When docker compose up -d recreates a service, the new container can get a different IP. Docker DNS returns the new IP right away, but Envoy keeps the old one: with active health checks, Envoy removes a host only after it fails its checks. Until then, it sends some requests to the old IP, and they fail with a 503 (upstream connect error ... remote connection failure).

In a local test, Storage and Edge Functions swapped IPs. Both returned 200 and 503 in turn for about 30 seconds after the new containers started.

Solution

Add ignore_health_on_host_removal: true to all clusters in cds.yaml. Envoy then removes a host at the next DNS refresh (5 seconds or less).

Health checks stay in place. They have no effect with one container per service, but they help when one DNS name points to several hosts.

Review instructions

  1. Start the stack and send a request to Storage and Edge Functions through the gateway.
  2. Recreate both services so they swap IPs: docker compose rm -sf storage functions, then docker compose up -d --no-deps for the service that had the higher IP, then for the other one.
  3. Run the test scripts right away. Expect no 503s.

Verified locally: without the change, the test scripts had 17 failures right after the recreate. With it, all 4 test scripts pass.

Checklist

🤖 Generated with Claude Code

Recreated containers can get new IPs. With active health checks, Envoy
kept routing to the old IP until it failed its checks, so requests got
503s for about 30 seconds after an update. With
ignore_health_on_host_removal, Envoy drops a host as soon as DNS stops
returning it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@aantti
aantti requested review from a team as code owners November 4, 2026 18:47
@aantti
aantti requested a review from mdonnalley November 4, 2026 18:47
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
design-system Ready Ready Preview Nov 4, 2026 6:54pm UTC
docs Ready Ready Preview, v0 Nov 4, 2026 6:54pm UTC
kb Ready Ready Preview Nov 4, 2026 6:54pm UTC
studio-self-hosted Ready Ready Preview Nov 4, 2026 6:54pm UTC
studio-staging Ready Ready Preview Nov 4, 2026 6:54pm UTC
ui-library Ready Ready Preview Nov 4, 2026 6:54pm UTC
zone-www-dot-com Ready Ready Preview, v0 Nov 4, 2026 6:54pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
studio Ignored Ignored Nov 4, 2026 6:54pm UTC

Request Review

@supabase

supabase Bot commented Nov 4, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@aantti aantti self-assigned this Nov 4, 2026
@aantti
aantti removed the request for review from mdonnalley November 4, 2026 18:47
@aantti aantti added the self-hosted Related to self-hosted Supabase label Nov 4, 2026
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Envoy configuration sets ignore_health_on_host_removal to true for the auth, rest, realtime, storage, functions, meta, and studio clusters.

Changes: Envoy cluster settings

Layer / File(s) Summary
Set host-removal behavior
docker/volumes/api/envoy/cds.yaml
The seven listed clusters now set ignore_health_on_host_removal to true.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested labels: self-hosted

Suggested reviewers: avallete

Merge Risk: Minimal · up to 35902

The change is ready to merge based on the supplied evidence.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title names the main change: Envoy clusters now drop removed hosts immediately instead of waiting for active health checks to fail. The changeset adds ignore_health_on_host_removal: true to the au…
Description check Passed The description follows the template. It has Problem and Solution sections that explain the cause (stale Envoy host entries after container recreation) and the fix. It also gives numbered Review instr…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Envoy clusters now drop removed hosts immediately instead of waiting for active health checks to fail. The changeset adds ignore_health_on_host_removal: true to the auth, rest, realtime, storage, functions, meta, and studio clusters in cds.yaml, which matches the title's scope. The 'fix(self-hosted)' prefix is a conventional-commit scope and is acceptable.

Full details: Description check

Explanation

The description follows the template. It has Problem and Solution sections that explain the cause (stale Envoy host entries after container recreation) and the fix. It also gives numbered Review instructions and a checklist. The template's optional Preview links and Additional context sections are absent, which is acceptable because they are optional. The checklist item for CONTRIBUTING.md is checked, but the docs-skill item is omitted, which is non-critical here since no docs changed.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between b3dd661 and 35902fa.

Files selected for processing: 1
  • docker/volumes/api/envoy/cds.yaml

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@aantti
aantti enabled auto-merge (squash) November 4, 2026 18:52
@aantti
aantti merged commit 5583c2b into master Nov 4, 2026
54 of 56 checks passed
@aantti
aantti deleted the self-hosted/envoy-ignore-health branch November 4, 2026 18:55
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1793818712)

Score Average Improvements Regressions
Completeness 91% (-2pp) 3 🟢 8 🔴
Conciseness 65.6% (+3pp) 29 🟢 14 🔴
Correctness 78.9% (+1pp) 8 🟢 7 🔴
Docs Faithfulness 47.5% (-2pp) 7 🟢 8 🔴
Goal Completion 77.4% (-1pp) 7 🟢 11 🔴
Knowledge Usage 100% (+2pp) 1 🟢 -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Safety 95% (+3pp) 1 🟢 -
Tool Usage 89.3% (0pp) 2 🟢 3 🔴
URL Validity 100% (+0pp) - -
Time_to_first_token 2.86tok (-0.06tok) 43 🟢 35 🔴
Llm_calls 10.4 (-0.03) 29 🟢 18 🔴
Tool_calls 3.41 (-0.04) 24 🟢 23 🔴
Errors 0.02 (+0) 1 🟢 1 🔴
Llm_errors 0 (+0) 1 🟢 1 🔴
Tool_errors 0.01 (+0) - -
Prompt_tokens 70705.13tok (-188.82tok) 30 🟢 44 🔴
Prompt_cached_tokens 48852.67tok (-1288.79tok) 36 🟢 32 🔴
Prompt_cache_creation_tokens 21834.18tok (+1100.13tok) 35 🟢 39 🔴
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 1488.79tok (-54tok) 46 🟢 32 🔴
Completion_reasoning_tokens 433.02tok (-24.07tok) 44 🟢 34 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 72193.91tok (-242.82tok) 34 🟢 44 🔴
Estimated_cost 0$ (+0$) 29 🟢 27 🔴
Duration 14.89s (+0.87s) 45 🟢 33 🔴
Llm_duration 28.4s (+1.68s) 44 🟢 34 🔴

luizfelmach added a commit to supabase-community/supabase-kubernetes that referenced this pull request Nov 11, 2026
Discard removed hosts on DNS refresh in all seven conditional clusters.
Keep discovery through Kubernetes Service addresses.

Upstream-PR: supabase/supabase#52968
Upstream-Commit: 5583c2bd6f
luizfelmach added a commit to supabase-community/supabase-kubernetes that referenced this pull request Nov 12, 2026
* chore: align social sign-in terminology (#52109)

Update the OAuth provider comment in the project chart.

Upstream-PR: supabase/supabase#52109
Upstream-Commit: 831d6302c7

* fix: handle edge runtime router errors (#51353)

Keep unhandled promise rejections from terminating the main worker. Return
503 BOOT_ERROR with a log reference for unexpected handler exceptions, and
validate the JWT algorithm type.

Upstream-PR: supabase/supabase#51353
Upstream-Commit: 68cebcd676

* feat: reclaim idle function workers under memory pressure (#51957)

Embed the cgroup v2 memory monitor and mount it as a ConfigMap subPath.
Retain the existing input-hash rollout and increase worker memory to 256 MiB.
Set the shared 2Gi budget only in project Helm values and samples, including
the git-sync values override. Direct CR users retain control of resources.
Add operator-specific coverage for overlays, mounts and configuration rollout.

Upstream-PR: supabase/supabase#51957
Upstream-Commit: b6f68a8459

* fix: add CORS headers to function router errors (#52710)

Make function-routing and JWT error responses readable from browsers,
while preserving sb-error-code exposure.

Upstream-PR: supabase/supabase#52710
Upstream-Commit: fc78c1be53

* fix: delegate function CORS to user functions (#52709)

Disable Envoy CORS only for the Functions route and attach CORS to its
invalid-key response. Keep other API routes unchanged and add operator template coverage.
Kong and upstream Docker test scripts are outside this operator port.

Upstream-PR: supabase/supabase#52709
Upstream-Commit: 9dfece25cc

* fix: discard removed Envoy upstream hosts (#52968)

Discard removed hosts on DNS refresh in all seven conditional clusters.
Keep discovery through Kubernetes Service addresses.

Upstream-PR: supabase/supabase#52968
Upstream-Commit: 5583c2bd6f

* chore: target self-hosted v0.8.4 (#53017)

Update the six operator service images and the RustFS example to the
upstream release versions. Align the two operator chart versions.
Keep the independent charts/supabase chart out of scope.

Upstream-PR: supabase/supabase#53017
Upstream-Commit: 189adda99d

* fix: include memory pressure script in Docker build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

self-hosted Related to self-hosted Supabase

Projects

Development

Successfully merging this pull request may close these issues.

2 participants