Ecwid / consul-api

Java client for Consul HTTP API
Apache License 2.0
417 stars 175 forks source link

node metadata: agent vs catalog API #118

Closed lpmontx closed 6 years ago

lpmontx commented 7 years ago

Based on things I have read my understanding is we should use 'agent' API for service registration. It seems the 'catalog' API works for registration but inter-node sync is better handled if agent is used. I see node metadata was recently added to catalog API service registration but not the agent API registration. I see no way to add node metadata after registration. So it seems the agent API needs a similar change as was done in the catalog API. If I am misunderstanding please explain. Please elaborate on use of catalog vs agent API.

Further complicating this discussion: The agent API derives the node from that of the agent so although one would be passing node specific data the node itself is not an argument to the API. (odd)

vgv commented 7 years ago

Hi,

You absolutely right - it is better to use agent instead of catalog methods to register services. However, I do not see the meta-fields in agent registration requests.

Please compare the docs: Agent (no metadata) - https://www.consul.io/api/agent/service.html#register-service Catalog (with metadata) - https://www.consul.io/api/catalog.html#register-entity

Am I missing something?

MitchFierro commented 6 years ago

@lpmontx @vgv there is no agent API for registering nodes. That registration info comes from the consul configuration file and node-meta is a node level property, not service level.

vgv commented 6 years ago

Consul 1.0.7 has meta-fields in both catalog and agent service registration. These changes wil be released in 1.4.0 milestone in the next couple of days