mantl / mesos-consul

Mesos to Consul bridge for service discovery
Apache License 2.0
338 stars 95 forks source link

Add tags to mesos-consul itself ? #53

Open scalp42 opened 8 years ago

scalp42 commented 8 years ago

Is there a possibility to add a tag to the mesos service itself ?

The issue is that if you run multiple Mesos clusters with a single shared Consul cluster, both environments get mixed.

Assuming a dev Mesos cluster:

dev.mesos.service.consul

And a prod Mesos cluster:

prod.mesos.service.consul

It would be great to be able to override the actual service name, mesos being really generic and also taking in account where you already have a mesos service in Consul.

Thoughts ?

ChrisAubuchon commented 8 years ago

Check out feature/configurable-service-name. That adds a --service-name to the command line options to change the mesos service name.

Maybe a --service-tag option that registers the mesos hosts as (leader|master|slave).<tag>.<service-name>.service.consul?

scalp42 commented 8 years ago

@ChrisAubuchon both would be great actually :santa: :christmas_tree:

This way it's easy peasy to deploy this with Chef for example.

ChrisAubuchon commented 8 years ago

@scalp42 I added --service-tags the branch. It takes a comma-delimited list of tags and registers the mesos hosts as (leader|master|follower)...service.consul.

scalp42 commented 8 years ago

@ChrisAubuchon thanks a lot for considering it! In the middle of some ops madness here but (and sorry in advance but gotta make sure :innocent:) does it just default to the standard behavior, meaning if you don't pass the param, it equals to:

(leader|master|follower).mesos.service.consul

Thanks again, I'll try to figure how to pass the branch when building go package (if you're familiar with Chef):

golang_package 'github.com/CiscoCloud/mesos-consul' do
  action node[cookbook_name][recipe_name]['nuke'] ? :nothing : :install
  retries 3
  retry_delay 2
end
ChrisAubuchon commented 8 years ago

@scalp42 The service-name defaults to mesos and the tags are empty by default so default behavior is not changed.

scalp42 commented 8 years ago

@ChrisAubuchon you rock! #hugops

imrangit commented 8 years ago

Hi,

I just checked out a "mesos-consul" code and build an image recently. I am using consul 0.6.0. However, I am trying to run a docker container with service-name and service-tags options, but it looks like it is not picking it up. Does it have to be in a particular order?

The way I am running it is: sudo docker run -d mesos-consul:0.3.1 "--zk=zk://zkhost:2181/mesos --service-name=mymesos --service-tags=tag1,tag2"

whereas If I run it as: sudo docker run -d mesos-consul:0.3.1 "--zk=zk://zkhost:2181/mesos" it registers all the mesos task as service properly in consul.

But I i would like to leverage service-name and service-tags features, how to get it to work?

-Imran

scalp42 commented 8 years ago

I'm not sure if it's actually made it to master @ChrisAubuchon maybe can confirm

imrangit commented 8 years ago

I also have other question regarding the service-name and service-tags. Can we extend that to the actual marathon applications?

For example: If I have multiple marathon frameworks and if they the same application names, then it sort of pollutes the services in the consul if the name is common. What I would like to get is something like "app_name.service_name" registered as a service in consul rather than just "app_name". It is more like adding a namespace feature to mesos-consul.

-Imran

ChrisAubuchon commented 8 years ago

@imrangit --service-name and --service-tag is included in v0.3.2