Moby Project - a collaborative project for the container ecosystem to assemble container-based systems
Go to file
Jana Radhakrishnan 84abbcefa8 Fix a couple of edge cases in service discovery
The first issue is an ordering problem where sandbox
attached version of endpoint object should be pushed
to the watch database first so that any other create endpoint
which is in progress can make use of it immediately to update
the container hosts file. And only after that the current
container should try to retrieve the service records from the
service data base and upate it's hosts file. With the previous
order there is a small time window, when another endpoint create
will find this endpoint but it doesn't have the sandbox context
while the svc record population from svc db has already happened
so that container will totally miss to populate the service record
of the newly created endpoint.

The second issue is trying to rebuild the /etc/hosts file from scratch
during endpoint join and this may sometimes happen after the service
record add for another endpoint  has happened on the container
file. Obviously this rebuilding will wipe out that service record which
was just added. Removed the rebuilding of /etc/hosts file during
endpoint join. The initial population of /etc/hosts file should only
happen during sandbox creation time. In the endpoint join just added
the backward-compatible self ip -> hostname entry as just another
record.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-11-25 15:25:56 -08:00
libnetwork Fix a couple of edge cases in service discovery 2015-11-25 15:25:56 -08:00