cni

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNetNS

func CreateNetNS(name string) error

CreateNetNS creates new network namespace using provided name.

func DestroyNetNS

func DestroyNetNS(name string) error

DestroyNetNS deletes the network namespace pointed by provided name.

func GetPodIP added in v0.8.0

func GetPodIP(result *cnicurrent.Result) string

GetPodIP retrieves the IP address of the pod as a string. It uses the first IPv4 address if finds. If it fails to determine the pod IP or the result argument is nil, it returns an empty string.

func NewClient

func NewClient(pluginsDir, configsDir string) (*client, error)

NewClient returns a client perpared to call plugins in `pluginsDir` using configurations found in `configsDir`.

func PodNetNSPath

func PodNetNSPath(name string) string

PodNetNSPath converts netns name to its path in host filesystem.

func ReadConfiguration

func ReadConfiguration(configDir string) (*libcni.NetworkConfigList, error)

ReadConfiguration iterates over CNI config files in a directory and returns first configuration with non empty Plugins list.

Types

type Client

type Client interface {
	// AddSandboxToNetwork adds a pod sandbox to the CNI network.
	AddSandboxToNetwork(podID, podName, podNs string) (*cnicurrent.Result, error)
	// RemoveSandboxFromNetwork removes a pod sandbox from the CNI network.
	RemoveSandboxFromNetwork(podID, podName, podNs string) error
	// GetDummyNetwork creates a dummy network using CNI plugin.
	// It's used for making a dummy gateway for Calico CNI plugin.
	// It returns a CNI result and a path to the network namespace.
	GetDummyNetwork() (*cnicurrent.Result, string, error)
}

Client provides an interface to CNI plugins.

Jump to

Keyboard shortcuts

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