executortypes

package
v1.0.0-RC Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: AGPL-3.0 Imports: 12 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)
	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 ExecutorWholeConfigs

type ExecutorWholeConfigs struct {
	// Common cluster configuration
	BasicConfig map[string]string
	// Accurate cluster configuration
	PlusConfigs *conf.OptPlus
}

func (*ExecutorWholeConfigs) EnableLabelSchedule

func (c *ExecutorWholeConfigs) EnableLabelSchedule() bool

EnableLabelSchedule Whether tag scheduling is turned on

func (*ExecutorWholeConfigs) EnableOrgLabelSchedule

func (c *ExecutorWholeConfigs) EnableOrgLabelSchedule() bool

EnableOrgLabelSchedule Whether to enable org-level label scheduling

func (*ExecutorWholeConfigs) EnableWorkspaceLabelSchedule

func (c *ExecutorWholeConfigs) EnableWorkspaceLabelSchedule() bool

EnableWorkspaceLabelSchedule Whether to enable label scheduling at the workspace level

func (*ExecutorWholeConfigs) OrgOpt

func (c *ExecutorWholeConfigs) OrgOpt(org string) *OrgOpt

OrgOpt Take out the configuration of `org' from all configurations

func (*ExecutorWholeConfigs) ProdJobAvailDest

func (c *ExecutorWholeConfigs) ProdJobAvailDest() ([]string, bool)

ProdJobAvailDest prod environment where job can run

func (*ExecutorWholeConfigs) ProjectIDForCompatibility

func (c *ExecutorWholeConfigs) ProjectIDForCompatibility(projectID string) bool

ProjectIDForCompatibility Isolate the configuration used by the project when scheduling, and no longer use it DEPRECATED

func (*ExecutorWholeConfigs) StagingJobAvailDest

func (c *ExecutorWholeConfigs) StagingJobAvailDest() ([]string, bool)

StagingJobAvailDest staging environment where job can run

func (*ExecutorWholeConfigs) WORKSPACETAGSForCompatibility

func (c *ExecutorWholeConfigs) WORKSPACETAGSForCompatibility() (string, bool)

WORKSPACETAGSForCompatibility Compatible with old WORKSPACETAGS tags DEPRECATED

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 OrgOpt

type OrgOpt conf.Org

OrgOpt org level configuration

func (*OrgOpt) WorkspaceOpt

func (c *OrgOpt) WorkspaceOpt(workspace string) *WorkspaceOpt

WorkspaceOpt Take out the configuration of `workspace' from the org configuration

type StopEventsChans

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

type TerminalExecutor

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

type WorkspaceOpt

type WorkspaceOpt conf.Workspace

WorkspaceOpt workspace level configuration

func (*WorkspaceOpt) EnableWorkspaceLabelSchedule

func (c *WorkspaceOpt) EnableWorkspaceLabelSchedule() bool

EnableWorkspaceLabelSchedule Whether to enable workspace label scheduling

func (*WorkspaceOpt) ProdJobAvailDest

func (c *WorkspaceOpt) ProdJobAvailDest() ([]string, bool)

ProdJobAvailDest Environment where prod job can run

func (*WorkspaceOpt) StagingJobAvailDest

func (c *WorkspaceOpt) StagingJobAvailDest() ([]string, bool)

StagingJobAvailDest Environment where staging job can run

Jump to

Keyboard shortcuts

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