Skip to content
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

Automatically tagging services with agent specific tags #545

Closed
janitha opened this issue Dec 16, 2014 · 4 comments
Closed

Automatically tagging services with agent specific tags #545

janitha opened this issue Dec 16, 2014 · 4 comments

Comments

@janitha
Copy link

janitha commented Dec 16, 2014

It would be useful to be able to configure a set of default_tags in the agent that are automatically applied to any service registered with that agent.

Example Usecase: A situation where machines in a network are grouped together (eg. group-foo, group-bar). At the moment, when a service is registered from a machine from "group-foo", each service's service definition needs to explicitly specify the tag "group-foo". With this proposed feature, the user only needs to specify the default_tags=["group_foo"] for consul agent, and any service registering through the agent would automatically get the "group-foo" tag.

An alternate method would be to able to allow tagging the consul agents (instead of adding tags to the service), and during querying, one could restrict results only to certain agent tags.

@armon
Copy link
Member

armon commented Dec 17, 2014

Could you clarify the use case a bit more?

@janitha
Copy link
Author

janitha commented Dec 18, 2014

Sure, using an example, imagine there is a new configurable variable for the consul agent, inherit_tags: ["foo", "bar"]. Now anytime a service is registered through this agent, the tags "foo" and "bar" are automatically applied to that service.

This greatly simplifies service definitions when there are tags that are common to all services started from the same node (or group of nodes). For example, if you tag a consul agent as "staging", then all services started from that machine will also be tagged "staging".

@armon
Copy link
Member

armon commented Jan 2, 2015

I understand. I think for now this doesn't seem broadly useful to me, and is probably better solved in the tools that are generating the service definitions rather than in Consul itself.

@slackpad
Copy link
Contributor

slackpad commented May 1, 2017

The https://www.consul.io/docs/agent/options.html#node_meta feature should meet this need, and you can search the catalog by this for nodes and services.

@slackpad slackpad closed this as completed May 1, 2017
duckhan pushed a commit to duckhan/consul that referenced this issue Oct 24, 2021
* add options to customize the dns service (fixes hashicorp#545)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants