consul icon indicating copy to clipboard operation
consul copied to clipboard

Feature Request: Support key-value attributes for services

Open rafikk opened this issue 11 years ago • 42 comments

In addition to free-form tags for services, it would be incredibly useful to have key-value attributes with client and library support.

rafikk avatar Jul 13 '15 00:07 rafikk

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.

cbarbour avatar Jul 14 '15 17:07 cbarbour

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.

ryanuber avatar Jul 14 '15 18:07 ryanuber

@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

amochtar avatar Sep 28 '15 19:09 amochtar

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.

Multiply avatar Nov 03 '15 07:11 Multiply

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.

armon avatar Nov 03 '15 18:11 armon

:+1: For now I'm using tags to pass custom attributes. This is not recommended but I had no other choice.

CyrilPeponnet avatar Dec 04 '15 19:12 CyrilPeponnet

:+1: I'd like to use attributes instead of tags for some things

dweinstein avatar Jan 11 '16 23:01 dweinstein

Yes, this would be a brilliant feature for me as well.

jmgpeeters avatar Jan 19 '16 13:01 jmgpeeters

:+1:

primalmotion avatar Jan 29 '16 01:01 primalmotion

+1

samber avatar Mar 02 '16 13:03 samber

+1

CpuID avatar Mar 09 '16 05:03 CpuID

+1

hackley avatar Mar 29 '16 21:03 hackley

+1

rylarson avatar Apr 18 '16 17:04 rylarson

+1

flozano avatar May 17 '16 15:05 flozano

+1

winpat avatar Jun 21 '16 07:06 winpat

+1

eli007s avatar Jul 18 '16 06:07 eli007s

+1

abhayvatsa avatar Aug 16 '16 21:08 abhayvatsa

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 ;)

cabrinoob avatar Aug 25 '16 07:08 cabrinoob

@armon Is this still a target for 0.8 as you mentioned it might be above?

jhickson avatar Sep 15 '16 10:09 jhickson

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.

rokka-n avatar Oct 16 '16 22:10 rokka-n