stub

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 13 Imported by: 30

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigureInterface

type ConfigureInterface interface {
	// Configure the plugin with the given NRI-supplied configuration.
	// If a non-zero EventMask is returned, the plugin will be subscribed
	// to the corresponding.
	Configure(config, runtime, version string) (api.EventMask, error)
}

ConfigureInterface handles Configure API request.

type CreateContainerInterface

type CreateContainerInterface interface {
	// CreateContainer relays a CreateContainer request to the plugin.
	// The plugin can request adjustments to the container being created
	// and updates to other unstopped containers in response.
	CreateContainer(*api.PodSandbox, *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error)
}

CreateContainerInterface handles CreateContainer API requests.

type EventMask

type EventMask = api.EventMask

EventMask holds a mask of events for plugin subscription.

type Option

type Option func(*stub) error

Option to apply to a plugin during its creation.

func WithConnection

func WithConnection(conn stdnet.Conn) Option

WithConnection sets an existing NRI connection to use.

func WithDialer

func WithDialer(d func(string) (stdnet.Conn, error)) Option

WithDialer sets the dialer to use.

func WithOnClose

func WithOnClose(onClose func()) Option

WithOnClose sets a notification function to call if the ttRPC connection goes down.

func WithPluginIdx

func WithPluginIdx(idx string) Option

WithPluginIdx sets the index to use in plugin registration.

func WithPluginName

func WithPluginName(name string) Option

WithPluginName sets the name to use in plugin registration.

func WithSocketPath

func WithSocketPath(path string) Option

WithSocketPath sets the NRI socket path to connect to.

type Plugin

type Plugin interface{}

Plugin can implement a number of interfaces related to Pod and Container lifecycle events. No any single such inteface is mandatory, therefore the Plugin interface itself is empty. Plugins are required to implement at least one of these interfaces and this is verified during stub creation. Trying to create a stub for a plugin violating this requirement will fail with and error.

type PostCreateContainerInterface

type PostCreateContainerInterface interface {
	// PostCreateContainer relays a PostCreateContainer event to the plugin.
	PostCreateContainer(*api.PodSandbox, *api.Container) error
}

PostCreateContainerInterface handles PostCreateContainer API events.

type PostStartContainerInterface

type PostStartContainerInterface interface {
	// PostStartContainer relays a PostStartContainer event to the plugin.
	PostStartContainer(*api.PodSandbox, *api.Container) error
}

PostStartContainerInterface handles PostStartContainer API events.

type PostUpdateContainerInterface

type PostUpdateContainerInterface interface {
	// PostUpdateContainer relays a PostUpdateContainer event to the plugin.
	PostUpdateContainer(*api.PodSandbox, *api.Container) error
}

PostUpdateContainerInterface handles PostUpdateContainer API events.

type RemoveContainerInterface

type RemoveContainerInterface interface {
	// RemoveContainer relays a RemoveContainer event to the plugin.
	RemoveContainer(*api.PodSandbox, *api.Container) error
}

RemoveContainerInterface handles RemoveContainer API events.

type RemovePodInterface

type RemovePodInterface interface {
	// RemovePodSandbox relays a RemovePodSandbox event to the plugin.
	RemovePodSandbox(*api.PodSandbox) error
}

RemovePodInterface handles RemovePodSandbox API events.

type RunPodInterface

type RunPodInterface interface {
	// RunPodSandbox relays a RunPodSandbox event to the plugin.
	RunPodSandbox(*api.PodSandbox) error
}

RunPodInterface handles RunPodSandbox API events.

type ShutdownInterface

type ShutdownInterface interface {
	// Shutdown notifies the plugin about the runtime shutting down.
	Shutdown(*api.ShutdownRequest)
}

ShutdownInterface handles a Shutdown API request.

type StartContainerInterface

type StartContainerInterface interface {
	// StartContainer relays a StartContainer event to the plugin.
	StartContainer(*api.PodSandbox, *api.Container) error
}

StartContainerInterface handles StartContainer API requests.

type StopContainerInterface

type StopContainerInterface interface {
	// StopContainer relays a StopContainer request to the plugin.
	// The plugin can request updates to unstopped containers in response.
	StopContainer(*api.PodSandbox, *api.Container) ([]*api.ContainerUpdate, error)
}

StopContainerInterface handles StopContainer API requests.

type StopPodInterface

type StopPodInterface interface {
	// StopPodSandbox relays a StopPodSandbox event to the plugin.
	StopPodSandbox(*api.PodSandbox) error
}

StopPodInterface handles StopPodSandbox API events.

type Stub

type Stub interface {
	// Run the plugin. Starts the plugin then waits for an error or the plugin to stop
	Run(context.Context) error
	// Start the plugin.
	Start(context.Context) error
	// Stop the plugin.
	Stop()
	// Wait for the plugin to stop.
	Wait()

	// UpdateContainer requests unsolicited updates to containers.
	UpdateContainers([]*api.ContainerUpdate) ([]*api.ContainerUpdate, error)
}

Stub is the interface the stub provides for the plugin implementation.

func New

func New(p interface{}, opts ...Option) (Stub, error)

New creates a stub with the given plugin and options.

type SynchronizeInterface

type SynchronizeInterface interface {
	// Synchronize the state of the plugin with the runtime.
	// The plugin can request updates to containers in response.
	Synchronize([]*api.PodSandbox, []*api.Container) ([]*api.ContainerUpdate, error)
}

SynchronizeInterface handles Synchronize API requests.

type UpdateContainerInterface

type UpdateContainerInterface interface {
	// UpdateContainer relays an UpdateContainer request to the plugin.
	// The plugin can request updates both to the container being updated
	// (which then supersedes the original update) and to other unstopped
	// containers in response.
	UpdateContainer(*api.PodSandbox, *api.Container) ([]*api.ContainerUpdate, error)
}

UpdateContainerInterface handles UpdateContainer API requests.

Jump to

Keyboard shortcuts

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