cni

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 28 Imported by: 16

Documentation

Index

Constants

View Source
const CNIAdd command = "ADD"

CNIAdd is the command representing add operation for a new pod

View Source
const CNIDel command = "DEL"

CNIDel is the command representing delete operation on a pod that is to be torn down

View Source
const CNIUpdate command = "UPDATE"

CNIUpdate is the command representing update operation for an existing pod

Variables

This section is empty.

Functions

func HandleCNIRequest

func HandleCNIRequest(request *PodRequest) ([]byte, error)

HandleCNIRequest is the callback for all the requests coming to the cniserver after being procesed into PodRequest objects Argument '*PodRequest' encapsulates all the necessary information Return value is the actual bytes to be sent back without further processing.

Types

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin is the structure to hold the endpoint information and the corresponding functions to use it

func NewCNIPlugin

func NewCNIPlugin(socketPath string) *Plugin

NewCNIPlugin creates the internal Plugin object

func (*Plugin) CmdAdd

func (p *Plugin) CmdAdd(args *skel.CmdArgs) error

CmdAdd is the callback for 'add' cni calls from skel

func (*Plugin) CmdDel

func (p *Plugin) CmdDel(args *skel.CmdArgs) error

CmdDel is the callback for 'teardown' cni calls from skel

type PodRequest

type PodRequest struct {
	// The CNI command of the operation
	Command command
	// kubernetes namespace name
	PodNamespace string
	// kubernetes pod name
	PodName string
	// kubernetes container ID
	SandboxID string
	// kernel network namespace path
	Netns string
	// Interface name to be configured
	IfName string
	// CNI conf obtained from stdin conf
	CNIConf *types.NetConf
	// Channel for returning the operation result to the Server
	Result chan *PodResult
}

PodRequest structure built from Request which is passed to the handler function given to the Server at creation time

func (*PodRequest) ConfigureInterface

func (pr *PodRequest) ConfigureInterface(namespace string, podName string, macAddress string, ipAddress string, gatewayIP string, mtu int, ingress, egress int64) ([]*current.Interface, error)

ConfigureInterface sets up the container interface

func (*PodRequest) PlatformSpecificCleanup

func (pr *PodRequest) PlatformSpecificCleanup() error

PlatformSpecificCleanup deletes the OVS port

type PodResult

type PodResult struct {
	// Response to be returned to the OVN CNI plugin on success
	Response []byte
	// Error to be returned to the OVN CNI plugin on failure
	Err error
}

PodResult of a PodRequest sent through the PodRequest's Result channel.

type Request

type Request struct {
	// CNI environment variables, like CNI_COMMAND and CNI_NETNS
	Env map[string]string `json:"env,omitempty"`
	// CNI configuration passed via stdin to the CNI plugin
	Config []byte `json:"config,omitempty"`
}

Request sent to the Server by the OVN CNI plugin

type Server

type Server struct {
	http.Server
	// contains filtered or unexported fields
}

Server object that listens for JSON-marshaled Request objects on a private root-only Unix domain socket.

func NewCNIServer

func NewCNIServer(rundir string) *Server

NewCNIServer creates and returns a new Server object which will listen on a socket in the given path

func (*Server) Start

func (s *Server) Start(requestFunc cniRequestFunc) error

Start the Server's local HTTP server on a root-owned Unix domain socket. requestFunc will be called to handle pod setup/teardown operations on each request to the Server's HTTP server, and should return a PodResult when the operation has completed.

Jump to

Keyboard shortcuts

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