Skip to content

Resend gateway config before re-registering services - #4388

Open
vitostrokov wants to merge 1 commit into
dstackai:masterfrom
vitostrokov:issue_4385_gateway_config_on_reregister
Open

vitostrokov wants to merge 1 commit into
dstackai:masterfrom
vitostrokov:issue_4385_gateway_config_on_reregister

Conversation

@vitostrokov

Copy link
Copy Markdown

Fixes #4385

When a gateway loses its state, for example after a Kubernetes gateway container restarts on a
fresh filesystem, the running-replica sync registers its services again but never resends the
global config. certbot then requests their certificates from its default ACME server instead of
DSTACK_ACME_SERVER, without the EAB credentials.

The sync now calls submit_gateway_config() before registering services, only on ticks that
register something. If the call fails, the tick skips the sync and retries on the next one,
rather than request a certificate from the wrong server.

Testing:

  • uv run pytest src/tests/_internal/server/background/pipeline_tasks/test_gateway_replicas.py:
    74 passed, 74 skipped (the skipped ones are the Postgres variants, run with --runpostgres).
  • test_registers_new_service_and_replica now checks that the config is submitted before
    register_service.
  • test_no_gateway_calls_when_state_already_in_sync now checks that no config is submitted
    when there is nothing to register.
  • The new test_skips_registration_if_gateway_config_not_submitted covers the failure path.
  • Without the fix, 2 of these fail.
  • uv run ruff check and uv run ruff format --check on the changed files: clean.

🤖 Generated with Claude Code

The running gateway replica pipeline re-registers services after a
gateway loses its state, e.g. when the gateway is reinstalled, but it
never resends the global config. Certificates for the re-registered
services are then requested from certbot's default ACME server instead
of the configured one (staging, or an EAB CA). Only a server restart
resent the config, through init_gateways.

Submit the config before any service registration. The call is
idempotent and happens only on ticks that register services. If it
fails, skip the sync until the next tick rather than issue a
certificate from the wrong server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@peterschmidt85
peterschmidt85 requested a review from jvstme October 18, 2026 08:15
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.

[Bug]: Re-registered services ignore DSTACK_ACME_SERVER after a gateway loses its state

1 participant