I have two services which I am scheduling as service=one
and service=two
. Is there a way that I can schedule both services to one host (with something like a host label of service=one,two
or is the only way to break the key up into something like one=true
and two=true
?
If you want both services to always be on the same host, then you can use a label to schedule based on service name.
Sorry, clicked send before I was done.
http://docs.rancher.com/rancher/rancher-compose/scheduling/#service-name
Something like
labels:
io.rancher.scheduler.affinity:container_label: io.rancher.stack_service.name=stackname_servicename
No, I wanted to choose based on labels of the host. This may be more complicated than it is worth. But I usually have one or two hosts in staging for a group of services and a group of hosts specific for that stack in production.
So in production I may have host1, host2, and host3 with label stack=supercow
and host4, host5, and host6 with label stack=catcatmeow
.
In staging I may only have two hosts and want to schedule both stacks on them. To do this the hosts would have label stack=supercow,catcatmeow
.
Is there an easier way to accomplish this affinity without having a separate docker-compose.yml
for both environments?