cniserver

package
v1.5.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CNIServerSocketPath string = "/var/run/openshift-sdn/cni-server.sock"

Default CNIServer unix domain socket path which the OpenShift SDN CNI plugin uses to talk to the CNIServer

Variables

This section is empty.

Functions

This section is empty.

Types

type CNICommand

type CNICommand string

Explicit type for CNI commands the server handles

const CNI_ADD CNICommand = "ADD"
const CNI_DEL CNICommand = "DEL"
const CNI_UPDATE CNICommand = "UPDATE"

type CNIRequest

type CNIRequest 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 CNIServer by the OpenShift SDN CNI plugin

type CNIServer

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

CNI server object that listens for JSON-marshaled CNIRequest objects on a private root-only Unix domain socket.

func NewCNIServer

func NewCNIServer(socketPath string) *CNIServer

Create and return a new CNIServer object which will listen on the given socket path

func (*CNIServer) Start

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

Start the CNIServer'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 CNIServer's HTTP server, and should return a PodResult when the operation has completed.

type PodRequest

type PodRequest struct {
	// The CNI command of the operation
	Command CNICommand
	// kubernetes namespace name
	PodNamespace string
	// kubernetes pod name
	PodName string
	// kubernetes container ID
	ContainerId string
	// kernel network namespace path
	Netns string
	// Channel for returning the operation result to the CNIServer
	Result chan *PodResult
}

Request structure built from CNIRequest which is passed to the handler function given to the CNIServer at creation time

type PodResult

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

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

Jump to

Keyboard shortcuts

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