Documentation ¶
Index ¶
- Variables
- func DelegateAdd(delegatePlugin string, netconf []byte, exec Exec) (types.Result, error)
- func DelegateDel(delegatePlugin string, netconf []byte, exec Exec) error
- func DelegateGet(delegatePlugin string, netconf []byte, exec Exec) (types.Result, error)
- func ExecPluginWithResult(pluginPath string, netconf []byte, args CNIArgs, exec Exec) (types.Result, error)
- func ExecPluginWithoutResult(pluginPath string, netconf []byte, args CNIArgs, exec Exec) error
- func FindInPath(plugin string, paths []string) (string, error)
- func GetVersionInfo(pluginPath string, exec Exec) (version.PluginInfo, error)
- type Args
- type CNIArgs
- type DefaultExec
- type Exec
- type RawExec
Constants ¶
This section is empty.
Variables ¶
var ExecutableFileExtensions = []string{""}
Valid file extensions for plugin executables.
Functions ¶
func DelegateAdd ¶
DelegateAdd calls the given delegate plugin with the CNI ADD action and JSON configuration
func DelegateDel ¶
DelegateDel calls the given delegate plugin with the CNI DEL action and JSON configuration
func DelegateGet ¶
DelegateGet calls the given delegate plugin with the CNI GET action and JSON configuration
func ExecPluginWithResult ¶
func ExecPluginWithoutResult ¶
func FindInPath ¶
FindInPath returns the full path of the plugin by searching in the provided path
func GetVersionInfo ¶ added in v0.4.0
func GetVersionInfo(pluginPath string, exec Exec) (version.PluginInfo, error)
GetVersionInfo returns the version information available about the plugin. For recent-enough plugins, it uses the information returned by the VERSION command. For older plugins which do not recognize that command, it reports version 0.1.0
Types ¶
type Args ¶
type CNIArgs ¶
type CNIArgs interface { // For use with os/exec; i.e., return nil to inherit the // environment from this process AsEnv() []string }
func ArgsFromEnv ¶
func ArgsFromEnv() CNIArgs
type DefaultExec ¶
type DefaultExec struct { *RawExec version.PluginDecoder }
DefaultExec is an object that implements the Exec interface which looks for and executes plugins from disk.
type Exec ¶
type Exec interface { ExecPlugin(pluginPath string, stdinData []byte, environ []string) ([]byte, error) FindInPath(plugin string, paths []string) (string, error) Decode(jsonBytes []byte) (version.PluginInfo, error) }
Exec is an interface encapsulates all operations that deal with finding and executing a CNI plugin. Tests may provide a fake implementation to avoid writing fake plugins to temporary directories during the test.