Repository navigation
feat(global-router): add a DynamoDB registration store to the Global Discovery Service - #17691
Conversation
❌ Dynamo PR CI failed — run 41089691909 (attempt 1) on
|
| Other | Jobs |
|---|---|
| changed-files | ❌ 1 |
Failure details
1 job failed: the changed-files filter-coverage check rejected container/global-discovery-service-dynamodb.yaml because no CI filter covers it, so all downstream jobs were skipped.
❌ changed-files: file not covered by any CI filter
Job: changed-files · Failed step: Check for changes · Logs: gh run view --job 124180032015 -R ai-dynamo/dynamo --log-failed
##[error]The following files are not covered by any CI filter:
"container/global-discovery-service-dynamodb.yaml"
Add these paths to .github/filters.yaml. See .github/FILTERS.md.
##[error]Process completed with exit code 1.
The report.py coverage check in .github/actions/changed-files requires every modified file to match a filter in .github/filters.yaml; the new container/global-discovery-service-dynamodb.yaml matches none. Adding that path (or a matching glob) to an appropriate filter in .github/filters.yaml (see .github/FILTERS.md) should clear this; the other 56 jobs were skipped as a result, not run.
For agents
{"pr": 17691, "run_id": 41089691909, "run_attempt": 1, "head_sha": "ca8d3f766517ad945d8272e030f8b7321d067609",
"failures": [{"job": "changed-files", "job_id": 124180032015, "failed_step": "Check for changes", "signature": "File not covered by any CI filter: container/global-discovery-service-dynamodb.yaml (add to .github/filters.yaml)", "tests": [], "log_cmd": "gh run view --job 124180032015 -R ai-dynamo/dynamo --log-failed"}]}Posted automatically by Devin for run 41089691909. Updated on every full-CI run of this PR.
WalkthroughThe change adds a Global Discovery Service with memory, Kubernetes EndpointSlice, and DynamoDB backends. It adds HTTP routes, deployment manifests, operational documentation, and tests. It also adds an HTTP server library with lifecycle, TLS, shutdown, load-reporting, and connection-timeout support. ChangesGlobal Discovery Service
Estimated code review effort: 5 (Critical) | ~120 minutes Pre-merge checks:
|
…Discovery Service Adds `--registration-storage dynamodb` as an alternative to `memory` for `--pool-discovery registrations`. Registrations live in one DynamoDB table that any number of service replicas share, in one region or across regions through a Global Table, so the service survives restarts and lists `complete: true` from its first read. One item per pool key; `register` is one unconditional UpdateItem (last writer wins, as with the memory store); leases are evaluated at read time on the reader's clock with a skew allowance; the TTL attribute is garbage collection only; `list_and_watch` polls the table and diffs. Six new flags under the registrations heading, a `Clock` abstraction for deterministic tests, a conformance suite shared with the memory store, dynamodb-local integration tests gated by GDS_TEST_DYNAMODB_ENDPOINT, a crate README, a design doc, two docs-site pages, an example manifest and code ownership. Relates to #17371 Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Eric Stroczynski <[email protected]>
ca8d3f7 to
4e7eb76
Compare
nnshah1
left a comment
There was a problem hiding this comment.
Approving: this is opt-in behind --registration-storage dynamodb, the memory store stays the default,
and the HTTP contract is unchanged. Thanks for the clock abstraction and the conformance tests.
Six comments inline. F1–F3 (P1/P2) are about what complete: true promises a router; F4–F6 (P3) are
cost and churn issues that should be small to fix. None block merge, but F1 should land before the Global Frontend trusts complete (the pools-as-workers stack in DEP #17638
depends on it). Findings come from reading the code, not from a run against a real table.
Not inline: CI changed-files fails because container/global-discovery-service-dynamodb.yaml is not
in .github/filters.yaml.
atchernych
left a comment
There was a problem hiding this comment.
Requesting changes for one thing: DynamoDB storage has to work with --pool-discovery karmada and mcs too (inline comment). More comments will follow as plain comments, not blocking.
atchernych
left a comment
There was a problem hiding this comment.
The places that tie the DynamoDB flags to --pool-discovery registrations, file by file. They go with the blocking comment on line 26 of the configuration page.
atchernych
left a comment
There was a problem hiding this comment.
Non-blocking findings from a review of 4e7eb76, separate from the DynamoDB-with-Karmada comment. I left out what the F1–F6 comments and CodeRabbit already cover.
- CI hasn't built or tested this code yet.
changed-filesfails because.github/filters.yamldoesn't covercontainer/global-discovery-service-dynamodb.yaml(CodeRabbit's comment on that file), sopre-merge-status-checkfails and rust-tests, clippy and the docs checks were skipped. Thelycheefailure is a dead link in the v1.4.0 release notes, not this PR. - Adding to F3: the readiness probe also keeps the default
timeoutSeconds: 1, so a Query that takes more than a second fails readiness even when it succeeds.
… pool discovery mode The DynamoDB flags were under the `With --pool-discovery registrations` heading, so `parse_args` refused them with `karmada` and `mcs`, and Karmada could not use DynamoDB at all, although `mcs_backend` already builds its store with `registration_storage()`. They now have their own heading, `With --registration-storage dynamodb`, which `parse_args` checks only against the storage. The docs list them in their own section, say the store works in every mode, and show a Karmada example. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
…moDB table check `connect` made DynamoDB calls before the SIGTERM handler was installed, and it can wait up to 300 s for a table that is being created. As PID 1, the process ignored SIGTERM until then, so Kubernetes killed it at the end of the grace period. The handler is now installed first, and startup is raced against it. A short DynamoDB or STS outage at startup also exited the process, leaving the Pod in CrashLoopBackOff after the table was back. `connect` now tells a configuration that cannot work (`ConnectError::Config`, such as no AWS region) from a table that cannot be checked yet (`ConnectError::Table`), and the binary retries the latter with kube's `DefaultBackoff`. Nothing listens until it succeeds, so the Pod stays unready meanwhile. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
`--dynamodb-endpoint dynamodb-local:8000` parsed, with `dynamodb-local` as the URL scheme, and failed only inside the SDK. It now needs an http or https URL, as `--router` does. An empty `--dynamodb-table` or `--dynamodb-region` is a usage error too; an empty region passed the "no AWS region" check. The poll interval check refused setups for a poller that never runs: with `--pool-discovery registrations` the service only lists and registers, and with `--heartbeat-interval-secs 1` no interval passed. It now applies only with `karmada` and `mcs`, whose join with MCS watches the table, and as a usage error from `parse_args` instead of an exit without usage text. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
…able replication lags With a DynamoDB Global Table, each region's replica gets the other regions' writes asynchronously. When replication fell behind by more than the lease and the skew, a service replica saw an old `renewed_at` for a pool that still heartbeated in another region, dropped it as expired, and called the list `Exact`, so a router that trusts `complete` dropped a live pool until replication caught up. Each registration now records the region of the table replica it was written through (`written_in`). A reader keeps a pool written through another region listed for `--dynamodb-replication-grace-secs` (default 60) past its lease and the skew, and lists are `Estimated` while any pool is listed that way, so routers keep it without being told the list is complete. Past the grace the pool is dropped, which bounds how long a pool that really stopped stays listed. A pool written through the reader's own region, or an item written before this change, follows its lease alone. 0 turns the grace off. The design doc no longer says that a registration is at most one heartbeat old across regions. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
Every `GET /pools` paged the whole `pk = "pool"` partition, though each replica already keeps a view of the table that its poller refreshes. Read cost grew with clients times pools instead of replicas times pools per poll interval, and every request was exposed to throttling. `list()` now answers from that view, as the watch does. The first call reads the table and starts the poller, so the table is read only before the first poll. Reads leave out a pool whose lease lapsed since the last poll at once, and say `Estimated` while a call to the table has failed or a pool from another region is listed on trust. A pool registered through another replica shows within a poll interval, and during an outage `GET /pools` keeps answering from the last view, with `complete: false`. Since lists in every mode now come from polls, the poll interval check is the one that keeps a live pool listed between polls, in every mode: poll interval plus heartbeat interval less than lease plus skew. It replaces the check that the poll interval is below the heartbeat interval with `karmada` or `mcs`, and a 1 s heartbeat works again. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
… registrations Several PoolRelays may register one pool, and the last write wins. If their registrations differ, for example in the frontends each relay sees or the capacity it counts, the pool's item switches between their versions at every heartbeat, and every replica's watchers see the pool change at almost every poll. Lists in another order were already the same registration, since `register` sorts and deduplicates them before it hashes. The DynamoDB store now warns, once per pool, when a pool's changes go back to the version before twice in a row, naming the pool, so such relays are easy to find. A single change and its rollback is not flagged. The docs say that the PoolRelays of one pool must send the same registration. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
…kew and grace, and correct the API docs - The pool `Query` uses strongly consistent reads. An eventually consistent read could return an item older than one the replica already had, so a poll could undo a registration this replica just stored, and watchers saw the pool change back and forth. Other regions' writes still arrive by replication. - `--lease-skew-secs` and `--dynamodb-replication-grace-secs` are at most a day. Far larger values added up to the end of time, so a pool that stopped stayed listed for good. - The configuration reference no longer says that every body is JSON (errors are plain text, and `/healthz` has no body), and says what `complete` does not promise. The storage guide says to keep `POST /pools` on a trusted network. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
nnshah1
left a comment
There was a problem hiding this comment.
Approved - assuming threads from others are resolved as well.
…mples Signed-off-by: Sachal Malick <[email protected]>
|
/ok to test 5d144bd |
There was a problem hiding this comment.
This review read head 5d144bd198f387cb612a8ad84422f66c42e3706e. No P0 or P1 found. There are two P3 findings: one inline and one in this body.
- [P3]
.github/filters.yaml:140now says "example manifests", but this head has one example manifest. See the inline comment. - [P3] Seven statements in the PR description do not match this head. Please update them. The list is below.
Open items that are not findings of this review:
- The open thread on
dynamodb.rs:286holds. This review measured it with DynamoDB polls that hang. A tested fix is in a reply on that thread. - The full PR workflow for this head started at 22:17Z, at the request of a maintainer, and is still running.
mainrequires itsbackend-status-check,dynamo-status-checkanddeploy-status-check.
Why each new head of this PR needs a maintainer to start CI.
Commits 4e7eb768ad and 5d144bd198 have no valid GitHub signature (bad_email). For such a PR, copy-pr-bot asks for more validation before CI runs, as its comment of 2026-11-03 says.
The PR description and this head disagree in seven places.
| The description says | This head |
|---|---|
| "this PR targets its branch because the service lives there" | #17371 merged on 2026-11-02, and the base of this PR is main. |
"aws-sdk-dynamodb 1.105.0 and aws-config 1.8.14 (already locked)" |
Only aws-config was in a lock file. aws-sdk-dynamodb 1.105.0 is new in Cargo.lock. "No version bumps" is true. |
"lib 64 passed, bin 10 passed, dynamodb_store 19 passed" |
lib 95, bin 18 and dynamodb_store 21. The counts for http_dynamodb and memory_conformance match. |
"fails at startup with the create-table and update-time-to-live commands" |
The service logs the commands and tries again. Nothing listens until the table exists. |
| "a missing table exits with the create-table commands" | In a test with no table, the process still ran after 6 s and logged 4 retries. |
| "Add flags under the registrations heading" | The flags have their own heading, "With --registration-storage dynamodb". The list leaves out --dynamodb-replication-grace-secs. |
"list is a paginated Query" and "every SDK error maps to DiscoveryError::Unavailable (503)" |
list answers from the view that the poller keeps. A sort key over 1,024 bytes gets 422 (DiscoveryError::Rejected). |
Measured: the open thread on dynamodb.rs:286 holds, and the fix in the reply closes it.
The test used DynamoDB Local 2.6.0 and two replicas of the service. Replica A wrote to DynamoDB Local directly. Replica B read through a TCP proxy. On a signal, the proxy stopped forwarding, so the polls of B hung without an error. A client renewed one pool through replica A every 5 s, and each renewal returned 200. The test read GET /pools from replica B every 0.25 s. In the table, t is the time after the hang started.
| Run | Samples from B with no pools and "complete": true |
B shows "complete": false from |
|---|---|---|
5d144bd198, hang |
11 of 98, t = 12.94 s to 15.59 s | t = 15.85 s |
3f2962e5ed, hang |
3 of 93, t = 15.09 s to 15.65 s | t = 15.93 s |
3f2962e5ed, hang |
11 of 95, t = 12.93 s to 15.69 s | t = 15.97 s |
3f2962e5ed, no hang |
0 of 95. All samples list the pool. | never |
5d144bd198 with the fix, hang |
0 of 99 | t = 13.24 s. The pool lapses at that time. |
Before complete changed, replica B logged operation timeout (all attempts including retries) occurred after 15s.
Measured: dependencies, ownership, tests, CI coverage and a merge with main.
Cargo.lockadds one package,aws-sdk-dynamodb 1.105.0from crates.io. It removes none and changes no version.aws-smithy-types 1.4.4gainsfutures-core,tokioandtokio-utilthrough itsrt-tokiofeature.cargo tree -p dynamo-global-discovery-serviceshows no hyper 0.14 and no rustls 0.21, for normal, build and dev edges on x86_64 and aarch64 Linux. The crate uses hyper 1.10.1 and rustls 0.23.45. As a control, the whole workspace with--all-featuresdoes show hyper 0.14.32, throughreqwest 0.11.27.cargo metadata --lockedpasses in.,lib/bindings/python,lib/runtime/examplesandlib/bindings/kvbmon this head.cargo deny checkwith all checks and--all-featuresgives the same 113 diagnostics on this head and on the merge base23ff72cdac.cargo machetefinds no unused dependency. A planted unused dependency in this crate was found, so the tool covers it.CODEOWNERSandCONTRIBUTORS.mdregenerate byte for byte, andbuild_codeowners.py --strictpasses. The two new docs pages belong todynamo-global-router-codeowners.- All suites pass against DynamoDB Local 2.6.0 and 3.3.2: lib 95, bin 18,
dynamodb_store21,http_dynamodb1 andmemory_conformance8. The merge base has lib 61 and bin 12. - In CI on the previous head,
rust-tests (.)randynamodb_storeandhttp_dynamodbin skip mode, in 0.06 s and 0.01 s. No CI job setsGDS_TEST_DYNAMODB_ENDPOINT. - Two deliberate breaks each fail tests. With no escape for
\inkeys.rs, 5 lib tests anddistinct_keys_are_distinct_poolsfail. With no skew incodec::live_until_ms, 2 lib tests anda_pool_expires_once_the_lease_and_the_skew_have_passedfail. - A merge with
mainat4ff9539ed9has no conflict. The merged crate builds, and all suites pass against DynamoDB Local 2.6.0. In that merge,cargo metadata --lockedfails only inlib/bindings/kvbm, with the same error as onmainalone. - A merge with
mainat29cb457e02also has no conflict. Its only new commit changes 4 files underlib/mocker/servers, which this crate does not use. - The docs grant
dynamodb:Query,dynamodb:UpdateItemanddynamodb:DescribeTableon one table ARN. The startup check uses only these three actions.
Not measured.
- Real AWS: Global Table replication and IAM. DynamoDB Local ignores IAM, so the startup write check ran only against DynamoDB Local 2.6.0 and 3.3.2.
- The image from
container/Dockerfile.global-discovery-service. - The result of the full PR workflow, which is still running.
…ynamoDB polls A replica sees renewals made through other replicas only at its next poll. While a poll hangs, a pool can lapse in the replica's view although it still renews elsewhere, and the list dropped it while still saying `complete: true`. The list is now `Estimated` while the view holds a pool that lapsed since the last poll, and complete again once a poll shows the pool was not renewed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
The DynamoDB example manifest is gone, so the comment goes back to the singular "manifest", and this change no longer touches the file. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
|
/ok to test cb3d328 |
Picks up #18140, which fixes the dynamo-llm test build on main, so the pre-merge checks can pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
|
/ok to test e883df3 |
Fifth upstream merge for the split v2 PR: the four commits past 20c5f11, no conflicts, no router-owned path. - ai-dynamo#18116 pass plugin selectors to the transcription router: lib/llm/src/discovery/watcher.rs (auto-merged). - ai-dynamo#17691 DynamoDB registration store for the Global Discovery Service: lib/global-discovery-service, root Cargo.toml workspace deps, Cargo.lock. - ai-dynamo#16288 deployment diagnostics tests, ai-dynamo#16723 helm KAI queue wait: outside the router. Signed-off-by: Ishan Dhanani <[email protected]>
Two conflicts, both from main's DynamoDB registration store for the Global Discovery Service (#17691), which added the same AWS SDK workspace dependencies this branch had. Cargo.toml: main's declarations are taken. They pin lower minimum versions than this branch did and turn off aws-sdk-dynamodb's default features, which pulled in a legacy hyper 0.14 and rustls 0.21 client. Both DynamoDB stores now share one SDK and one HTTPS client. Cargo.lock: main's lock, with Cargo adding only this branch's crate and its dependencies; no locked version differs from main. The AWS SDK crates therefore move to main's versions, and the legacy client's packages leave the lock. The router, DynamoDB store and frontend tests pass against these versions, and clippy is clean. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Sachal Malick <[email protected]>
Brings in the DynamoDB registration store (#17691). Fixes the merge needed beyond the conflicts: - The store choice returns what the backend uses from it, and the memory store also as the exchange that --peer-service shares, since the choice now returns trait objects. - --peer-service with --registration-storage dynamodb is now possible to ask for, and is refused as a usage error; a test covers it. - Readiness keeps main's rule, answering OK without the backend once both directories have answered, and still waits for an instance that shares registrations to ask the others first. - DiscoveryError gained a Rejected variant, so a failed ask maps every variant to its cause. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
vCluster runs one virtual cluster per host namespace. The first run on this PR created the hub, then stopped at the member: "creating multiple virtual clusters inside the same namespace is not supported". The hub and the member now get host namespaces of their own, and the cleanup job deletes both with teardown-dynamo-operator. The README's local commands do the same. The three jobs limit GITHUB_TOKEN to contents: read; CodeQL flagged the pr.yaml copy of the build job, which had no permissions block. With DynamoDB registration storage on main (#17691), the README lists that case as next rather than waiting on the service. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anna Tchernych <[email protected]>
Overview
Adds
--registration-storage dynamodbto the Global Discovery Service as an alternative tomemoryfor--pool-discovery registrations. Registrations live in one DynamoDB table that any number of service replicas share, in one region or across regions through a Global Table. The service survives restarts, every replica serves the same pool list, andGET /poolsreportscomplete: truefrom the first read, sinceCompleteness::Exactis defined as "read from a shared store".The HTTP contract does not change.
POST /poolsstill answers the configuredLease,GET /poolslists live pools,GET /routerscomes from--router. The memory store stays the default.Design:
lib/global-discovery-service/docs/dynamodb-store.md.Key Changes
backends::dynamodb::DynamoDbPoolStoreimplementingPoolRegistrarandDirectory<PoolListing, PoolKey>: one item per pool key (pk = "pool",sk = <cluster>#<namespace>#<dgd>with\#and\\escaping);registeris one unconditionalUpdateItem(last writer wins, as with the memory store);listis a paginatedQuerythat drops expired items at read time on the reader's clock with--lease-skew-secs;list_and_watchpolls the table and diffs, with local writes published immediately; every SDK error maps toDiscoveryError::Unavailable(503).backends::clock::{Clock, SystemClock, ManualClock}so lease expiry is testable without wall-clock waits.--dynamodb-table,--dynamodb-region,--dynamodb-endpoint,--dynamodb-poll-interval-secs(default 2),--dynamodb-ensure-table,--lease-skew-secs(default 2). They are rejected with the memory store; the poll interval must be below the heartbeat; a missing table without--dynamodb-ensure-tablefails at startup with thecreate-tableandupdate-time-to-livecommands to run.expires_atis garbage collection only (last renewal plus 7 days); the lease is never expired by the store.aws-sdk-dynamodb 1.105.0andaws-config 1.8.14(already locked) as workspace dependencies, withdefault-features = falseand the smithy default HTTPS client to avoid the legacy hyper 0.14 and rustls 0.21 path;blake3for the change hash;serde_jsonmoves from dev-dependencies to dependencies. No version bumps inCargo.lock.tests/common,tests/memory_conformance.rs); dynamodb-local integration tests (tests/dynamodb_store.rs,tests/http_dynamodb.rs) gated byGDS_TEST_DYNAMODB_ENDPOINTagainst an existing DynamoDB Local instance; unit tests for key escaping, codec, liveness and the CLI.README.md; docs-site pageskubernetes/kv-aware-routing/global-discovery-service-storage.md(table creation, IAM, deployment, operations) andreference/components/global-discovery-service-configuration.md(every flag, endpoints, item layout); code ownership underglobal-router.Validation
In the pinned
rust:1.96.1-trixieimage (the crate's dependency tree does not build natively on macOS):cargo fmt --check,cargo clippy --tests -D warnings: clean.cargo test -p dynamo-global-discovery-servicewith dynamodb-local: lib 64 passed, bin 10 passed,dynamodb_store19 passed,http_dynamodb1 passed,memory_conformance8 passed. Without the endpoint variable the DynamoDB suites skip and report why.--dynamodb-ensure-tablecreates it;POST /poolson replica A thenGET /poolson replica B returns the pool withcomplete: true;/healthz200.docs_lint.py0 errors,fern check0 errors,fern docs broken-linkspasses;build_codeowners.py --strict100 percent owned,emit_codeowners.pyno drift.Not run: the GitHub workflow jobs (needs a maintainer's
/ok to test <sha>), and a real AWS Global Table (the multi-region behaviour is argued in the design doc from DynamoDB's documented last-writer-wins; the integration tests cover one dynamodb-local).Issues and Ongoing Work
list_and_watchconsumer needs sub-second fan-out.Pull Request Checklist
/pr-checklistskill.🤖 Generated with Claude Code
Summary by CodeRabbit