Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

WIP: DNS entries added/removed on network connect/disconnect #2855

Conversation

dlmiddlecote
Copy link
Contributor

@dlmiddlecote dlmiddlecote commented Mar 19, 2017

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:

  • Proxy ContainerDisconnect Implementation
  • Improve tests
  • Support for docker network connect --alias

Fixes #1914

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.

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.

This comment was marked as abuse.

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.

This comment was marked as abuse.

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.

@bboreham
Copy link
Contributor

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.

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.

@dlmiddlecote dlmiddlecote changed the title DNS entries added/removed on network connect/disconnect WIP: DNS entries added/removed on network connect/disconnect Mar 31, 2017
@bboreham
Copy link
Contributor

@dlmiddlecote are you still working on this? Do you need more help?

@dlmiddlecote
Copy link
Contributor Author

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.

@bboreham
Copy link
Contributor

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.

@bboreham
Copy link
Contributor

I'm going to close due to inactivity; feel free to reopen when ready.

@bboreham bboreham closed this May 23, 2018
@bboreham bboreham added this to the n/a milestone Sep 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants