nomad
nomad copied to clipboard
cli: `service info` command returns incorrect services in output
Nomad version
$ nomad version
Nomad v1.7.3-dev
BuildDate 2023-12-19T11:17:48Z
Revision b2f640346d7609057ab55a0037c23ad5f5edfb68
Issue
The service info command returns incorrect results when attempting to perform a simple service lookup within a particular namespace.
The list output correctly lists two services registered:
$ nomad service list
Service Name Tags
grafana-server []
prometheus-server []
When I go to lookup the grafana-server service I get the following result:
$ nomad service info grafana-server
Job ID Address Tags Node ID Alloc ID
prometheus-server 192.168.108.13:24057 [] fc18ed18 04499ded
The API is returning the correct data, so this is a problem with the command.
$ nomad operator api /v1/service/grafana-server | jq
[
{
"Address": "192.168.108.13",
"AllocID": "8fe15d39-cd9d-cbdb-ca31-d795b4f4ca78",
"CreateIndex": 188,
"Datacenter": "kent",
"ID": "_nomad-task-8fe15d39-cd9d-cbdb-ca31-d795b4f4ca78-group-server-grafana-server-grafana",
"JobID": "grafana-server",
"ModifyIndex": 188,
"Namespace": "default",
"NodeID": "fc18ed18-d4ef-115c-17f5-43e4e48c37a8",
"Port": 22138,
"ServiceName": "grafana-server",
"Tags": []
}
]
It seems the bug was introduced within https://github.com/hashicorp/nomad/pull/18836
I can see this in 1.7.2 as well. The nomad templates are also quite messed up similar to https://github.com/hashicorp/nomad/issues/16616
Hi @blmhemu; as far as this stated issue goes, it only affects the CLI and the linked issue is a separate, non-related bug.
I understand, but i could not repro #16616 on 1.6, only on 1.7.(2) (Let me know if I should raise another issue)
Also, I assumed templates use the data published by the API and if the API provides wrong info, may be the templates are rendedered with wrong info.
Seeing this with the 1.7.5 CLI too:
Nomad v1.7.5
BuildDate 2024-02-13T15:10:13Z
Revision 5f5d4646198d09b8f4f6cb90fb5d50b53fa328b8
> nomad service list
Service Name Tags
caddy [ingress]
noutaja []
otel-collector [otel]
> nomad service info otel-collector
Job ID Address Tags Node ID Alloc ID
caddy 192.168.1.128:443 [ingress] 06289a2e c7c2a24f
> nomad service info otel-collector
Job ID Address Tags Node ID Alloc ID
noutaja 192.168.1.128:5959 [] 06289a2e 8b8d5f7b
Still relevant^, had me wondering where did I go wrong. @jrasell are you working on this? otherwise I think I can pick this up?
+1 on this, it's a bad issue that seems to have been included in one of the recent releases. breaks our workflow...
Still present in 1.8.1, just ran into this
I was taking a look into this testing with main locally and was unable to reproduce it. When looking at the code I realised PR https://github.com/hashicorp/nomad/pull/23502 was merged and released as part of 1.8.2 and 1.7.10+ent and is within the 1.9.x release cycle.
I am therefore going to close this issue as complete. If you still come across this in a version after those detailed above, please reopen this or raise a new issue. Thanks.
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.