Skip to content

Commit 61f3d91

Browse files
committed
Add hostname to DNS service discovery
This closes #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]>
1 parent c3393f1 commit 61f3d91

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

agent.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,11 @@ func (ep *endpoint) addServiceInfoToCluster(sb *sandbox) error {
634634
}
635635
}
636636

637+
// In any case, add the container hostName to the service discovery DNS
638+
if err := c.addContainerNameResolution(n.ID(), ep.ID(), sb.config.hostName, ep.myAliases, ep.Iface().Address().IP, "addServiceInfoToCluster"); err != nil {
639+
return err
640+
}
641+
637642
buf, err := proto.Marshal(&EndpointRecord{
638643
Name: name,
639644
ServiceName: ep.svcName,
@@ -707,6 +712,11 @@ func (ep *endpoint) deleteServiceInfoFromCluster(sb *sandbox, method string) err
707712
}
708713
}
709714

715+
// In any case, delete the container hostName to the service discovery DNS
716+
if err := c.delContainerNameResolution(n.ID(), ep.ID(), sb.config.hostName, ep.myAliases, ep.Iface().Address().IP, "deleteServiceInfoFromCluster"); err != nil {
717+
return err
718+
}
719+
710720
logrus.Debugf("deleteServiceInfoFromCluster from %s END for %s %s", method, ep.svcName, ep.ID())
711721

712722
return nil

0 commit comments

Comments
 (0)