package invoke
import "github.com/containernetworking/cni/pkg/invoke"
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 DelegateGC(ctx context.Context, delegatePlugin string, netconf []byte, exec Exec) error
- func DelegateStatus(ctx context.Context, delegatePlugin string, netconf []byte, exec Exec) error
- func ExecPluginWithResult(ctx context.Context, pluginPath string, netconf []byte, args CNIArgs, exec Exec) (types.Result, error)
- func ExecPluginWithoutResult(ctx context.Context, pluginPath string, netconf []byte, args CNIArgs, exec Exec) 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 DelegateArgs
- type Exec
- type RawExec
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 ¶
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 DelegateGC ¶
DelegateGC calls the given delegate plugin with the CNI GC action and JSON configuration
func DelegateStatus ¶
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 ¶
FindInPath returns the full path of the plugin by searching in the provided path
func GetVersionInfo ¶
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 ¶
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 ¶
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 ¶
type DelegateArgs struct { Command string }
func (*DelegateArgs) AsEnv ¶
func (d *DelegateArgs) AsEnv() []string
type Exec ¶
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 ¶
func (*RawExec) ExecPlugin ¶
func (e *RawExec) ExecPlugin(ctx context.Context, pluginPath string, stdinData []byte, environ []string) ([]byte, error)
func (*RawExec) FindInPath ¶
Source Files ¶
args.go delegate.go exec.go find.go os_unix.go raw_exec.go
Directories ¶
Path | Synopsis |
---|---|
pkg/invoke/fakes |
- Version
- v1.3.0 (latest)
- Published
- Apr 7, 2025
- Platform
- linux/amd64
- Imports
- 13 packages
- Last checked
- 1 week ago –
Tools for package owners.