- commit f3c8ebf46b890d4612c5d98e792280d13abdb761
Signed-off-by: Alessandro Boch <aboch@docker.com>
| ... | ... |
@@ -21,7 +21,7 @@ clone git github.com/vdemeester/shakers 3c10293ce22b900c27acad7b28656196fcc2f73b |
| 21 | 21 |
clone git golang.org/x/net 3cffabab72adf04f8e3b01c5baf775361837b5fe https://github.com/golang/net.git |
| 22 | 22 |
|
| 23 | 23 |
#get libnetwork packages |
| 24 |
-clone git github.com/docker/libnetwork 0d7a57ddb94a92a57755eec5dc54f905287c7e65 |
|
| 24 |
+clone git github.com/docker/libnetwork f3c8ebf46b890d4612c5d98e792280d13abdb761 |
|
| 25 | 25 |
clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec |
| 26 | 26 |
clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b |
| 27 | 27 |
clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4 |
| ... | ... |
@@ -57,6 +57,7 @@ type endpoint struct {
|
| 57 | 57 |
joinInfo *endpointJoinInfo |
| 58 | 58 |
sandboxID string |
| 59 | 59 |
exposedPorts []types.TransportPort |
| 60 |
+ anonymous bool |
|
| 60 | 61 |
generic map[string]interface{}
|
| 61 | 62 |
joinLeaveDone chan struct{}
|
| 62 | 63 |
dbIndex uint64 |
| ... | ... |
@@ -77,6 +78,7 @@ func (ep *endpoint) MarshalJSON() ([]byte, error) {
|
| 77 | 77 |
epMap["generic"] = ep.generic |
| 78 | 78 |
} |
| 79 | 79 |
epMap["sandbox"] = ep.sandboxID |
| 80 |
+ epMap["anonymous"] = ep.anonymous |
|
| 80 | 81 |
return json.Marshal(epMap) |
| 81 | 82 |
} |
| 82 | 83 |
|
| ... | ... |
@@ -105,6 +107,10 @@ func (ep *endpoint) UnmarshalJSON(b []byte) (err error) {
|
| 105 | 105 |
if v, ok := epMap["generic"]; ok {
|
| 106 | 106 |
ep.generic = v.(map[string]interface{})
|
| 107 | 107 |
} |
| 108 |
+ |
|
| 109 |
+ if v, ok := epMap["anonymous"]; ok {
|
|
| 110 |
+ ep.anonymous = v.(bool) |
|
| 111 |
+ } |
|
| 108 | 112 |
return nil |
| 109 | 113 |
} |
| 110 | 114 |
|
| ... | ... |
@@ -122,6 +128,7 @@ func (ep *endpoint) CopyTo(o datastore.KVObject) error {
|
| 122 | 122 |
dstEp.sandboxID = ep.sandboxID |
| 123 | 123 |
dstEp.dbIndex = ep.dbIndex |
| 124 | 124 |
dstEp.dbExists = ep.dbExists |
| 125 |
+ dstEp.anonymous = ep.anonymous |
|
| 125 | 126 |
|
| 126 | 127 |
if ep.iface != nil {
|
| 127 | 128 |
dstEp.iface = &endpointInterface{}
|
| ... | ... |
@@ -161,6 +168,12 @@ func (ep *endpoint) Network() string {
|
| 161 | 161 |
return ep.network.name |
| 162 | 162 |
} |
| 163 | 163 |
|
| 164 |
+func (ep *endpoint) isAnonymous() bool {
|
|
| 165 |
+ ep.Lock() |
|
| 166 |
+ defer ep.Unlock() |
|
| 167 |
+ return ep.anonymous |
|
| 168 |
+} |
|
| 169 |
+ |
|
| 164 | 170 |
// endpoint Key structure : endpoint/network-id/endpoint-id |
| 165 | 171 |
func (ep *endpoint) Key() []string {
|
| 166 | 172 |
if ep.network == nil {
|
| ... | ... |
@@ -603,6 +616,14 @@ func CreateOptionPortMapping(portBindings []types.PortBinding) EndpointOption {
|
| 603 | 603 |
} |
| 604 | 604 |
} |
| 605 | 605 |
|
| 606 |
+// CreateOptionAnonymous function returns an option setter for setting |
|
| 607 |
+// this endpoint as anonymous |
|
| 608 |
+func CreateOptionAnonymous() EndpointOption {
|
|
| 609 |
+ return func(ep *endpoint) {
|
|
| 610 |
+ ep.anonymous = true |
|
| 611 |
+ } |
|
| 612 |
+} |
|
| 613 |
+ |
|
| 606 | 614 |
// JoinOptionPriority function returns an option setter for priority option to |
| 607 | 615 |
// be passed to the endpoint.Join() method. |
| 608 | 616 |
func JoinOptionPriority(ep Endpoint, prio int) EndpointOption {
|
| ... | ... |
@@ -753,6 +753,10 @@ func (n *network) EndpointByID(id string) (Endpoint, error) {
|
| 753 | 753 |
} |
| 754 | 754 |
|
| 755 | 755 |
func (n *network) updateSvcRecord(ep *endpoint, localEps []*endpoint, isAdd bool) {
|
| 756 |
+ if ep.isAnonymous() {
|
|
| 757 |
+ return |
|
| 758 |
+ } |
|
| 759 |
+ |
|
| 756 | 760 |
c := n.getController() |
| 757 | 761 |
sr, ok := c.svcDb[n.ID()] |
| 758 | 762 |
if !ok {
|