-
Notifications
You must be signed in to change notification settings - Fork 674
WIP: DNS entries added/removed on network connect/disconnect #2855
WIP: DNS entries added/removed on network connect/disconnect #2855
Conversation
Still need to add Proxy implementation
common/docker/client.go
Outdated
pending.finish(event.ID) | ||
ob.ContainerConnected(event.ID) | ||
if containerID, ok := event.Actor.Attributes["container"]; ok { | ||
pending.finish(containerID) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
ipam/allocator.go
Outdated
func (alloc *Allocator) ContainerDisconnected(ident string) { | ||
alloc.actionChan <- func() { | ||
if alloc.hasOwnedByContainer(ident) { | ||
alloc.debugln("Container", ident, "disconnected; noting to remove later") |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
n.Lock() | ||
entries := n.entries.tombstone(n.ourName, func(e *Entry) bool { | ||
if e.ContainerID == ident { | ||
n.infof("container %s disconnected; tombstoning entry %s", ident, e.String()) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
proxy/proxy.go
Outdated
func (proxy *Proxy) ContainerConnected(ident string) { | ||
err := proxy.attach(ident) | ||
// if err != nil { | ||
// TODO: Not sure what is needed here. |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Thanks for the contribution; I think you're on the right track in the plugin, but stay clear of the proxy. |
|
||
func (w *watcher) ContainerConnected(id string) { | ||
w.driver.debug("ContainerConnected", "%s", id) | ||
info, err := w.client.InspectContainer(id) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
n.Lock() | ||
entries := n.entries.tombstone(n.ourName, func(e *Entry) bool { | ||
if e.ContainerID == ident { | ||
n.infof("container %s disconnected; tombstoning entry %s", ident, e.String()) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@dlmiddlecote are you still working on this? Do you need more help? |
Hi @bboreham - sorry that this has been hanging around for so long... I definitely want to get this finished for you. Can you give me some pointers on where to continue? Thanks, Dan. |
There's been quite a bit of refactoring since March 2017; probably best to rebase on current master as a first step. That may trigger some new questions, but it will be easier to think about that way round. |
I'm going to close due to inactivity; feel free to reopen when ready. |
This is an initial PR, to get feedback.
@bboreham I'm not sure what should happen in the Proxy ContainerDisconnect method if there is an error attaching the container.
Also, in the allocator, I added a new map for disconnected containers, instead of treating them as dead. I guess one issue is (
disconnect -> died -> start with --net
) will leave the container in the disconnected map, even though it is connected.TODO:
docker network connect --alias
Fixes #1914