Vendoring in libnetwork for the anonymous endpoint
- commit f3c8ebf46b890d4612c5d98e792280d13abdb761 Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
bb5551746b
commit
1be540b99b
|
@ -21,7 +21,7 @@ clone git github.com/vdemeester/shakers 3c10293ce22b900c27acad7b28656196fcc2f73b
|
||||||
clone git golang.org/x/net 3cffabab72adf04f8e3b01c5baf775361837b5fe https://github.com/golang/net.git
|
clone git golang.org/x/net 3cffabab72adf04f8e3b01c5baf775361837b5fe https://github.com/golang/net.git
|
||||||
|
|
||||||
#get libnetwork packages
|
#get libnetwork packages
|
||||||
clone git github.com/docker/libnetwork 0d7a57ddb94a92a57755eec5dc54f905287c7e65
|
clone git github.com/docker/libnetwork f3c8ebf46b890d4612c5d98e792280d13abdb761
|
||||||
clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
|
clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
|
||||||
clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
|
clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
|
||||||
clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4
|
clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4
|
||||||
|
|
|
@ -57,6 +57,7 @@ type endpoint struct {
|
||||||
joinInfo *endpointJoinInfo
|
joinInfo *endpointJoinInfo
|
||||||
sandboxID string
|
sandboxID string
|
||||||
exposedPorts []types.TransportPort
|
exposedPorts []types.TransportPort
|
||||||
|
anonymous bool
|
||||||
generic map[string]interface{}
|
generic map[string]interface{}
|
||||||
joinLeaveDone chan struct{}
|
joinLeaveDone chan struct{}
|
||||||
dbIndex uint64
|
dbIndex uint64
|
||||||
|
@ -77,6 +78,7 @@ func (ep *endpoint) MarshalJSON() ([]byte, error) {
|
||||||
epMap["generic"] = ep.generic
|
epMap["generic"] = ep.generic
|
||||||
}
|
}
|
||||||
epMap["sandbox"] = ep.sandboxID
|
epMap["sandbox"] = ep.sandboxID
|
||||||
|
epMap["anonymous"] = ep.anonymous
|
||||||
return json.Marshal(epMap)
|
return json.Marshal(epMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +107,10 @@ func (ep *endpoint) UnmarshalJSON(b []byte) (err error) {
|
||||||
if v, ok := epMap["generic"]; ok {
|
if v, ok := epMap["generic"]; ok {
|
||||||
ep.generic = v.(map[string]interface{})
|
ep.generic = v.(map[string]interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v, ok := epMap["anonymous"]; ok {
|
||||||
|
ep.anonymous = v.(bool)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +128,7 @@ func (ep *endpoint) CopyTo(o datastore.KVObject) error {
|
||||||
dstEp.sandboxID = ep.sandboxID
|
dstEp.sandboxID = ep.sandboxID
|
||||||
dstEp.dbIndex = ep.dbIndex
|
dstEp.dbIndex = ep.dbIndex
|
||||||
dstEp.dbExists = ep.dbExists
|
dstEp.dbExists = ep.dbExists
|
||||||
|
dstEp.anonymous = ep.anonymous
|
||||||
|
|
||||||
if ep.iface != nil {
|
if ep.iface != nil {
|
||||||
dstEp.iface = &endpointInterface{}
|
dstEp.iface = &endpointInterface{}
|
||||||
|
@ -161,6 +168,12 @@ func (ep *endpoint) Network() string {
|
||||||
return ep.network.name
|
return ep.network.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ep *endpoint) isAnonymous() bool {
|
||||||
|
ep.Lock()
|
||||||
|
defer ep.Unlock()
|
||||||
|
return ep.anonymous
|
||||||
|
}
|
||||||
|
|
||||||
// endpoint Key structure : endpoint/network-id/endpoint-id
|
// endpoint Key structure : endpoint/network-id/endpoint-id
|
||||||
func (ep *endpoint) Key() []string {
|
func (ep *endpoint) Key() []string {
|
||||||
if ep.network == nil {
|
if ep.network == nil {
|
||||||
|
@ -603,6 +616,14 @@ func CreateOptionPortMapping(portBindings []types.PortBinding) EndpointOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateOptionAnonymous function returns an option setter for setting
|
||||||
|
// this endpoint as anonymous
|
||||||
|
func CreateOptionAnonymous() EndpointOption {
|
||||||
|
return func(ep *endpoint) {
|
||||||
|
ep.anonymous = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// JoinOptionPriority function returns an option setter for priority option to
|
// JoinOptionPriority function returns an option setter for priority option to
|
||||||
// be passed to the endpoint.Join() method.
|
// be passed to the endpoint.Join() method.
|
||||||
func JoinOptionPriority(ep Endpoint, prio int) EndpointOption {
|
func JoinOptionPriority(ep Endpoint, prio int) EndpointOption {
|
||||||
|
|
|
@ -753,6 +753,10 @@ func (n *network) EndpointByID(id string) (Endpoint, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *network) updateSvcRecord(ep *endpoint, localEps []*endpoint, isAdd bool) {
|
func (n *network) updateSvcRecord(ep *endpoint, localEps []*endpoint, isAdd bool) {
|
||||||
|
if ep.isAnonymous() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
c := n.getController()
|
c := n.getController()
|
||||||
sr, ok := c.svcDb[n.ID()]
|
sr, ok := c.svcDb[n.ID()]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in New Issue