mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1477 from allencloud/fix-nits-in-comments
fix nits in comments and log
This commit is contained in:
commit
ea579a4d0e
9 changed files with 16 additions and 16 deletions
|
@ -145,7 +145,7 @@ func makeDefaultScopes() map[string]*ScopeCfg {
|
||||||
var defaultRootChain = []string{"docker", "network", "v1.0"}
|
var defaultRootChain = []string{"docker", "network", "v1.0"}
|
||||||
var rootChain = defaultRootChain
|
var rootChain = defaultRootChain
|
||||||
|
|
||||||
// DefaultScopes returns a map of default scopes and it's config for clients to use.
|
// DefaultScopes returns a map of default scopes and its config for clients to use.
|
||||||
func DefaultScopes(dataDir string) map[string]*ScopeCfg {
|
func DefaultScopes(dataDir string) map[string]*ScopeCfg {
|
||||||
if dataDir != "" {
|
if dataDir != "" {
|
||||||
defaultScopes[LocalScope].Client.Address = dataDir + "/network/files/local-kv.db"
|
defaultScopes[LocalScope].Client.Address = dataDir + "/network/files/local-kv.db"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package discoverapi
|
package discoverapi
|
||||||
|
|
||||||
// Discover is an interface to be implemented by the componenet interested in receiving discover events
|
// Discover is an interface to be implemented by the component interested in receiving discover events
|
||||||
// like new node joining the cluster or datastore updates
|
// like new node joining the cluster or datastore updates
|
||||||
type Discover interface {
|
type Discover interface {
|
||||||
// DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster
|
// DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster
|
||||||
|
|
|
@ -11,7 +11,7 @@ Instead of attaching container network interfaces to a Docker host Linux bridge
|
||||||
|
|
||||||
When using traditional Linux bridges there are two common techniques to get traffic out of a container and into the physical network and vice versa. The first method to connect containers to the underlying network is to use Iptable rules which perform a NAT translation from a bridge that represents the Docker network to the physical Ethernet connection such as `eth0`. The upside of Iptables using the Docker built-in bridge driver is that the NIC does not have to be in promiscuous mode. The second bridge driver method is to move a host's external Ethernet connection into the bridge. Moving the host Ethernet connection can at times be unforgiving. Common mistakes such as cutting oneself off from the host, or worse, creating bridging loops that can cripple a VLAN throughout a data center can open a network design up to potential risks as the infrastructure grows.
|
When using traditional Linux bridges there are two common techniques to get traffic out of a container and into the physical network and vice versa. The first method to connect containers to the underlying network is to use Iptable rules which perform a NAT translation from a bridge that represents the Docker network to the physical Ethernet connection such as `eth0`. The upside of Iptables using the Docker built-in bridge driver is that the NIC does not have to be in promiscuous mode. The second bridge driver method is to move a host's external Ethernet connection into the bridge. Moving the host Ethernet connection can at times be unforgiving. Common mistakes such as cutting oneself off from the host, or worse, creating bridging loops that can cripple a VLAN throughout a data center can open a network design up to potential risks as the infrastructure grows.
|
||||||
|
|
||||||
Connecting containers without any NATing is where the VLAN drivers accel. Rather then having to manage a bridge for each Docker network containers are connected directly to a `parent` interface such as `eth0` that attaches the container to the same broadcast domain as the parent interface. A simple example is if a host's `eth0` is on the network `192.168.1.0/24` with a gateway of `192.168.1.1` then a Macvlan Docker network can start containers on the addresses `192.168.1.2 - 192.168.1.254`. Containers use the same network as the parent `-o parent` that is specified in the `docker network create` command.
|
Connecting containers without any NATing is where the VLAN drivers accel. Rather than having to manage a bridge for each Docker network containers are connected directly to a `parent` interface such as `eth0` that attaches the container to the same broadcast domain as the parent interface. A simple example is if a host's `eth0` is on the network `192.168.1.0/24` with a gateway of `192.168.1.1` then a Macvlan Docker network can start containers on the addresses `192.168.1.2 - 192.168.1.254`. Containers use the same network as the parent `-o parent` that is specified in the `docker network create` command.
|
||||||
|
|
||||||
There are positive performance implication as a result of bypassing the Linux bridge, along with the simplicity of less moving parts, which is also attractive. Macvlan containers are easy to troubleshoot. The actual MAC and IP address of the container is bridged into the upstream network making a problematic application easy for operators to trace from the network. Existing underlay network management and monitoring tools remain relevant.
|
There are positive performance implication as a result of bypassing the Linux bridge, along with the simplicity of less moving parts, which is also attractive. Macvlan containers are easy to troubleshoot. The actual MAC and IP address of the container is bridged into the upstream network making a problematic application easy for operators to trace from the network. Existing underlay network management and monitoring tools remain relevant.
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ For more on Docker networking commands see: [Working with Docker network command
|
||||||
|
|
||||||
VLANs have long been a primary means of virtualizing data center networks and are still in virtually all existing networks today. VLANs work by tagging a Layer-2 isolation domain with a 12-bit identifier ranging from 1-4094. The VLAN tag is inserted into a packet header that enables a logical grouping of a single subnet or multiple subnets of IPv4 and/or IPv6. It is very common for network operators to separate traffic using VLANs based on a subnet(s) function or security profile such as `web`, `db` or any other isolation requirements.
|
VLANs have long been a primary means of virtualizing data center networks and are still in virtually all existing networks today. VLANs work by tagging a Layer-2 isolation domain with a 12-bit identifier ranging from 1-4094. The VLAN tag is inserted into a packet header that enables a logical grouping of a single subnet or multiple subnets of IPv4 and/or IPv6. It is very common for network operators to separate traffic using VLANs based on a subnet(s) function or security profile such as `web`, `db` or any other isolation requirements.
|
||||||
|
|
||||||
It is very common to have a compute host requirement of running multiple virtual networks concurrently on a host. Linux networking has long supported VLAN tagging, also known by it's standard 802.1Q, for maintaining datapath isolation between networks. The Ethernet link connected to a Docker host can be configured to support the 802.1q VLAN IDs by creating Linux sub-interfaces, each sub-interface being allocated a unique VLAN ID.
|
It is very common to have a compute host requirement of running multiple virtual networks concurrently on a host. Linux networking has long supported VLAN tagging, also known by its standard 802.1Q, for maintaining datapath isolation between networks. The Ethernet link connected to a Docker host can be configured to support the 802.1q VLAN IDs by creating Linux sub-interfaces, each sub-interface being allocated a unique VLAN ID.
|
||||||
|
|
||||||
![Simple Macvlan Mode Example](images/multi_tenant_8021q_vlans.png)
|
![Simple Macvlan Mode Example](images/multi_tenant_8021q_vlans.png)
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ In the next example, the network is tagged and isolated by the Docker host. A pa
|
||||||
|
|
||||||
```
|
```
|
||||||
# now add networks and hosts as you would normally by attaching to the master (sub)interface that is tagged
|
# now add networks and hosts as you would normally by attaching to the master (sub)interface that is tagged
|
||||||
docker network create -d macvlan \
|
docker network create -d macvlan \
|
||||||
--subnet=192.168.50.0/24 \
|
--subnet=192.168.50.0/24 \
|
||||||
--gateway=192.168.50.1 \
|
--gateway=192.168.50.1 \
|
||||||
-o parent=eth0.50 macvlan50
|
-o parent=eth0.50 macvlan50
|
||||||
|
@ -180,7 +180,7 @@ In the second network, tagged and isolated by the Docker host, `eth0.60` is the
|
||||||
|
|
||||||
```
|
```
|
||||||
# now add networks and hosts as you would normally by attaching to the master (sub)interface that is tagged.
|
# now add networks and hosts as you would normally by attaching to the master (sub)interface that is tagged.
|
||||||
docker network create -d macvlan \
|
docker network create -d macvlan \
|
||||||
--subnet=192.168.60.0/24 \
|
--subnet=192.168.60.0/24 \
|
||||||
--gateway=192.168.60.1 \
|
--gateway=192.168.60.1 \
|
||||||
-o parent=eth0.60 -o \
|
-o parent=eth0.60 -o \
|
||||||
|
@ -197,7 +197,7 @@ The same as the example before except there is an additional subnet bound to the
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
docker network create -d macvlan \
|
docker network create -d macvlan \
|
||||||
--subnet=10.1.20.0/24 --subnet=10.1.10.0/24 \
|
--subnet=10.1.20.0/24 --subnet=10.1.10.0/24 \
|
||||||
--gateway=10.1.20.1 --gateway=10.1.10.1 \
|
--gateway=10.1.20.1 --gateway=10.1.10.1 \
|
||||||
-o parent=eth0.101 mcv101
|
-o parent=eth0.101 mcv101
|
||||||
|
|
|
@ -66,7 +66,7 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteEndpoint remove the endpoint and associated netlink interface
|
// DeleteEndpoint removes the endpoint and associated netlink interface
|
||||||
func (d *driver) DeleteEndpoint(nid, eid string) error {
|
func (d *driver) DeleteEndpoint(nid, eid string) error {
|
||||||
defer osl.InitOSContext()()
|
defer osl.InitOSContext()()
|
||||||
if err := validateID(nid, eid); err != nil {
|
if err := validateID(nid, eid); err != nil {
|
||||||
|
|
|
@ -124,7 +124,7 @@ func (d *driver) createNetwork(config *configuration) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteNetwork the network for the specified driver type
|
// DeleteNetwork deletes the network for the specified driver type
|
||||||
func (d *driver) DeleteNetwork(nid string) error {
|
func (d *driver) DeleteNetwork(nid string) error {
|
||||||
defer osl.InitOSContext()()
|
defer osl.InitOSContext()()
|
||||||
n := d.network(nid)
|
n := d.network(nid)
|
||||||
|
@ -171,7 +171,7 @@ func (d *driver) DeleteNetwork(nid string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseNetworkOptions parse docker network options
|
// parseNetworkOptions parses docker network options
|
||||||
func parseNetworkOptions(id string, option options.Generic) (*configuration, error) {
|
func parseNetworkOptions(id string, option options.Generic) (*configuration, error) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
|
@ -193,7 +193,7 @@ func parseNetworkOptions(id string, option options.Generic) (*configuration, err
|
||||||
return config, nil
|
return config, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseNetworkGenericOptions parse generic driver docker network options
|
// parseNetworkGenericOptions parses generic driver docker network options
|
||||||
func parseNetworkGenericOptions(data interface{}) (*configuration, error) {
|
func parseNetworkGenericOptions(data interface{}) (*configuration, error) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
|
|
|
@ -64,7 +64,7 @@ func setMacVlanMode(mode string) (netlink.MacvlanMode, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parentExists check if the specified interface exists in the default namespace
|
// parentExists checks if the specified interface exists in the default namespace
|
||||||
func parentExists(ifaceStr string) bool {
|
func parentExists(ifaceStr string) bool {
|
||||||
_, err := ns.NlHandle().LinkByName(ifaceStr)
|
_, err := ns.NlHandle().LinkByName(ifaceStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -789,7 +789,7 @@ func (ep *endpoint) Delete(force bool) error {
|
||||||
ep.releaseAddress()
|
ep.releaseAddress()
|
||||||
|
|
||||||
if err := n.getEpCnt().DecEndpointCnt(); err != nil {
|
if err := n.getEpCnt().DecEndpointCnt(); err != nil {
|
||||||
log.Warnf("failed to decrement endpoint coint for ep %s: %v", ep.ID(), err)
|
log.Warnf("failed to decrement endpoint count for ep %s: %v", ep.ID(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -34,7 +34,7 @@ type Network interface {
|
||||||
Type() string
|
Type() string
|
||||||
|
|
||||||
// Create a new endpoint to this network symbolically identified by the
|
// Create a new endpoint to this network symbolically identified by the
|
||||||
// specified unique name. The options parameter carry driver specific options.
|
// specified unique name. The options parameter carries driver specific options.
|
||||||
CreateEndpoint(name string, options ...EndpointOption) (Endpoint, error)
|
CreateEndpoint(name string, options ...EndpointOption) (Endpoint, error)
|
||||||
|
|
||||||
// Delete the network.
|
// Delete the network.
|
||||||
|
|
|
@ -123,10 +123,10 @@ func FilterResolvDNS(resolvConf []byte, ipv6Enabled bool) (*File, error) {
|
||||||
// if the resulting resolvConf has no more nameservers defined, add appropriate
|
// if the resulting resolvConf has no more nameservers defined, add appropriate
|
||||||
// default DNS servers for IPv4 and (optionally) IPv6
|
// default DNS servers for IPv4 and (optionally) IPv6
|
||||||
if len(GetNameservers(cleanedResolvConf, types.IP)) == 0 {
|
if len(GetNameservers(cleanedResolvConf, types.IP)) == 0 {
|
||||||
logrus.Infof("No non-localhost DNS nameservers are left in resolv.conf. Using default external servers : %v", defaultIPv4Dns)
|
logrus.Infof("No non-localhost DNS nameservers are left in resolv.conf. Using default external servers: %v", defaultIPv4Dns)
|
||||||
dns := defaultIPv4Dns
|
dns := defaultIPv4Dns
|
||||||
if ipv6Enabled {
|
if ipv6Enabled {
|
||||||
logrus.Infof("IPv6 enabled; Adding default IPv6 external servers : %v", defaultIPv6Dns)
|
logrus.Infof("IPv6 enabled; Adding default IPv6 external servers: %v", defaultIPv6Dns)
|
||||||
dns = append(dns, defaultIPv6Dns...)
|
dns = append(dns, defaultIPv6Dns...)
|
||||||
}
|
}
|
||||||
cleanedResolvConf = append(cleanedResolvConf, []byte("\n"+strings.Join(dns, "\n"))...)
|
cleanedResolvConf = append(cleanedResolvConf, []byte("\n"+strings.Join(dns, "\n"))...)
|
||||||
|
|
Loading…
Add table
Reference in a new issue