cniserver

package
v3.10.15-1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CNIServerConfigFileName string = "config.json"

Config file contains server to plugin config data

View Source
const CNIServerConfigFilePath string = CNIServerRunDir + "/" + CNIServerConfigFileName
View Source
const CNIServerRunDir string = "/var/run/openshift-sdn"

Default directory for CNIServer runtime files

View Source
const CNIServerSocketName string = "cni-server.sock"

CNIServer socket name, and default full path

View Source
const CNIServerSocketPath string = CNIServerRunDir + "/" + CNIServerSocketName

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"`
	// Host side of the veth pair (for an ADD command)
	HostVeth string `json:"hostVeth,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(rundir string, config *Config) *CNIServer

Create and return a new CNIServer object which will listen on a socket in the given 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 Config

type Config struct {
	MTU                uint32 `json:"mtu"`
	ServiceNetworkCIDR string `json:"serviceNetworkCIDR"`
}

Server-to-plugin config data

func ReadConfig

func ReadConfig(configPath string) (*Config, error)

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
	SandboxID string
	// kernel network namespace path
	Netns string
	// for an ADD request, the host side of the created veth
	HostVeth 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