mirror of https://github.com/docker/docs.git
Vendor libnetwork v0.7.0-dev.2
- Expose EnableIPV6 option - discoverapi refactoring - Fixed a few typos & docs update - Fixes https://github.com/docker/docker/issues/20140 Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
parent
dfebb6074f
commit
b2e609176d
|
@ -29,7 +29,7 @@ clone git github.com/RackSec/srslog 6eb773f331e46fbba8eecb8e794e635e75fc04de
|
||||||
clone git github.com/imdario/mergo 0.2.1
|
clone git github.com/imdario/mergo 0.2.1
|
||||||
|
|
||||||
#get libnetwork packages
|
#get libnetwork packages
|
||||||
clone git github.com/docker/libnetwork v0.6.1-rc2
|
clone git github.com/docker/libnetwork v0.7.0-dev.2
|
||||||
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
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.7.0-dev.2 (2016-02-11)
|
||||||
|
- Fixes https://github.com/docker/docker/issues/20140
|
||||||
|
|
||||||
|
## 0.7.0-dev.1 (2016-02-10)
|
||||||
|
- Expose EnableIPV6 option
|
||||||
|
- discoverapi refactoring
|
||||||
|
- Fixed a few typos & docs update
|
||||||
|
|
||||||
## 0.6.1-rc2 (2016-02-09)
|
## 0.6.1-rc2 (2016-02-09)
|
||||||
- Fixes https://github.com/docker/docker/issues/20132
|
- Fixes https://github.com/docker/docker/issues/20132
|
||||||
- Fixes https://github.com/docker/docker/issues/20140
|
- Fixes https://github.com/docker/docker/issues/20140
|
||||||
|
@ -87,6 +95,6 @@
|
||||||
- Fixed a bunch of issues with osl namespace mgmt
|
- Fixed a bunch of issues with osl namespace mgmt
|
||||||
|
|
||||||
## 0.3.0 (2015-05-27)
|
## 0.3.0 (2015-05-27)
|
||||||
|
|
||||||
- Introduce CNM (Container Networking Model)
|
- Introduce CNM (Container Networking Model)
|
||||||
- Replace docker networking with CNM & Bridge driver
|
- Replace docker networking with CNM & Bridge driver
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
"icecrime",
|
"icecrime",
|
||||||
"mrjana",
|
"mrjana",
|
||||||
"mavenugo",
|
"mavenugo",
|
||||||
|
"sanimej",
|
||||||
]
|
]
|
||||||
|
|
||||||
[people]
|
[people]
|
||||||
|
@ -50,3 +51,8 @@
|
||||||
Name = "Madhu Venugopal"
|
Name = "Madhu Venugopal"
|
||||||
Email = "madhu@docker.com"
|
Email = "madhu@docker.com"
|
||||||
GitHub = "mavenugo"
|
GitHub = "mavenugo"
|
||||||
|
|
||||||
|
[people.sanimej]
|
||||||
|
Name = "Santhosh Manohar"
|
||||||
|
Email = "santhosh@docker.com"
|
||||||
|
GitHub = "sanimej"
|
||||||
|
|
|
@ -61,7 +61,7 @@ func ParseConfig(tomlCfgFile string) (*Config, error) {
|
||||||
return cfg, nil
|
return cfg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option is a option setter function type used to pass varios configurations
|
// Option is an option setter function type used to pass various configurations
|
||||||
// to the controller
|
// to the controller
|
||||||
type Option func(c *Config)
|
type Option func(c *Config)
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"github.com/docker/libnetwork/config"
|
"github.com/docker/libnetwork/config"
|
||||||
"github.com/docker/libnetwork/datastore"
|
"github.com/docker/libnetwork/datastore"
|
||||||
|
"github.com/docker/libnetwork/discoverapi"
|
||||||
"github.com/docker/libnetwork/driverapi"
|
"github.com/docker/libnetwork/driverapi"
|
||||||
"github.com/docker/libnetwork/hostdiscovery"
|
"github.com/docker/libnetwork/hostdiscovery"
|
||||||
"github.com/docker/libnetwork/ipamapi"
|
"github.com/docker/libnetwork/ipamapi"
|
||||||
|
@ -288,12 +289,12 @@ func (c *controller) pushNodeDiscovery(d *driverData, nodes []net.IP, add bool)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
nodeData := driverapi.NodeDiscoveryData{Address: node.String(), Self: node.Equal(self)}
|
nodeData := discoverapi.NodeDiscoveryData{Address: node.String(), Self: node.Equal(self)}
|
||||||
var err error
|
var err error
|
||||||
if add {
|
if add {
|
||||||
err = d.driver.DiscoverNew(driverapi.NodeDiscovery, nodeData)
|
err = d.driver.DiscoverNew(discoverapi.NodeDiscovery, nodeData)
|
||||||
} else {
|
} else {
|
||||||
err = d.driver.DiscoverDelete(driverapi.NodeDiscovery, nodeData)
|
err = d.driver.DiscoverDelete(discoverapi.NodeDiscovery, nodeData)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("discovery notification error : %v", err)
|
log.Debugf("discovery notification error : %v", err)
|
||||||
|
|
|
@ -5,8 +5,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/docker/libnetwork/drivers/bridge"
|
"github.com/docker/libnetwork/drivers/bridge"
|
||||||
"github.com/docker/libnetwork/netlabel"
|
|
||||||
"github.com/docker/libnetwork/options"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *controller) createGWNetwork() (Network, error) {
|
func (c *controller) createGWNetwork() (Network, error) {
|
||||||
|
@ -17,10 +15,9 @@ func (c *controller) createGWNetwork() (Network, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
n, err := c.NewNetwork("bridge", libnGWNetwork,
|
n, err := c.NewNetwork("bridge", libnGWNetwork,
|
||||||
NetworkOptionGeneric(options.Generic{
|
NetworkOptionDriverOpts(netOption),
|
||||||
netlabel.GenericData: netOption,
|
NetworkOptionEnableIPv6(false),
|
||||||
netlabel.EnableIPv6: false,
|
)
|
||||||
}))
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error creating external connectivity network: %v", err)
|
return nil, fmt.Errorf("error creating external connectivity network: %v", err)
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package discoverapi
|
||||||
|
|
||||||
|
// Discover is an interface to be implemented by the componenet interested in receiving discover events
|
||||||
|
// like new node joining the cluster or datastore updates
|
||||||
|
type Discover interface {
|
||||||
|
// DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster
|
||||||
|
DiscoverNew(dType DiscoveryType, data interface{}) error
|
||||||
|
|
||||||
|
// DiscoverDelete is a notification for a discovery delete event, Example:a node leaving a cluster
|
||||||
|
DiscoverDelete(dType DiscoveryType, data interface{}) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// DiscoveryType represents the type of discovery element the DiscoverNew function is invoked on
|
||||||
|
type DiscoveryType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// NodeDiscovery represents Node join/leave events provided by discovery
|
||||||
|
NodeDiscovery = iota + 1
|
||||||
|
// DatastoreUpdate represents a add/remove datastore event
|
||||||
|
DatastoreUpdate
|
||||||
|
)
|
||||||
|
|
||||||
|
// NodeDiscoveryData represents the structure backing the node discovery data json string
|
||||||
|
type NodeDiscoveryData struct {
|
||||||
|
Address string
|
||||||
|
Self bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// DatastoreUpdateData is the data for the datastore update event message
|
||||||
|
type DatastoreUpdateData struct {
|
||||||
|
Provider string
|
||||||
|
Address string
|
||||||
|
Config interface{}
|
||||||
|
}
|
|
@ -1,12 +1,18 @@
|
||||||
package driverapi
|
package driverapi
|
||||||
|
|
||||||
import "net"
|
import (
|
||||||
|
"net"
|
||||||
|
|
||||||
|
"github.com/docker/libnetwork/discoverapi"
|
||||||
|
)
|
||||||
|
|
||||||
// NetworkPluginEndpointType represents the Endpoint Type used by Plugin system
|
// NetworkPluginEndpointType represents the Endpoint Type used by Plugin system
|
||||||
const NetworkPluginEndpointType = "NetworkDriver"
|
const NetworkPluginEndpointType = "NetworkDriver"
|
||||||
|
|
||||||
// Driver is an interface that every plugin driver needs to implement.
|
// Driver is an interface that every plugin driver needs to implement.
|
||||||
type Driver interface {
|
type Driver interface {
|
||||||
|
discoverapi.Discover
|
||||||
|
|
||||||
// CreateNetwork invokes the driver method to create a network passing
|
// CreateNetwork invokes the driver method to create a network passing
|
||||||
// the network id and network specific config. The config mechanism will
|
// the network id and network specific config. The config mechanism will
|
||||||
// eventually be replaced with labels which are yet to be introduced.
|
// eventually be replaced with labels which are yet to be introduced.
|
||||||
|
@ -36,12 +42,6 @@ type Driver interface {
|
||||||
// Leave method is invoked when a Sandbox detaches from an endpoint.
|
// Leave method is invoked when a Sandbox detaches from an endpoint.
|
||||||
Leave(nid, eid string) error
|
Leave(nid, eid string) error
|
||||||
|
|
||||||
// DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster
|
|
||||||
DiscoverNew(dType DiscoveryType, data interface{}) error
|
|
||||||
|
|
||||||
// DiscoverDelete is a notification for a discovery delete event, Example:a node leaving a cluster
|
|
||||||
DiscoverDelete(dType DiscoveryType, data interface{}) error
|
|
||||||
|
|
||||||
// Type returns the the type of this driver, the network type this driver manages
|
// Type returns the the type of this driver, the network type this driver manages
|
||||||
Type() string
|
Type() string
|
||||||
}
|
}
|
||||||
|
@ -107,20 +107,6 @@ type Capability struct {
|
||||||
DataScope string
|
DataScope string
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoveryType represents the type of discovery element the DiscoverNew function is invoked on
|
|
||||||
type DiscoveryType int
|
|
||||||
|
|
||||||
const (
|
|
||||||
// NodeDiscovery represents Node join/leave events provided by discovery
|
|
||||||
NodeDiscovery = iota + 1
|
|
||||||
)
|
|
||||||
|
|
||||||
// NodeDiscoveryData represents the structure backing the node discovery data json string
|
|
||||||
type NodeDiscoveryData struct {
|
|
||||||
Address string
|
|
||||||
Self bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPAMData represents the per-network ip related
|
// IPAMData represents the per-network ip related
|
||||||
// operational information libnetwork will send
|
// operational information libnetwork will send
|
||||||
// to the network driver during CreateNetwork()
|
// to the network driver during CreateNetwork()
|
||||||
|
|
|
@ -15,6 +15,7 @@ import (
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/libnetwork/datastore"
|
"github.com/docker/libnetwork/datastore"
|
||||||
|
"github.com/docker/libnetwork/discoverapi"
|
||||||
"github.com/docker/libnetwork/driverapi"
|
"github.com/docker/libnetwork/driverapi"
|
||||||
"github.com/docker/libnetwork/iptables"
|
"github.com/docker/libnetwork/iptables"
|
||||||
"github.com/docker/libnetwork/netlabel"
|
"github.com/docker/libnetwork/netlabel"
|
||||||
|
@ -1283,12 +1284,12 @@ func (d *driver) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
||||||
func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
||||||
func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/docker/libnetwork/datastore"
|
"github.com/docker/libnetwork/datastore"
|
||||||
|
"github.com/docker/libnetwork/discoverapi"
|
||||||
"github.com/docker/libnetwork/driverapi"
|
"github.com/docker/libnetwork/driverapi"
|
||||||
"github.com/docker/libnetwork/types"
|
"github.com/docker/libnetwork/types"
|
||||||
)
|
)
|
||||||
|
@ -67,11 +68,11 @@ func (d *driver) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
||||||
func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
||||||
func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/docker/libnetwork/datastore"
|
"github.com/docker/libnetwork/datastore"
|
||||||
|
"github.com/docker/libnetwork/discoverapi"
|
||||||
"github.com/docker/libnetwork/driverapi"
|
"github.com/docker/libnetwork/driverapi"
|
||||||
"github.com/docker/libnetwork/types"
|
"github.com/docker/libnetwork/types"
|
||||||
)
|
)
|
||||||
|
@ -67,11 +68,11 @@ func (d *driver) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
||||||
func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
||||||
func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/libkv/store"
|
"github.com/docker/libkv/store"
|
||||||
"github.com/docker/libnetwork/datastore"
|
"github.com/docker/libnetwork/datastore"
|
||||||
|
"github.com/docker/libnetwork/discoverapi"
|
||||||
"github.com/docker/libnetwork/driverapi"
|
"github.com/docker/libnetwork/driverapi"
|
||||||
"github.com/docker/libnetwork/idm"
|
"github.com/docker/libnetwork/idm"
|
||||||
"github.com/docker/libnetwork/netlabel"
|
"github.com/docker/libnetwork/netlabel"
|
||||||
|
@ -35,7 +36,6 @@ type driver struct {
|
||||||
serfInstance *serf.Serf
|
serfInstance *serf.Serf
|
||||||
networks networkTable
|
networks networkTable
|
||||||
store datastore.DataStore
|
store datastore.DataStore
|
||||||
ipAllocator *idm.Idm
|
|
||||||
vxlanIdm *idm.Idm
|
vxlanIdm *idm.Idm
|
||||||
once sync.Once
|
once sync.Once
|
||||||
joinOnce sync.Once
|
joinOnce sync.Once
|
||||||
|
@ -106,12 +106,6 @@ func (d *driver) configure() error {
|
||||||
err = fmt.Errorf("failed to initialize vxlan id manager: %v", err)
|
err = fmt.Errorf("failed to initialize vxlan id manager: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
d.ipAllocator, err = idm.New(d.store, "ipam-id", 1, 0xFFFF-2)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to initalize ipam id manager: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return err
|
return err
|
||||||
|
@ -192,9 +186,9 @@ func (d *driver) pushLocalEndpointEvent(action, nid, eid string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
||||||
func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
if dType == driverapi.NodeDiscovery {
|
if dType == discoverapi.NodeDiscovery {
|
||||||
nodeData, ok := data.(driverapi.NodeDiscoveryData)
|
nodeData, ok := data.(discoverapi.NodeDiscoveryData)
|
||||||
if !ok || nodeData.Address == "" {
|
if !ok || nodeData.Address == "" {
|
||||||
return fmt.Errorf("invalid discovery data")
|
return fmt.Errorf("invalid discovery data")
|
||||||
}
|
}
|
||||||
|
@ -204,6 +198,6 @@ func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) er
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
||||||
func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ package api
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
"github.com/docker/libnetwork/discoverapi"
|
||||||
"github.com/docker/libnetwork/driverapi"
|
"github.com/docker/libnetwork/driverapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -154,7 +155,7 @@ type LeaveResponse struct {
|
||||||
|
|
||||||
// DiscoveryNotification represents a discovery notification
|
// DiscoveryNotification represents a discovery notification
|
||||||
type DiscoveryNotification struct {
|
type DiscoveryNotification struct {
|
||||||
DiscoveryType driverapi.DiscoveryType
|
DiscoveryType discoverapi.DiscoveryType
|
||||||
DiscoveryData interface{}
|
DiscoveryData interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/pkg/plugins"
|
"github.com/docker/docker/pkg/plugins"
|
||||||
"github.com/docker/libnetwork/datastore"
|
"github.com/docker/libnetwork/datastore"
|
||||||
|
"github.com/docker/libnetwork/discoverapi"
|
||||||
"github.com/docker/libnetwork/driverapi"
|
"github.com/docker/libnetwork/driverapi"
|
||||||
"github.com/docker/libnetwork/drivers/remote/api"
|
"github.com/docker/libnetwork/drivers/remote/api"
|
||||||
"github.com/docker/libnetwork/types"
|
"github.com/docker/libnetwork/types"
|
||||||
|
@ -251,8 +252,8 @@ func (d *driver) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
||||||
func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
if dType != driverapi.NodeDiscovery {
|
if dType != discoverapi.NodeDiscovery {
|
||||||
return fmt.Errorf("Unknown discovery type : %v", dType)
|
return fmt.Errorf("Unknown discovery type : %v", dType)
|
||||||
}
|
}
|
||||||
notif := &api.DiscoveryNotification{
|
notif := &api.DiscoveryNotification{
|
||||||
|
@ -263,8 +264,8 @@ func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) er
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
||||||
func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
if dType != driverapi.NodeDiscovery {
|
if dType != discoverapi.NodeDiscovery {
|
||||||
return fmt.Errorf("Unknown discovery type : %v", dType)
|
return fmt.Errorf("Unknown discovery type : %v", dType)
|
||||||
}
|
}
|
||||||
notif := &api.DiscoveryNotification{
|
notif := &api.DiscoveryNotification{
|
||||||
|
|
|
@ -2,6 +2,7 @@ package windows
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/docker/libnetwork/datastore"
|
"github.com/docker/libnetwork/datastore"
|
||||||
|
"github.com/docker/libnetwork/discoverapi"
|
||||||
"github.com/docker/libnetwork/driverapi"
|
"github.com/docker/libnetwork/driverapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,11 +55,11 @@ func (d *driver) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
|
||||||
func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
|
||||||
func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
|
func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ type Endpoint interface {
|
||||||
Delete(force bool) error
|
Delete(force bool) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndpointOption is a option setter function type used to pass varios options to Network
|
// EndpointOption is an option setter function type used to pass various options to Network
|
||||||
// and Endpoint interfaces methods. The various setter functions of type EndpointOption are
|
// and Endpoint interfaces methods. The various setter functions of type EndpointOption are
|
||||||
// provided by libnetwork, they look like <Create|Join|Leave>Option[...](...)
|
// provided by libnetwork, they look like <Create|Join|Leave>Option[...](...)
|
||||||
type EndpointOption func(ep *endpoint)
|
type EndpointOption func(ep *endpoint)
|
||||||
|
@ -343,7 +343,7 @@ func (ep *endpoint) getNetworkFromStore() (*network, error) {
|
||||||
return nil, fmt.Errorf("invalid network object in endpoint %s", ep.Name())
|
return nil, fmt.Errorf("invalid network object in endpoint %s", ep.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
return ep.network.ctrlr.getNetworkFromStore(ep.network.id)
|
return ep.network.getController().getNetworkFromStore(ep.network.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ep *endpoint) Join(sbox Sandbox, options ...EndpointOption) error {
|
func (ep *endpoint) Join(sbox Sandbox, options ...EndpointOption) error {
|
||||||
|
@ -911,7 +911,7 @@ func (ep *endpoint) assignAddressVersion(ipVer int, ipam ipamapi.Ipam) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if progAdd != nil {
|
if progAdd != nil {
|
||||||
return types.BadRequestErrorf("Invalid preferred address %s: It does not belong to any of this network's subnets", prefAdd)
|
return types.BadRequestErrorf("Invalid address %s: It does not belong to any of this network's subnets", prefAdd)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("no available IPv%d addresses on this network's address pools: %s (%s)", ipVer, n.Name(), n.ID())
|
return fmt.Errorf("no available IPv%d addresses on this network's address pools: %s (%s)", ipVer, n.Name(), n.ID())
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,7 +489,7 @@ func (a *Allocator) getAddress(nw *net.IPNet, bitmask *bitseq.Handle, prefAddres
|
||||||
} else if prefAddress != nil {
|
} else if prefAddress != nil {
|
||||||
hostPart, e := types.GetHostPartIP(prefAddress, base.Mask)
|
hostPart, e := types.GetHostPartIP(prefAddress, base.Mask)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return nil, types.InternalErrorf("failed to allocate preferred address %s: %v", prefAddress.String(), e)
|
return nil, types.InternalErrorf("failed to allocate requested address %s: %v", prefAddress.String(), e)
|
||||||
}
|
}
|
||||||
ordinal = ipToUint64(types.GetMinimalIP(hostPart))
|
ordinal = ipToUint64(types.GetMinimalIP(hostPart))
|
||||||
err = bitmask.Set(ordinal)
|
err = bitmask.Set(ordinal)
|
||||||
|
|
|
@ -67,7 +67,7 @@ type Ipam interface {
|
||||||
RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error)
|
RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error)
|
||||||
// ReleasePool releases the address pool identified by the passed id
|
// ReleasePool releases the address pool identified by the passed id
|
||||||
ReleasePool(poolID string) error
|
ReleasePool(poolID string) error
|
||||||
// Request address from the specified pool ID. Input options or preferred IP can be passed.
|
// Request address from the specified pool ID. Input options or required IP can be passed.
|
||||||
RequestAddress(string, net.IP, map[string]string) (*net.IPNet, map[string]string, error)
|
RequestAddress(string, net.IP, map[string]string) (*net.IPNet, map[string]string, error)
|
||||||
// Release the address from the specified pool ID
|
// Release the address from the specified pool ID
|
||||||
ReleaseAddress(string, net.IP) error
|
ReleaseAddress(string, net.IP) error
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
@ -62,6 +61,7 @@ type NetworkInfo interface {
|
||||||
IpamInfo() ([]*IpamInfo, []*IpamInfo)
|
IpamInfo() ([]*IpamInfo, []*IpamInfo)
|
||||||
DriverOptions() map[string]string
|
DriverOptions() map[string]string
|
||||||
Scope() string
|
Scope() string
|
||||||
|
IPv6Enabled() bool
|
||||||
Internal() bool
|
Internal() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ func (n *network) UnmarshalJSON(b []byte) (err error) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkOption is a option setter function type used to pass varios options to
|
// NetworkOption is an option setter function type used to pass various options to
|
||||||
// NewNetwork method. The various setter functions of type NetworkOption are
|
// NewNetwork method. The various setter functions of type NetworkOption are
|
||||||
// provided by libnetwork, they look like NetworkOptionXXXX(...)
|
// provided by libnetwork, they look like NetworkOptionXXXX(...)
|
||||||
type NetworkOption func(n *network)
|
type NetworkOption func(n *network)
|
||||||
|
@ -475,9 +475,17 @@ type NetworkOption func(n *network)
|
||||||
// in a Dictionary of Key-Value pair
|
// in a Dictionary of Key-Value pair
|
||||||
func NetworkOptionGeneric(generic map[string]interface{}) NetworkOption {
|
func NetworkOptionGeneric(generic map[string]interface{}) NetworkOption {
|
||||||
return func(n *network) {
|
return func(n *network) {
|
||||||
n.generic = generic
|
if n.generic == nil {
|
||||||
if _, ok := generic[netlabel.EnableIPv6]; ok {
|
n.generic = make(map[string]interface{})
|
||||||
n.enableIPv6 = generic[netlabel.EnableIPv6].(bool)
|
}
|
||||||
|
if val, ok := generic[netlabel.EnableIPv6]; ok {
|
||||||
|
n.enableIPv6 = val.(bool)
|
||||||
|
}
|
||||||
|
if val, ok := generic[netlabel.Internal]; ok {
|
||||||
|
n.internal = val.(bool)
|
||||||
|
}
|
||||||
|
for k, v := range generic {
|
||||||
|
n.generic[k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,14 +497,25 @@ func NetworkOptionPersist(persist bool) NetworkOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetworkOptionEnableIPv6 returns an option setter to explicitly configure IPv6
|
||||||
|
func NetworkOptionEnableIPv6(enableIPv6 bool) NetworkOption {
|
||||||
|
return func(n *network) {
|
||||||
|
if n.generic == nil {
|
||||||
|
n.generic = make(map[string]interface{})
|
||||||
|
}
|
||||||
|
n.enableIPv6 = enableIPv6
|
||||||
|
n.generic[netlabel.EnableIPv6] = enableIPv6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NetworkOptionInternalNetwork returns an option setter to config the network
|
// NetworkOptionInternalNetwork returns an option setter to config the network
|
||||||
// to be internal which disables default gateway service
|
// to be internal which disables default gateway service
|
||||||
func NetworkOptionInternalNetwork() NetworkOption {
|
func NetworkOptionInternalNetwork() NetworkOption {
|
||||||
return func(n *network) {
|
return func(n *network) {
|
||||||
n.internal = true
|
|
||||||
if n.generic == nil {
|
if n.generic == nil {
|
||||||
n.generic = make(map[string]interface{})
|
n.generic = make(map[string]interface{})
|
||||||
}
|
}
|
||||||
|
n.internal = true
|
||||||
n.generic[netlabel.Internal] = true
|
n.generic[netlabel.Internal] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -525,13 +544,6 @@ func NetworkOptionDriverOpts(opts map[string]string) NetworkOption {
|
||||||
}
|
}
|
||||||
// Store the options
|
// Store the options
|
||||||
n.generic[netlabel.GenericData] = opts
|
n.generic[netlabel.GenericData] = opts
|
||||||
// Decode and store the endpoint options of libnetwork interest
|
|
||||||
if val, ok := opts[netlabel.EnableIPv6]; ok {
|
|
||||||
var err error
|
|
||||||
if n.enableIPv6, err = strconv.ParseBool(val); err != nil {
|
|
||||||
log.Warnf("Failed to parse %s' value: %s (%s)", netlabel.EnableIPv6, val, err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,7 +704,7 @@ func (n *network) CreateEndpoint(name string, options ...EndpointOption) (Endpoi
|
||||||
ep.id = stringid.GenerateRandomID()
|
ep.id = stringid.GenerateRandomID()
|
||||||
|
|
||||||
// Initialize ep.network with a possibly stale copy of n. We need this to get network from
|
// Initialize ep.network with a possibly stale copy of n. We need this to get network from
|
||||||
// store. But once we get it from store we will have the most uptodate copy possible.
|
// store. But once we get it from store we will have the most uptodate copy possibly.
|
||||||
ep.network = n
|
ep.network = n
|
||||||
ep.locator = n.getController().clusterHostID()
|
ep.locator = n.getController().clusterHostID()
|
||||||
ep.network, err = ep.getNetworkFromStore()
|
ep.network, err = ep.getNetworkFromStore()
|
||||||
|
@ -1237,3 +1249,10 @@ func (n *network) Internal() bool {
|
||||||
|
|
||||||
return n.internal
|
return n.internal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *network) IPv6Enabled() bool {
|
||||||
|
n.Lock()
|
||||||
|
defer n.Unlock()
|
||||||
|
|
||||||
|
return n.enableIPv6
|
||||||
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ type Sandbox interface {
|
||||||
Endpoints() []Endpoint
|
Endpoints() []Endpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
// SandboxOption is a option setter function type used to pass varios options to
|
// SandboxOption is an option setter function type used to pass various options to
|
||||||
// NewNetContainer method. The various setter functions of type SandboxOption are
|
// NewNetContainer method. The various setter functions of type SandboxOption are
|
||||||
// provided by libnetwork, they look like ContainerOptionXXXX(...)
|
// provided by libnetwork, they look like ContainerOptionXXXX(...)
|
||||||
type SandboxOption func(sb *sandbox)
|
type SandboxOption func(sb *sandbox)
|
||||||
|
|
|
@ -139,11 +139,14 @@ func (c *controller) getNetworksFromStore() ([]*network, error) {
|
||||||
ec := &endpointCnt{n: n}
|
ec := &endpointCnt{n: n}
|
||||||
err = store.GetObject(datastore.Key(ec.Key()...), ec)
|
err = store.GetObject(datastore.Key(ec.Key()...), ec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not find endpoint count key %s for network %s while listing: %v", datastore.Key(ec.Key()...), n.Name(), err)
|
log.Warnf("could not find endpoint count key %s for network %s while listing: %v", datastore.Key(ec.Key()...), n.Name(), err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
n.Lock()
|
||||||
n.epCnt = ec
|
n.epCnt = ec
|
||||||
n.scope = store.Scope()
|
n.scope = store.Scope()
|
||||||
|
n.Unlock()
|
||||||
nl = append(nl, n)
|
nl = append(nl, n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue