Documentation ¶
Index ¶
- Variables
- func DelegateAdd(ctx context.Context, delegatePlugin string, netconf []byte, exec Exec) (types.Result, error)
- func DelegateCheck(ctx context.Context, delegatePlugin string, netconf []byte, exec Exec) error
- func DelegateDel(ctx context.Context, delegatePlugin string, netconf []byte, exec Exec) error
- func ExecPluginWithResult(ctx context.Context, pluginPath string, netconf []byte, args CNIArgs, ...) (types.Result, error)
- func ExecPluginWithoutResult(ctx context.Context, pluginPath string, netconf []byte, args CNIArgs, ...) error
- func FindInPath(plugin string, paths []string) (string, error)
- func GetVersionInfo(ctx context.Context, 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 ¶
func DelegateAdd(ctx context.Context, delegatePlugin string, netconf []byte, exec Exec) (types.Result, error)
DelegateAdd calls the given delegate plugin with the CNI ADD action and JSON configuration
func DelegateCheck ¶ added in v0.7.0
DelegateCheck calls the given delegate plugin with the CNI CHECK action and JSON configuration
func DelegateDel ¶
DelegateDel calls the given delegate plugin with the CNI DEL 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
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 ¶ added in v0.7.0
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 ¶ added in v0.7.0
type Exec interface { ExecPlugin(ctx context.Context, 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.