Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upConsul discoverer doesn't respect datacenter provided by the node #5411
Comments
This comment has been minimized.
This comment has been minimized.
|
To be clear, you're emulating the Consul API to implement your own SD mechanism,
I'm not the best qualified person but it was probably the easiest thing to do at the time being. Maybe @iksaif has more insights? |
This comment has been minimized.
This comment has been minimized.
That is correct, but to be precise The strange thing is that response format for the node already has a field for DC which tells me it should be used. Also Consul documentation says:
If you take a look at the home page example for "Multiple Datacenters" (scroll down) you can see that returned list can have nodes with multiple different DCs.
This is in contrast with assuming DC of the node by the DC of the agent as agent can have only one DC. I can offer a pull request if you are willing to accept it. |
This comment has been minimized.
This comment has been minimized.
|
I don't think we should be trying to accommodate anything but Consul itself. We already have a generic integration. |
This comment has been minimized.
This comment has been minimized.
Totally agree with that statement. But the emulation part is irrelevant, it's there just for transparency. The question still remains, why is discoverer assuming node's datacenter based on agent's datacenter when node is providing that information itself? Or maybe in Consul terms, can the service have nodes that span multiple datacenters? If yes then the discoverer implementation is flawed. And I think I provided links to documentation that confirms this is true. |
ajankovic commentedMar 27, 2019
•
edited
Bug Report
What did you do?
Tried to replicate consul API for discovery. API is returning agent's datacenter on
/v1/agent/selfand each node returns it's own datacenter in/v1/catalog/service/<service>list.What did you expect to see?
Discovered label
__meta_consul_dcshould contain datacenter returned by the node itself.For example:
Should label the target with "dc1" datacenter.
What did you see instead? Under which circumstances?
Discovered label
__meta_consul_dccontains datacenter reported by the agent itself.Environment
Question:
In summary why is discoverer for Consul assuming that agent's datacenter should be used for all discovered targets?