libcni

package
v0.7.0-alpha1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CacheDir = "/var/lib/cni"
)

Functions

func ConfFiles

func ConfFiles(dir string, extensions []string) ([]string, error)

Types

type CNI

type CNI interface {
	AddNetworkList(net *NetworkConfigList, rt *RuntimeConf) (types.Result, error)
	GetNetworkList(net *NetworkConfigList, rt *RuntimeConf) (types.Result, error)
	DelNetworkList(net *NetworkConfigList, rt *RuntimeConf) error

	AddNetwork(net *NetworkConfig, rt *RuntimeConf) (types.Result, error)
	GetNetwork(net *NetworkConfig, rt *RuntimeConf) (types.Result, error)
	DelNetwork(net *NetworkConfig, rt *RuntimeConf) error
}

type CNIConfig

type CNIConfig struct {
	Path []string
	// contains filtered or unexported fields
}

func NewCNIConfig added in v0.7.0

func NewCNIConfig(path []string, exec invoke.Exec) *CNIConfig

NewCNIConfig returns a new CNIConfig object that will search for plugins in the given paths and use the given exec interface to run those plugins, or if the exec interface is not given, will use a default exec handler.

func (*CNIConfig) AddNetwork

func (c *CNIConfig) AddNetwork(net *NetworkConfig, rt *RuntimeConf) (types.Result, error)

AddNetwork executes the plugin with the ADD command

func (*CNIConfig) AddNetworkList added in v0.5.0

func (c *CNIConfig) AddNetworkList(list *NetworkConfigList, rt *RuntimeConf) (types.Result, error)

AddNetworkList executes a sequence of plugins with the ADD command

func (*CNIConfig) DelNetwork

func (c *CNIConfig) DelNetwork(net *NetworkConfig, rt *RuntimeConf) error

DelNetwork executes the plugin with the DEL command

func (*CNIConfig) DelNetworkList added in v0.5.0

func (c *CNIConfig) DelNetworkList(list *NetworkConfigList, rt *RuntimeConf) error

DelNetworkList executes a sequence of plugins with the DEL command

func (*CNIConfig) GetNetwork

func (c *CNIConfig) GetNetwork(net *NetworkConfig, rt *RuntimeConf) (types.Result, error)

GetNetwork executes the plugin with the GET command

func (*CNIConfig) GetNetworkList

func (c *CNIConfig) GetNetworkList(list *NetworkConfigList, rt *RuntimeConf) (types.Result, error)

GetNetworkList executes a sequence of plugins with the GET command

func (*CNIConfig) GetVersionInfo added in v0.4.0

func (c *CNIConfig) GetVersionInfo(pluginType string) (version.PluginInfo, error)

GetVersionInfo reports which versions of the CNI spec are supported by the given plugin.

type NetworkConfig

type NetworkConfig struct {
	Network *types.NetConf
	Bytes   []byte
}

func ConfFromBytes

func ConfFromBytes(bytes []byte) (*NetworkConfig, error)

func ConfFromFile

func ConfFromFile(filename string) (*NetworkConfig, error)

func InjectConf added in v0.4.0

func InjectConf(original *NetworkConfig, newValues map[string]interface{}) (*NetworkConfig, error)

func LoadConf

func LoadConf(dir, name string) (*NetworkConfig, error)

type NetworkConfigList added in v0.5.0

type NetworkConfigList struct {
	Name       string
	CNIVersion string
	Plugins    []*NetworkConfig
	Bytes      []byte
}

func ConfListFromBytes added in v0.5.0

func ConfListFromBytes(bytes []byte) (*NetworkConfigList, error)

func ConfListFromConf added in v0.5.0

func ConfListFromConf(original *NetworkConfig) (*NetworkConfigList, error)

ConfListFromConf "upconverts" a network config in to a NetworkConfigList, with the single network as the only entry in the list.

func ConfListFromFile added in v0.5.0

func ConfListFromFile(filename string) (*NetworkConfigList, error)

func LoadConfList added in v0.5.0

func LoadConfList(dir, name string) (*NetworkConfigList, error)

type NoConfigsFoundError added in v0.5.0

type NoConfigsFoundError struct {
	Dir string
}

func (NoConfigsFoundError) Error added in v0.5.2

func (e NoConfigsFoundError) Error() string

type NotFoundError added in v0.5.0

type NotFoundError struct {
	Dir  string
	Name string
}

func (NotFoundError) Error added in v0.5.0

func (e NotFoundError) Error() string

type RuntimeConf

type RuntimeConf struct {
	ContainerID string
	NetNS       string
	IfName      string
	Args        [][2]string
	// A dictionary of capability-specific data passed by the runtime
	// to plugins as top-level keys in the 'runtimeConfig' dictionary
	// of the plugin's stdin data.  libcni will ensure that only keys
	// in this map which match the capabilities of the plugin are passed
	// to the plugin
	CapabilityArgs map[string]interface{}

	// A cache directory in which to library data.  Defaults to CacheDir
	CacheDir string
}

A RuntimeConf holds the arguments to one invocation of a CNI plugin excepting the network configuration, with the nested exception that the `runtimeConfig` from the network configuration is included here.

Jump to

Keyboard shortcuts

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