executortypes

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EvCbMap = map[Name]EventCbFn{}
View Source
var EvFuncMap = map[Name]GetEventChanFn{}
View Source
var Factory = map[Kind]CreateFn{}

Functions

func Register

func Register(kind Kind, create CreateFn) error

Register add a executor's create function.

func RegisterEvChan

func RegisterEvChan(name Name, get GetEventChanFn, cb EventCbFn) error

Get a GetEventChanFn according to an executor's name

func UnRegisterEvChan

func UnRegisterEvChan(name Name)

Types

type CreateFn

type CreateFn func(name Name, clustername string, options map[string]string, moreoptions interface{}) (Executor, error)

Create be used to create a executor instance.

type EventCbFn

type EventCbFn func(k string, v interface{}, t storetypes.ChangeType) error

type Executor

type Executor interface {
	Kind() Kind
	Name() Name

	CleanUpBeforeDelete()

	Create(ctx context.Context, spec interface{}) (interface{}, error)
	Destroy(ctx context.Context, spec interface{}) error
	Status(ctx context.Context, spec interface{}) (apistructs.StatusDesc, error)
	Remove(ctx context.Context, spec interface{}) error
	Update(ctx context.Context, spec interface{}) (interface{}, error)
	Inspect(ctx context.Context, spec interface{}) (interface{}, error)
	Cancel(ctx context.Context, spec interface{}) (interface{}, error)
	Scale(ctx context.Context, spec interface{}) (interface{}, error)
	Precheck(ctx context.Context, spec interface{}) (apistructs.ServiceGroupPrecheckData, error)

	// only k8s-job executor supported
	JobVolumeCreate(ctx context.Context, spec interface{}) (string, error)

	// SetNodeLabels set schedule-labels on nodes
	// Only k8s, k8sjob, marathon, metronome executor implement this function
	SetNodeLabels(setting NodeLabelSetting, hosts []string, labels map[string]string) error

	// executor's capacity
	// 1. addonoperator
	CapacityInfo() apistructs.CapacityInfoData

	ResourceInfo(brief bool) (apistructs.ClusterResourceInfoData, error)

	// only k8s executor supported
	KillPod(podname string) error
}

Executor defines the all interfaces that must be implemented by a executor instance.

type GetEventChanFn

type GetEventChanFn func(Name) (chan *eventtypes.StatusEvent, chan struct{}, *sync.Map, error)

return executor's event channel according to executor's name

type Kind

type Kind string

Kind represents a executor's type.

func (Kind) String

func (s Kind) String() string

func (Kind) Validate

func (s Kind) Validate() bool

type Name

type Name string

Name represents a executor's name.

func (Name) String

func (s Name) String() string

func (Name) Validate

func (s Name) Validate() bool

type NodeLabelSetting

type NodeLabelSetting struct {
	SoldierURL string
}

type StopEventsChans

type StopEventsChans struct {
	StopWatchEventCh  chan struct{}
	StopHandleEventCh chan struct{}
}

type TerminalExecutor

type TerminalExecutor interface {
	Terminal(namespace, podname, containername string, conn *websocket.Conn)
}

Jump to

Keyboard shortcuts

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