hookplugins

package
v0.0.0-...-932d068 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAPIPlugin

func RegisterAPIPlugin(ap APIPlugin)

RegisterAPIPlugin is used to register api container.

func RegisterContainerPlugin

func RegisterContainerPlugin(cp ContainerPlugin)

RegisterContainerPlugin is used to register container plugin.

func RegisterCriPlugin

func RegisterCriPlugin(crip CriPlugin)

RegisterCriPlugin is used to register the cri plugin.

func RegisterDaemonPlugin

func RegisterDaemonPlugin(dp DaemonPlugin)

RegisterDaemonPlugin is used to register daemon plugin.

func RegisterImagePlugin

func RegisterImagePlugin(p ImagePlugin)

RegisterImagePlugin is used to register container plugin.

func RegisterVolumePlugin

func RegisterVolumePlugin(vp VolumePlugin)

RegisterVolumePlugin is used to register the volume plugin.

Types

type APIPlugin

type APIPlugin interface {
	// UpdateHandler could register extra HTTP API to PouchContainer server,
	// change the behavior of the default handler.
	// The default handler of each API would be passed in while starting HTTP server.
	UpdateHandler(context.Context, []*types.HandlerSpec) []*types.HandlerSpec
}

APIPlugin provides the ability to extend PouchContainer HTTP API and change how handler behave.

func GetAPIPlugin

func GetAPIPlugin() APIPlugin

GetAPIPlugin returns the api plugin.

type ContainerPlugin

type ContainerPlugin interface {
	// PreCreate defines plugin point where receives a container create request, in this plugin point user
	// could change the container create body passed-in by http request body
	PreCreate(context.Context, *types.ContainerCreateConfig) error

	// PreStart returns an array of priority and args which will pass to runc, the every priority
	// used to sort the pre start array that pass to runc, network plugin hook always has priority value 0.
	PreStart(context.Context, interface{}) ([]int, [][]string, error)

	// PreCreateEndpoint accepts the container id and env of this container, to update the config of container's endpoint.
	PreCreateEndpoint(context.Context, string, []string, *networktypes.Endpoint) error

	// PreUpdate defines plugin point where receives a container update request, in this plugin point user
	// could change the container update body passed-in by http request body
	PreUpdate(context.Context, io.ReadCloser) (io.ReadCloser, error)

	// PostUpdate called after update method successful,
	// the method accepts the rootfs path and envs of container
	PostUpdate(context.Context, string, []string) error
}

ContainerPlugin defines places where a plugin will be triggered in container lifecycle

func GetContainerPlugin

func GetContainerPlugin() ContainerPlugin

GetContainerPlugin returns the container plugin.

type CriPlugin

type CriPlugin interface {
	// PreCreateContainer defines plugin point where receives a container create request, in this plugin point user
	// could update the container's config in cri interface.
	PreCreateContainer(context.Context, *types.ContainerCreateConfig, interface{}) error
}

CriPlugin defines places where a plugin will be triggered in CRI api lifecycle

func GetCriPlugin

func GetCriPlugin() CriPlugin

GetCriPlugin returns the cri plugin.

type DaemonPlugin

type DaemonPlugin interface {
	// PreStartHook is invoked by pouch daemon before real start, in this hook user could start http proxy or other
	// standalone process plugins
	PreStartHook() error

	// PreStopHook is invoked by pouch daemon before daemon process exit, not a promise if daemon is killed, in this
	// hook user could stop the process or plugin started by PreStartHook
	PreStopHook() error
}

DaemonPlugin defines places where a plugin will be triggered in pouchd lifecycle

func GetDaemonPlugin

func GetDaemonPlugin() DaemonPlugin

GetDaemonPlugin returns the daemon plugin.

type ImagePlugin

type ImagePlugin interface {
	PostPull(ctx context.Context, snapshotter string, image containerd.Image) error
}

ImagePlugin defines places where a plugin will be triggered in image operations

func GetImagePlugin

func GetImagePlugin() ImagePlugin

GetImagePlugin returns the container plugin.

type VolumePlugin

type VolumePlugin interface {
	// PreVolumeCreate defines plugin point where receives an volume create request, in this plugin point user
	// could change the volume create body passed-in by http request body
	PreVolumeCreate(context.Context, *types.VolumeCreateConfig) error
}

VolumePlugin defines places where a plugin will be triggered in volume lifecycle

func GetVolumePlugin

func GetVolumePlugin() VolumePlugin

GetVolumePlugin returns the volume plugin.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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