version

package
v0.56.3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var All = PluginSupports("0.1.0", "0.2.0", "0.3.0", "0.3.1")
View Source
var Legacy = PluginSupports("0.1.0", "0.2.0")

Legacy PluginInfo describes a plugin that is backwards compatible with the CNI spec version 0.1.0. In particular, a runtime compiled against the 0.1.0 library ought to work correctly with a plugin that reports support for Legacy versions.

Any future CNI spec versions which meet this definition should be added to this list.

Functions

func Current

func Current() string

Current reports the version of the CNI spec implemented by this library

func NewResult

func NewResult(version string, resultBytes []byte) (types.Result, error)

Finds a Result object matching the requested version (if any) and asks that object to parse the plugin result, returning an error if parsing failed.

Types

type ConfigDecoder

type ConfigDecoder struct{}

ConfigDecoder can decode the CNI version available in network config data

func (*ConfigDecoder) Decode

func (*ConfigDecoder) Decode(jsonBytes []byte) (string, error)

type ErrorIncompatible

type ErrorIncompatible struct {
	Config    string
	Supported []string
}

func (*ErrorIncompatible) Details

func (e *ErrorIncompatible) Details() string

func (*ErrorIncompatible) Error

func (e *ErrorIncompatible) Error() string

type PluginDecoder

type PluginDecoder struct{}

PluginDecoder can decode the response returned by a plugin's VERSION command

func (*PluginDecoder) Decode

func (*PluginDecoder) Decode(jsonBytes []byte) (PluginInfo, error)

type PluginInfo

type PluginInfo interface {
	// SupportedVersions returns one or more CNI spec versions that the plugin
	// supports.  If input is provided in one of these versions, then the plugin
	// promises to use the same CNI version in its response
	SupportedVersions() []string

	// Encode writes this CNI version information as JSON to the given Writer
	Encode(io.Writer) error
}

PluginInfo reports information about CNI versioning

func PluginSupports

func PluginSupports(supportedVersions ...string) PluginInfo

PluginSupports returns a new PluginInfo that will report the given versions as supported

type Reconciler

type Reconciler struct{}

func (*Reconciler) Check

func (r *Reconciler) Check(configVersion string, pluginInfo PluginInfo) *ErrorIncompatible

func (*Reconciler) CheckRaw

func (*Reconciler) CheckRaw(configVersion string, supportedVersions []string) *ErrorIncompatible

Jump to

Keyboard shortcuts

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