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

[Add] ConsulCatalog provider: Using K/V for properties (weight, load balancer, circuit breaker) #254

Closed
wants to merge 3 commits into from

Conversation

samber
Copy link
Contributor

@samber samber commented Mar 14, 2016

See #253

…rties (weight, load balancer, circuit breaker)
@emilevauge
Copy link
Member

Hi @samber, thanks a lot for your contribution :)

There is an issue with consul, there is no label :'( :
#146
hashicorp/consul#997

Your idea is great but I thought in the first place that I would use Consul tags to achieve that.
Something like:

{
  "service": {
    "name": "redis",
    "tags": ["traefik.backend=foo", "traefik.weight=10"],
    "address": "127.0.0.1",
    "port": 8000,
    "enableTagOverride": false,
    "checks": [
      {
        "script": "/usr/local/bin/check_redis.py",
        "interval": "10s"
      }
    ]
  }
}

WDYT?
/cc @vdemeester

@keis
Copy link

keis commented Mar 14, 2016

I think using tags would be better considering how you are most likely populating the consul catalog by some automatic scraping of another directory. e.g mesos-consul. Having another source of truth for some of the configuration does not sound like a good idea.

@samber
Copy link
Contributor Author

samber commented Mar 15, 2016

We are building a Consul+Docker stack with Registrator to populate the Consul Catalog.

Using tags is a hack. Unfortunately, as you may know, storing kv-attributes in the consul catalog is discussed for 2y in the Consul ML and on Github. It's still not part of the road map.

It is a trade-off. For Registrator, a PR is going to be merge to use KV as attribute storage. gliderlabs/registrator#261

@emilevauge
Copy link
Member

Using tags is a hack.

Could you elaborate on this? Because we would have to parse tags?

It seems much simpler to me to run a container using:

docker run -d --name redis.0 -p 10000:6379 \
 -e "SERVICE_NAME=db" \
 -e "SERVICE_TAGS=traefik.backend=foo,traefik.weight=10" \
 -e "SERVICE_REGION=us2" redis

which in Consul results in:

{
   "ID":"e2c1fdea9dc8:redis.0:6379",
   "Service":"db",
   "Tags":[
      "traefik.backend=foo",
      "traefik.weight=10"
   ],
   "Address":"172.17.0.4",
   "Port":6379
}

I don't say your solution is bad, but I just want to expose my point of view :)
As we use labels in Docker and Marathon backends, I think it would be more homogeneous to use tags in Consul Catalog (even if it's not ideal).
Besides, having services declared in consul catalog and their config somewhere else could lead to inconsistencies as we would have to update catalog and KV store (and there is no way to do that atomically :'( ).
For now, the PR gliderlabs/registrator#261 is not ready to be merged (ie panics on KV puts) and there has been no change since Oct 5, 2015.

@aaronchar
Copy link

For what it's worth I like the tags idea, seems easier to a mange.

@samber
Copy link
Contributor Author

samber commented Mar 25, 2016

Ok, let's do that.
I'll update my branch and submit a new PR, probably next week.

Syntax of a tag: traefik.(loadbalancer | weight | circuitbreaker)=%value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants