netplugin

module
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2015 License: Apache-2.0

README

Build Status

Netplugin

Generic network plugin (experimental) is designed to handle networking use cases in clustered multi-host systems. It is specifically designed to handle:

  • Multi-tenant environment where disjoint networks are offered to containers on the same host
  • SDN applications and interoperability with SDN solutions
  • Interoperability with non container environment and hand-off to a physical network
  • Instantiating policies/ACL/QoS associated with containers
  • Multicast or multi-destination dependent applications
  • Integration with existing IPAM tools for migrating customers
  • Handle NIC's capabilities for acceleration (SRIOV/Offload/etc.)

The overall design is not assumed to be complete, because of ongoing work in the docker community with regards to the suitable APIs to interface with network extensions like this. Regardless, flexibility in the design has been taken into consideration to allow using a different state driver for key-value synchronization, or a different flavor of a soft-switch i.e. linux-bridge, MAC VLAN, or OpenvSwitch.

The ability to specify the intent succinctly is the primary goal of the design and thus some of the specified user interface will change, and in some cases functionality will be enhanced to accommodate the same. Design details and future work is captured in a docs/design.md.

Please do not use this code in production, until code goes through more testing and few critical open issues are resolved.

###Building and Testing

  • Build:

    make build

    Note:

  • Run unit-tests:

    make unit-test

  • Run system-tests:

    make system-test

###Trying it out

The netplugin produces two binaries, a netplugin daemon and a netdcli tool to interact with it. The binaries can tried out in a vagrant environment, which can be setup as follows.

make demo

Note:

  • Make sure VirtualBox is installed

vagrant ssh netplugin-node1

####A quick example

  1. Start netmaster and netplugin

    sudo netmaster sudo netplugin -host-label=host1

  2. Launch a desired configuration for the two containers

    netdcli -cfg examples/one_host_vlan.json

  3. According to the desired network state myContainer1 and myContainer2 now belongs to orange network

    {
        "Tenants" : [{
            "Name"                      : "tenant-one",
            "DefaultNetType"            : "vlan",
            "SubnetPool"                : "11.1.0.0/16",
            "AllocSubnetLen"            : 24,
            "Vlans"                     : "11-28",
            "Networks"  : [{
                "Name"                  : "orange",
                "Endpoints" : [{
                    "Host"              : "host1",
                    "Container"         : "myContainer1"
                }, {
                    "Host"              : "host1",
                    "Container"         : "myContainer2"
                }]
            }]
        }]
    }
    

    If we examine the desired network state, it allows specifying the type of network as vlan, and subnet pools; those options are not mandatory but can be specified to override default values

  4. Create the containers myContainer1 and myContainer2

    sudo docker run -it --name=myContainer1 --hostname=myContainer1 ubuntu /bin/bash

    sudo docker run -it --name=myContainer2 --hostname=myContainer2 ubuntu /bin/bash

The creation of containers would automatically apply the network configuration as specified indicated in the network earlier. The same works for multi-host environment. And when containers are scheduled dynamically in a multi-host environment, host information need not be specified explicitly.

  1. The configuration remains persistent, i.e. myContainer1 and myContainer2 can come and go

There are many variations to the above configuration, like creating multiple networks, across multiple hosts, use of VLANs, use of VXLAN, custom overrides for IP/subnet/VLAN/VXLAN allocation on per network/endpoint basis. Please look at examples directory to explore more sample configurations.

####Trying it out in a multi-host VLAN/VXLAN network

The docs/TwoHostMultiVlanDemo.md walks through setting up a multi host demo network and deploy the following Vlan based network: VlanNetwork

One can deploy the following Vxlan network by following the steps in the above demo and using examples/two_hosts_multiple_vxlan_nets.json configuration file instead. Trying out the configuration is left as an exercise to the reader. VxlanNetwork

####Multi-tenant network

In the examples directory two_hosts_multiple_tenants.json and two_hosts_multiple_tenants_mix_vlan_vxlan.json shows the creation of a multi-tenant (disjoint, overlapping) networks within a cluster.

####Trying the multi-host tests on a single machine using docker as hosts If you cannot launch VM on your host, especially if your host is itself a VM, one can test the multi-host network by simulating hosts using docker containers. Please see docs/Dockerhost.md for instructions.

Resource Allocation

Various network resources like, IP-Subnets, VLAN/VXLAN-IDs, IP Addresses, can be automatically managed or they can be specified at network/endpoint granularity. To avoid any conflict with rest of the network, it is encouraged to specify the resource ranges, but when not specified, the resource-allocator can pick up the default values.

Kubernetes Integration

The plugin code contains the netplugin code that interfaces with kublet to allow network plumbing before a container is scheduled on one of the minions. Please see Kubernetes Integration for details

How to Contribute

Patches and contributions are welcome, please hit the GitHub page to open an issue or to submit patches send pull requests. Please sign your commits, and read CONTRIBUTING.md

Directories

Path Synopsis
Godeps
_workspace/src/github.com/cenkalti/hub
Package hub provides a simple event dispatcher for publish/subscribe pattern.
Package hub provides a simple event dispatcher for publish/subscribe pattern.
_workspace/src/github.com/cenkalti/rpc2
Package rpc2 provides bi-directional RPC client and server similar to net/rpc.
Package rpc2 provides bi-directional RPC client and server similar to net/rpc.
_workspace/src/github.com/cenkalti/rpc2/jsonrpc
Package jsonrpc implements a JSON-RPC ClientCodec and ServerCodec for the rpc2 package.
Package jsonrpc implements a JSON-RPC ClientCodec and ServerCodec for the rpc2 package.
_workspace/src/github.com/contiv/ofnet
** Copyright 2014 Cisco Systems Inc.
** Copyright 2014 Cisco Systems Inc.
_workspace/src/github.com/contiv/ofnet/ofctrl
** Copyright 2014 Cisco Systems Inc.
** Copyright 2014 Cisco Systems Inc.
_workspace/src/github.com/contiv/ofnet/rpcHub
** Copyright 2014 Cisco Systems Inc.
** Copyright 2014 Cisco Systems Inc.
_workspace/src/github.com/docker/docker/pkg/listenbuffer
Package listenbuffer uses the kernel's listening backlog functionality to queue connections, allowing applications to start listening immediately and handle connections later.
Package listenbuffer uses the kernel's listening backlog functionality to queue connections, allowing applications to start listening immediately and handle connections later.
_workspace/src/github.com/docker/docker/pkg/plugins
Package plugins provides structures and helper functions to manage Docker plugins.
Package plugins provides structures and helper functions to manage Docker plugins.
_workspace/src/github.com/docker/docker/pkg/sockets
Package sockets provides helper functions to create and configure Unix or TCP sockets.
Package sockets provides helper functions to create and configure Unix or TCP sockets.
_workspace/src/github.com/docker/docker/pkg/tlsconfig
Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers.
Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers.
_workspace/src/github.com/docker/docker/pkg/units
Package units provides helper function to parse and print size and time units in human-readable format.
Package units provides helper function to parse and print size and time units in human-readable format.
_workspace/src/github.com/docker/libnetwork/drivers/remote/api
Package api represents all requests and responses suitable for conversation with a remote driver.
Package api represents all requests and responses suitable for conversation with a remote driver.
_workspace/src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
_workspace/src/github.com/jainvipin/bitset
Package bitset implements bitsets, a mapping between non-negative integers and boolean values.
Package bitset implements bitsets, a mapping between non-negative integers and boolean values.
_workspace/src/github.com/vishvananda/netlink
Package netlink provides a simple library for netlink.
Package netlink provides a simple library for netlink.
_workspace/src/github.com/vishvananda/netlink/nl
Package nl has low level primitives for making Netlink calls.
Package nl has low level primitives for making Netlink calls.
_workspace/src/golang.org/x/crypto/ssh
Package ssh implements an SSH client and server.
Package ssh implements an SSH client and server.
_workspace/src/golang.org/x/crypto/ssh/agent
Package agent implements a client to an ssh-agent daemon.
Package agent implements a client to an ssh-agent daemon.
_workspace/src/golang.org/x/crypto/ssh/terminal
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
_workspace/src/golang.org/x/crypto/ssh/test
This package contains integration tests for the golang.org/x/crypto/ssh package.
This package contains integration tests for the golang.org/x/crypto/ssh package.
Package core provides definition for a generic interface that helps provision networking for an endpoint (like a container, a vm or a bare-metal host).
Package core provides definition for a generic interface that helps provision networking for an endpoint (like a container, a vm or a bare-metal host).
mgmtfn
systemtests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL