invoke

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 13 Imported by: 186

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 DelegateGC added in v1.2.0

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

DelegateGC calls the given delegate plugin with the CNI GC action and JSON configuration

func DelegateStatus added in v1.2.0

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

DelegateStatus calls the given delegate plugin with the CNI STATUS 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
	// For use in delegation; inherit the environment from this
	// process and allow overrides
	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 DelegateArgs added in v0.7.1

type DelegateArgs struct {
	Command string
}

func (*DelegateArgs) AsEnv added in v0.7.1

func (d *DelegateArgs) AsEnv() []string

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