cniserver

package
v3.11.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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"`
	DNSIP              string `json:"dnsIP"`
}

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