Documentation ¶
Index ¶
- Constants
- Variables
- func ConfFiles(dir string, extensions []string) ([]string, error)
- type CNI
- type CNIConfig
- func (c *CNIConfig) AddNetwork(ctx context.Context, net *NetworkConfig, rt *RuntimeConf) (types.Result, error)
- func (c *CNIConfig) AddNetworkList(ctx context.Context, list *NetworkConfigList, rt *RuntimeConf) (types.Result, error)
- func (c *CNIConfig) CheckNetwork(ctx context.Context, net *NetworkConfig, rt *RuntimeConf) error
- func (c *CNIConfig) CheckNetworkList(ctx context.Context, list *NetworkConfigList, rt *RuntimeConf) error
- func (c *CNIConfig) DelNetwork(ctx context.Context, net *NetworkConfig, rt *RuntimeConf) error
- func (c *CNIConfig) DelNetworkList(ctx context.Context, list *NetworkConfigList, rt *RuntimeConf) error
- func (c *CNIConfig) GetNetworkCachedConfig(net *NetworkConfig, rt *RuntimeConf) ([]byte, *RuntimeConf, error)
- func (c *CNIConfig) GetNetworkCachedResult(net *NetworkConfig, rt *RuntimeConf) (types.Result, error)
- func (c *CNIConfig) GetNetworkListCachedConfig(list *NetworkConfigList, rt *RuntimeConf) ([]byte, *RuntimeConf, error)
- func (c *CNIConfig) GetNetworkListCachedResult(list *NetworkConfigList, rt *RuntimeConf) (types.Result, error)
- func (c *CNIConfig) GetVersionInfo(ctx context.Context, pluginType string) (version.PluginInfo, error)
- func (c *CNIConfig) ValidateNetwork(ctx context.Context, net *NetworkConfig) ([]string, error)
- func (c *CNIConfig) ValidateNetworkList(ctx context.Context, list *NetworkConfigList) ([]string, error)
- type NetworkConfig
- type NetworkConfigList
- type NoConfigsFoundError
- type NotFoundError
- type RuntimeConf
Constants ¶
const (
CNICacheV1 = "cniCacheV1"
)
Variables ¶
var (
CacheDir = "/var/lib/cni"
)
Functions ¶
Types ¶
type CNI ¶
type CNI interface { AddNetworkList(ctx context.Context, net *NetworkConfigList, rt *RuntimeConf) (types.Result, error) CheckNetworkList(ctx context.Context, net *NetworkConfigList, rt *RuntimeConf) error DelNetworkList(ctx context.Context, net *NetworkConfigList, rt *RuntimeConf) error GetNetworkListCachedResult(net *NetworkConfigList, rt *RuntimeConf) (types.Result, error) GetNetworkListCachedConfig(net *NetworkConfigList, rt *RuntimeConf) ([]byte, *RuntimeConf, error) AddNetwork(ctx context.Context, net *NetworkConfig, rt *RuntimeConf) (types.Result, error) CheckNetwork(ctx context.Context, net *NetworkConfig, rt *RuntimeConf) error DelNetwork(ctx context.Context, net *NetworkConfig, rt *RuntimeConf) error GetNetworkCachedResult(net *NetworkConfig, rt *RuntimeConf) (types.Result, error) GetNetworkCachedConfig(net *NetworkConfig, rt *RuntimeConf) ([]byte, *RuntimeConf, error) ValidateNetworkList(ctx context.Context, net *NetworkConfigList) ([]string, error) ValidateNetwork(ctx context.Context, net *NetworkConfig) ([]string, error) }
type CNIConfig ¶
type CNIConfig struct { Path []string // contains filtered or unexported fields }
func NewCNIConfig ¶ added in v0.7.0
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 NewCNIConfigWithCacheDir ¶ added in v0.8.0
NewCNIConfigWithCacheDir returns a new CNIConfig object that will search for plugins in the given paths use the given exec interface to run those plugins, or if the exec interface is not given, will use a default exec handler. The given cache directory will be used for temporary data storage when needed.
func (*CNIConfig) AddNetwork ¶
func (c *CNIConfig) AddNetwork(ctx context.Context, 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(ctx context.Context, list *NetworkConfigList, rt *RuntimeConf) (types.Result, error)
AddNetworkList executes a sequence of plugins with the ADD command
func (*CNIConfig) CheckNetwork ¶ added in v0.7.0
func (c *CNIConfig) CheckNetwork(ctx context.Context, net *NetworkConfig, rt *RuntimeConf) error
CheckNetwork executes the plugin with the CHECK command
func (*CNIConfig) CheckNetworkList ¶ added in v0.7.0
func (c *CNIConfig) CheckNetworkList(ctx context.Context, list *NetworkConfigList, rt *RuntimeConf) error
CheckNetworkList executes a sequence of plugins with the CHECK command
func (*CNIConfig) DelNetwork ¶
func (c *CNIConfig) DelNetwork(ctx context.Context, 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(ctx context.Context, list *NetworkConfigList, rt *RuntimeConf) error
DelNetworkList executes a sequence of plugins with the DEL command
func (*CNIConfig) GetNetworkCachedConfig ¶ added in v0.8.0
func (c *CNIConfig) GetNetworkCachedConfig(net *NetworkConfig, rt *RuntimeConf) ([]byte, *RuntimeConf, error)
GetNetworkCachedConfig copies the input RuntimeConf to output RuntimeConf with fields updated with info from the cached Config.
func (*CNIConfig) GetNetworkCachedResult ¶ added in v0.7.0
func (c *CNIConfig) GetNetworkCachedResult(net *NetworkConfig, rt *RuntimeConf) (types.Result, error)
GetNetworkCachedResult returns the cached Result of the previous AddNetwork() operation for a network, or an error.
func (*CNIConfig) GetNetworkListCachedConfig ¶ added in v0.8.0
func (c *CNIConfig) GetNetworkListCachedConfig(list *NetworkConfigList, rt *RuntimeConf) ([]byte, *RuntimeConf, error)
GetNetworkListCachedConfig copies the input RuntimeConf to output RuntimeConf with fields updated with info from the cached Config.
func (*CNIConfig) GetNetworkListCachedResult ¶ added in v0.7.0
func (c *CNIConfig) GetNetworkListCachedResult(list *NetworkConfigList, rt *RuntimeConf) (types.Result, error)
GetNetworkListCachedResult returns the cached Result of the previous AddNetworkList() operation for a network list, or an error.
func (*CNIConfig) GetVersionInfo ¶ added in v0.4.0
func (c *CNIConfig) GetVersionInfo(ctx context.Context, pluginType string) (version.PluginInfo, error)
GetVersionInfo reports which versions of the CNI spec are supported by the given plugin.
func (*CNIConfig) ValidateNetwork ¶ added in v0.7.0
ValidateNetwork checks that a configuration is reasonably valid. It uses the same logic as ValidateNetworkList) Returns a list of capabilities
func (*CNIConfig) ValidateNetworkList ¶ added in v0.7.0
func (c *CNIConfig) ValidateNetworkList(ctx context.Context, list *NetworkConfigList) ([]string, error)
ValidateNetworkList checks that a configuration is reasonably valid. - all the specified plugins exist on disk - every plugin supports the desired version.
Returns a list of all capabilities supported by the configuration, or error
type NetworkConfig ¶
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 DisableCheck bool 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
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{} // DEPRECATED. Will be removed in a future release. 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.