feat(api): discover orchestrators via nomad service#3176
Conversation
PR SummaryMedium Risk Overview Reviewed by Cursor Bugbot for commit 4c073c2. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Code Review
The error check !errors.As(err, &sde) in the deferred wait block will always evaluate to false when a service fails because startService always returns a serviceDoneError regardless of whether the service function f() succeeded or failed. This causes all service failures to be silently ignored, and the orchestrator will incorrectly exit with a success status instead of failing.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c82c8df518
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
46e04d9 to
750ab19
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
750ab19 to
37a7881
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
37a7881 to
fddf68c
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…llback Discover orchestrators by listing registrations of Nomad-native services (GET /v1/service/<name> per configured name, unioned and deduped by node; names configurable via NOMAD_ORCHESTRATOR_SERVICE_NAMES, default "orchestrator") instead of listing ready Nomad nodes in the hardcoded "default" pool. Service discovery is node-pool- and job-agnostic, which is required while orchestrators migrate to the health-gated service job on the dedicated "orchestrator" pool. ShortID stays the truncated Nomad node ID, so node identity is stable across the backend switch. Already-running orchestrators were deployed from a jobspec that registers the service with an empty Address, so service discovery alone would miss them until redeployed. To avoid that rollout ordering constraint, the old node-pool listing is kept as a fallback and unioned with service discovery: dedup is by ShortID with service entries winning (they carry the real bound port), and a failure of either backend fails the whole listing rather than silently degrading to a subset of nodes. The fallback also keeps draining nodes (still Status=="ready") discoverable after their services deregister. The fallback is on by default; set NOMAD_ORCHESTRATOR_LEGACY_DISCOVERY_ENABLED=false once no legacy jobs remain.
fddf68c to
4c073c2
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Switch discovery to use nomad's service discovery instead of blindly checking every node in the default nodepool. Lets us use multiple nodepools for cutting over orchestrator from system jobs to service jobs.
Existing orchestrator-ee system job already registers to the service.