plugin

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Overview

generated by go-extpoints -- DO NOT EDIT

Index

Constants

This section is empty.

Variables

View Source
var ComposePlugins = &composePluginExt{
	newExtensionPoint(new(ComposePlugin)),
}
View Source
var Monitors = &monitorExt{
	newExtensionPoint(new(Monitor)),
}
View Source
var PodStatusHooks = &podStatusHookExt{
	newExtensionPoint(new(PodStatusHook)),
}

Functions

func RegisterExtension

func RegisterExtension(extension interface{}, name string) []string

func UnregisterExtension

func UnregisterExtension(name string) []string

Types

type ComposePlugin

type ComposePlugin interface {
	// Name gets the name of the plugin
	Name() string

	// execute some tasks before the Image is pulled
	LaunchTaskPreImagePull(ctx context.Context, composeFiles *[]string, executorId string, taskInfo *mesos.TaskInfo) error

	// execute some tasks after the Image is pulled
	LaunchTaskPostImagePull(ctx context.Context, composeFiles *[]string, executorId string, taskInfo *mesos.TaskInfo) error

	// execute the tasks after the pod is launched
	PostLaunchTask(ctx context.Context, composeFiles []string, taskInfo *mesos.TaskInfo) (string, error)

	// execute the task before we send a Kill to Mesos
	PreKillTask(ctx context.Context, taskInfo *mesos.TaskInfo) error

	// execute the task after we send a Kill to Mesos
	PostKillTask(ctx context.Context, taskInfo *mesos.TaskInfo) error

	// execute the task to shutdown the pod
	Shutdown(taskInfo *mesos.TaskInfo, ed executor.ExecutorDriver) error
}

func GetOrderedExtpoints

func GetOrderedExtpoints(plugins []string) []ComposePlugin

type Monitor

type Monitor interface {
	Start(ctx context.Context) (types.PodStatus, error)
}

Monitor inspects pods periodically until pod failed or terminated It also defines when to consider a pod as failed. Move monitor as a plugin provides flexibility to replace default monitor logic. Monitor name presents in config `monitorName` will be used, otherwise, default monitor will be used.

type PodStatusHook

type PodStatusHook interface {
	// Execute is invoked when the pod.taskStatusCh channel has a new status. It returns an error on failure,
	// and also a flag "failExec" indicating if the error needs to fail the execution when a series of hooks are executed
	// This is to support cases where a few hooks can be executed in a best effort manner and need not fail the executor
	Execute(ctx context.Context, podStatus string, data interface{}) (failExec bool, err error)
}

PodStatusHook allows custom implementations to be plugged when a Pod (mesos task) status changes. Currently this is designed to be executed on task status changes during LaunchTask.

Jump to

Keyboard shortcuts

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