Feature Request: Support key-value attributes for services
In addition to free-form tags for services, it would be incredibly useful to have key-value attributes with client and library support.
I'm interested in this as well. As an alternative, we are considering embedding key/value pairs in tags. But this approach doesn't seem very clean.
This is a planned feature (there are a few issues logged which mention it, mostly part of #294). The main problem is that for backwards compatibility we will need to support k/v representation as well as the original flat form. It's on the roadmap, just hasn't been prioritized yet.
In the meantime, I would suggest following something like RFC1464, "Storing Arbitrary Attributes in DNS", which was originally intended for use with DNS TXT records, but solves the same problem. I know it doesn't solve your use cases fully, but for now that or JSON is the best we have.
@slackpad This is the issue I was talking about. It's related to https://github.com/hashicorp/consul/issues/697.
There are also a couple of issues on it on registrator: https://github.com/gliderlabs/registrator/issues/52 / https://github.com/gliderlabs/registrator/pull/242
Any update on this? We are going to need this functionality very soon, so if you want a PR for it, we might put some time into it.
To provide some color, one of the larger ticket items on the roadmap is a V2 API. There are lots of little things we'd like to correct about V1, including adding K/V metadata to all objects (nodes, services, checks, etc).
We could just add this in places to V1, but we'd rather do it in a top-down redesign of V2. This is both to minimize our duplicated effort, and to make it more compelling to migrate to V2 instead of having to support both versions indefinitely.
Unfortunately, I don't have concrete timelines currently. Consul 0.6 is a monster release, and we cannot increase its scope any further. Consul 0.7 will follow more quickly and be a much smaller release focused on minor features to make it easier to operate and more reliable. This is one of the potential tent poles for a Consul 0.8 however.
Hope that provides some insight into our thinking! Today, the best way to simulate this is to just make use of a convention in the KV store. e.g. "service/FOO/meta/KEY" This way you can use something like Consul-Template to do a lookaside into the KV store.
:+1: For now I'm using tags to pass custom attributes. This is not recommended but I had no other choice.
:+1: I'd like to use attributes instead of tags for some things
Yes, this would be a brilliant feature for me as well.
:+1:
+1
+1
+1
+1
+1
+1
+1
+1
Is this feature will be included in the 0.7? It will be a very good improvement used jointly with consul-template to have more flexibility in the generation of my HAProxy configuration file. (possibility to pass path-prefix, names ...etc from registrator to generate ACL dynamically)
Thank you anyway for this wonderful Consul ;)
@armon Is this still a target for 0.8 as you mentioned it might be above?
This will allow better integration with load-balancers and reverse-proxy services via consul.
While KV implementation is excellent, completeness gap between service's metadata and KV's metadata makes consul integration not as fun as it should be.