invoke

package
v0.7.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func DelegateCheck(ctx context.Context, delegatePlugin string, netconf []byte, exec Exec) error

DelegateCheck calls the given delegate plugin with the CNI CHECK action and JSON configuration

func DelegateDel

func DelegateDel(ctx context.Context, delegatePlugin string, netconf []byte, exec Exec) error

DelegateDel calls the given delegate plugin with the CNI DEL action and JSON configuration

func ExecPluginWithResult

func ExecPluginWithResult(ctx context.Context, pluginPath string, netconf []byte, args CNIArgs, exec Exec) (types.Result, error)

func ExecPluginWithoutResult

func ExecPluginWithoutResult(ctx context.Context, pluginPath string, netconf []byte, args CNIArgs, exec Exec) error

func FindInPath

func FindInPath(plugin string, paths []string) (string, error)

FindInPath returns the full path of the plugin by searching in the provided path

func GetVersionInfo added in v0.4.0

func GetVersionInfo(ctx context.Context, 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 Args struct {
	Command       string
	ContainerID   string
	NetNS         string
	PluginArgs    [][2]string
	PluginArgsStr string
	IfName        string
	Path          string
}

func (*Args) AsEnv

func (args *Args) AsEnv() []string

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.

type RawExec added in v0.4.0

type RawExec struct {
	Stderr io.Writer
}

func (*RawExec) ExecPlugin added in v0.4.0

func (e *RawExec) ExecPlugin(ctx context.Context, pluginPath string, stdinData []byte, environ []string) ([]byte, error)

func (*RawExec) FindInPath added in v0.7.0

func (e *RawExec) FindInPath(plugin string, paths []string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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