network-controller

module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2018 License: Apache-2.0

README

CNI Network Controller Build Status codecov Go Report Card Docker Build Status

overview

Open vSwitch, Multiple network interfaces that associate with kubernetes pods, etc.

Table of Contents

Development

# generate protocol buffer
make pb

# make server binary
make server

# make client binary
make client

# make test (You should run this before push codes)
make test

Usage

Run as a server

The network-controller server provide two ways to listen, TCP and Unix domain socket
If you want to run as a UNIX domain socket server, you should specify a path to store the sock file
and server will remove that file when server is been terminated

./server/network-controller-server -unix=/tmp/a.sock

For the TCP server, just use the IP:PORT format, for example, 0.0.0.0:50051

./server/network-controller-server -tcp=0.0.0.0:50051
Run as a client

The clinet is used for the kubernetes pod to create the veth and you can see the example yaml in example/kubernetes/*.yaml to see how to use this client.

For creating a veth for Pod, the client needs the following information

  • Pod Name
  • Pod Namespace
  • Pod UUID
  • Target Bridge Name
  • The Interface Name in the container
  • IP Address of the interface in the container
  • Add VLAN tag into the interface
  • Add a IP routing table(Add route)
  • The server address

The first three variable can passed by the environemtn POD_NAME, POD_NAMESPACE and POD_UUID.

Bridge Name

-b or --bridge Target bridge name

Interface Name

-n or --nic The interface name in the container

IP Address of the interface

-i or --ip The ip address of the interface, should be a valid v4 CIDR Address

Add VLAN tag into the interface

-v or --vlan The Vlan Tag of the interface

Add a IP routing table(Add route)

--net The destination network for add IP routing table, like '-net target'
-g or --gateway The gateway of the interface subnet

Servers

The clinet support two way to connect to the server, TCP socket and UNIX domain socket.
In the TCP mode, use the IP:PORT format to connect to TCP server

./client/network-controller-client -server=0.0.0.0:50051

Fot the UNIX domain socket mode, you should use the unix://PATH format to connect to server.
Assume the path is /tmp/a.sock and you can use the following command to connect

./client/network-controller-client -server=unix:///tmp/a.sock
Example

Following is an example of the client and you can see more use the --help.

./clinet/network-controller-client -s unix:///tmp/vortex/vortex.sock -b br100 -n eth100 -i 192.168.2.2/24 --net 239.0.0.0/4 -g 0.0.0.0

Directories

Path Synopsis
Package messages is a generated protocol buffer package.
Package messages is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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