[feature] Expose interpolated service names for allocations
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Issue
I'm dealing with a use case that requires each task to register an own service with names that contain nomad env vars like `${NOMAD_ALLOC_INDEX}`. Output of `curl nomad:4646/v1/job/` contains raw job description and therefore only raw service definitions with template vars in service names - which is reasonable. Output of `nomad alloc-status -json ` contains the field `Services` with `null` as value.
### Solution
It would be great to expose service names via `job status` or at least via `alloc status`. Currently I see no possibility to programmatically get the service names for a specific nomad job besides having to tag services with job-id and query consul for that.
### Implementation
AFAIK `TaskRunner` handles/triggers `Update` and `Poststart` hooks which itself evaluate service names and handle consul service registration. `TaskRunner` is capable of talking to `stateDB`, so we can update the allocation after service registration.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing TaskRunner's Update and Poststart hooks, where service names are evaluated and registered, then follow how stateDB persists allocation status. Compare the alloc-status and job status output paths. Done means interpolated service names are exposed programmatically for the relevant allocation or job after service registration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100