Affinity rule to distribute instances by hosts, preventing run more than one by host.

This commit is contained in:
Josh Cox 2017-07-26 12:22:28 -05:00
parent feb0eac179
commit 93bdc8d5a8

View File

@ -11,6 +11,7 @@ services:
- "${replset_name}"
image: mongo:3.4
labels:
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.scheduler.affinity:host_label: ${host_label}
io.rancher.container.hostname_override: container_name
io.rancher.sidekicks: mongo-base, mongo-datavolume
@ -22,6 +23,7 @@ services:
mongo-base:
restart: always
labels:
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.scheduler.affinity:host_label: ${host_label}
io.rancher.container.hostname_override: container_name
io.rancher.container.start_once: true
@ -30,6 +32,7 @@ services:
entrypoint: /bin/true
mongo-datavolume:
labels:
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.scheduler.affinity:host_label: ${host_label}
io.rancher.container.hostname_override: container_name
io.rancher.container.start_once: true