Closed squaremo closed 8 years ago
This is only a problem when trying to reconcile the the source of truth for container lifecycle (docker) with the source of truth for services (etcd), when the agent starts. While running, we have enough information to add and remove containers accurately.
An obvious tactic would be to label each instance with a host identifier, and remove only those that belong to the host on which the agent runs. Another would be to use leases, and garbage collect.
If the host crashes (or the docker daemon is stopped, for that matter), we'd want the instances to go away; this suggests a heartbeat mechanism.
As a stop-gap, associating each instance with a host identifier will be adequate. Assuming the host IP given to the agent identifies the host, we can use that.
As a stop-gap, associating each instance with a host identifier will be adequate. Assuming the host IP given to the agent identifies the host, we can use that.
Done as described. Needs tests though.
Test in eeb83683f3ec2214cd9aaa230ce1cfbdd076ecf6
The algorithm in the agent which tells amber about which containers are instances of which services does this:
This has the effect, when running on more than one host, of removing all instances.