Skip to content

Commit

Permalink
Add hostname to DNS service discovery
Browse files Browse the repository at this point in the history
This closes moby#1854 which is related to moby/moby#34239 and
moby/swarmkit#2325.

Details of this patch are in the PR.

Signed-off-by: Mario Kleinsasser <[email protected]>
  • Loading branch information
m4r10k committed Jul 25, 2017
1 parent c3393f1 commit 61f3d91
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,11 @@ func (ep *endpoint) addServiceInfoToCluster(sb *sandbox) error {
}
}

// In any case, add the container hostName to the service discovery DNS
if err := c.addContainerNameResolution(n.ID(), ep.ID(), sb.config.hostName, ep.myAliases, ep.Iface().Address().IP, "addServiceInfoToCluster"); err != nil {
return err
}

buf, err := proto.Marshal(&EndpointRecord{
Name: name,
ServiceName: ep.svcName,
Expand Down Expand Up @@ -707,6 +712,11 @@ func (ep *endpoint) deleteServiceInfoFromCluster(sb *sandbox, method string) err
}
}

// In any case, delete the container hostName to the service discovery DNS
if err := c.delContainerNameResolution(n.ID(), ep.ID(), sb.config.hostName, ep.myAliases, ep.Iface().Address().IP, "deleteServiceInfoFromCluster"); err != nil {
return err
}

logrus.Debugf("deleteServiceInfoFromCluster from %s END for %s %s", method, ep.svcName, ep.ID())

return nil
Expand Down

0 comments on commit 61f3d91

Please sign in to comment.