jobspec: the `Service.Id` field is never used but passes validation
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
The Nomad API service struct includes an [Id field](https://github.com/hashicorp/nomad/blob/2fc19c398d4261c40c996d76fea2ccd77f3086e6/api/services.go#L105) that is never used when [creating a Consul service registration ID](https://github.com/hashicorp/nomad/blob/4a1a14248a7546a7423597ed8259e85d551e8cc1/command/agent/consul/service_client.go#L1432-L1438). This field is not present within the [internal struct representation](https://github.com/hashicorp/nomad/blob/main/nomad/structs/services.go#L425-L470) of a service. Additionally, a job registers successfully when it includes a service that has an `id` parameter defined.
I therefore propose to remove the API field previously indicated, as well as update the jobspec parsing to error when a service definition includes an `id` parameter.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with api/services.go and nomad/structs/services.go, then trace the Consul registration path in command/agent/consul/service_client.go. Done means the unused API field is removed and jobspec parsing rejects service definitions containing an id parameter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100