ocicni

package
v0.0.0-...-6ccaa80 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

README

ocicni

API layer to call the CNI plugins from an OCI lifecycle daemon

Documentation

Index

Constants

View Source
const (
	// DefaultInterfaceName is the string to be used for the interface name inside the net namespace
	DefaultInterfaceName = "eth0"
	// CNIPluginName is the default name of the plugin
	CNIPluginName = "cni"
	// DefaultNetDir is the place to look for CNI Network
	DefaultNetDir = "/etc/cni/net.d"
	// DefaultCNIDir is the place to look for cni config files
	DefaultCNIDir = "/opt/cni/bin"
	// VendorCNIDirTemplate is the template for looking up vendor specific cni config/executable files
	VendorCNIDirTemplate = "%s/opt/%s/bin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CNIPlugin

type CNIPlugin interface {
	// Name returns the plugin's name. This will be used when searching
	// for a plugin by name, e.g.
	Name() string

	// SetUpPod is the method called after the infra container of
	// the pod has been created but before the other containers of the
	// pod are launched.
	SetUpPod(netnsPath string, namespace string, name string, containerID string) error

	// TearDownPod is the method called before a pod's infra container will be deleted
	TearDownPod(netnsPath string, namespace string, name string, containerID string) error

	// Status is the method called to obtain the ipv4 or ipv6 addresses of the container
	GetContainerNetworkStatus(netnsPath string, namespace string, name string, containerID string) (string, error)

	// NetworkStatus returns error if the network plugin is in error state
	Status() error
}

CNIPlugin is the interface that needs to be implemented by a plugin

func InitCNI

func InitCNI(pluginDir string, cniDirs ...string) (CNIPlugin, error)

InitCNI takes the plugin directory and cni directories where the cni files should be searched for Returns a valid plugin object and any error

Jump to

Keyboard shortcuts

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