skel

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package skel provides skeleton code for a CNI plugin. In particular, it implements argument parsing and validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PluginMain

func PluginMain(cmdAdd, cmdDel func(_ *CmdArgs) error, versionInfo version.PluginInfo)

PluginMain is the core "main" for a plugin which includes automatic error handling.

The caller must also specify what CNI spec versions the plugin supports.

When an error occurs in either cmdAdd or cmdDel, PluginMain will print the error as JSON to stdout and call os.Exit(1).

To have more control over error handling, use PluginMainWithError() instead.

func PluginMainWithError added in v0.5.0

func PluginMainWithError(cmdAdd, cmdDel func(_ *CmdArgs) error, versionInfo version.PluginInfo) *types.Error

PluginMainWithError is the core "main" for a plugin. It accepts callback functions for add and del CNI commands and returns an error.

The caller must also specify what CNI spec versions the plugin supports.

It is the responsibility of the caller to check for non-nil error return.

For a plugin to comply with the CNI spec, it must print any error to stdout as JSON and then exit with nonzero status code.

To let this package automatically handle errors and call os.Exit(1) for you, use PluginMain() instead.

Types

type CmdArgs

type CmdArgs struct {
	ContainerID string
	Netns       string
	IfName      string
	Args        string
	Path        string
	StdinData   []byte
}

CmdArgs captures all the arguments passed in to the plugin via both env vars and stdin

Jump to

Keyboard shortcuts

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