-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consul >= 1.3.0 doesn't filter services by tags / returns an empty array #5179
Comments
Any help?) |
@sofarsog00d could you provide your service definition ? |
@Aestek sure root@server1:~# cat /etc/consul.d/env1-service_name.json
{
"service": {
"id": "env1-service_name",
"name": "service_name",
"tags": ["env1","5.0.2"],
"address": "11.11.11.11",
"port": 22222,
"check": {
"http": "http://11.11.11.11:22222",
"interval": "10s",
"timeout": "2s"
}
}
} |
@sofarsog00d can you post the results of the query without the tag parameter? Could be related to #4717. |
consul 1.2.4 root@node1:~# curl -X GET 'http://localhost:8500/v1/catalog/service/service?tag=env1'
[{"ID":"7h4973f4h-3233-f37h-5555-666683625f46","Node":"node1",
"Address":"11.11.11.111","Datacenter":"dc-1","TaggedAddresses":{"lan":"11.11.11.111",
"wan":"11.11.11.111"},"NodeMeta":{"consul-network-segment":""},
"ServiceKind":"","ServiceID":"env1-service","ServiceName":"service",
"ServiceTags":["env1","5.8.1"],"ServiceAddress":"11.11.11.111",
"ServiceWeights":{"Passing":0,"Warning":0},"ServiceMeta":null,"ServicePort":11222,
"ServiceEnableTagOverride":false,"ServiceProxyDestination":"",
"ServiceConnect":{"Native":false,"Proxy":null},"CreateIndex":163932811,"ModifyIndex":273911893}] consul 1.4 root@node1:~# curl -X GET 'http://localhost:8500/v1/catalog/service/service?tag=env1'
[] |
@sofarsog00d can you post without the |
@pearkes yes, it works without |
@sofarsog00d right, I understand -- just trying to gather more information to aid in debugging and I think that would be useful. |
@pearkes any updates? |
any news? |
@sofarsog00d I just tried reproducing and so far tag filtering is working as expected. Could you please submit the curl output of the request without passing the |
I am facing this problem too. We are in a process of updating our consul cluster to the lates version from 0.7.0. I have stable reproduction with agent (1.4.0) connected to our old cluster (0.7.0) and in new test cluster (1.4.0). Lets us see test cluster for example:
Service:
|
@Elufimov Can you execute the secondary query with |
Here it is
|
Well that theory is definitely gone. Not stale or cached and the leader is serving the request. |
It is very strange that we have different results. Can I provide additional data? |
Maybe but I will need to do some more digging to see what I should ask you to gather. |
I will be glad to help. This is definitely blocker for us. |
I re-created a cluster (1.4.0) from the same terraform template and now I can't reproduce the issue. Before re-creation cluster log was full of this messages |
I tried connect agents to our prod cluster (0.7.0): |
Might be #4944 ? was 1.3.1 to fix an issue in 1.3.0 - maybe not a full fix? |
I managed to reproduce the issue after I created 0.7.0 test cluster and joined 1.4.0 agent to it. It hope this will help with reproduction. Or this is not a supported scenario? |
@Elufimov That scenario is definitely unusual but I think it should work. Does the problem always present itself with 1.3.0+ agents in a cluster with agents < 1.3.0? I think I could see how that might cause an issue. |
It was in my dev env. If you need I could reproduce issue on needed versions of agent and cluster. However right now I am focused of upgrading our cluster to the latest version. And so far I have no problems with this process. |
I am going to try to repro with some servers on v1.2.4 and a client on 1.4.0. I think I might know why this is happening. |
@Elufimov I was able to reproduce. The cause of the problem is a 1.3.0+ client communicating with pre-1.3.0 servers. |
The general recommendation is that servers in your cluster be upgraded first. Some features in the client agent's require the server-side updates to work properly and multi-tag filtering (introduced in 1.3.0) was one of them. The client sends somewhat different filters to the servers in 1.3.0 that pre-1.3.0 servers do not recognize. Sometimes new clients may happen to work with older servers but its not something we explicitly support and its not something that should be relied upon. |
Thx for your quick help with this issue. Your versions policy is reasonable. |
Thanks! |
Overview of the Issue
Consul >= 1.3.0 doesn't filter services by tags / returns an empty array
Reproduction Steps
Steps to reproduce this issue, eg:
curl -X GET 'http://localhost:8500/v1/health/service/service_name?tag=env1'
[]
It works with consul 1.2.4, but doesn't with 1.3.0 or higher.
Consul info for both Client and Server
Client info
Server info
The text was updated successfully, but these errors were encountered: