cni

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNetNS

func CreateNetNS(name string) error

func DestroyNetNS

func DestroyNetNS(name string) error

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 PodNetNSPath

func PodNetNSPath(name string) string

func ReadConfiguration

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

Types

type CNIClient added in v0.9.4

type CNIClient 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)
}

CNIClient provides an interface to CNI

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

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

func (*Client) AddSandboxToNetwork

func (c *Client) AddSandboxToNetwork(podId, podName, podNs string) (*cnicurrent.Result, error)

AddSandboxToNetwork implements AddSandboxToNetwork method of CNIClient interface

func (*Client) GetDummyNetwork added in v0.9.0

func (c *Client) GetDummyNetwork() (*cnicurrent.Result, string, error)

GetDummyNetwork implements GetDummyNetwork method of CNIClient interface

func (*Client) RemoveSandboxFromNetwork

func (c *Client) RemoveSandboxFromNetwork(podId, podName, podNs string) error

RemoveSandboxFromNetwork implements RemoveSandboxFromNetwork method of CNIClient interface

Jump to

Keyboard shortcuts

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