types

package
v1.3.0-rc.0...-a07df58 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvRetainNamespace = "RETAIN_NAMESPACE"
)
View Source
var Factory = map[Kind]CreateFn{}

Functions

func MustRegister

func MustRegister(kind Kind, create CreateFn)

MustRegister panic if register failed.

func Register

func Register(kind Kind, create CreateFn) error

Register add an executor's create function.

Types

type ActionExecutor

type ActionExecutor interface {
	Kind() Kind
	Name() Name

	// Exist 返回 created, started, error
	Exist(ctx context.Context, action *spec.PipelineTask) (created bool, started bool, err error)
	// Create 保证幂等
	Create(ctx context.Context, action *spec.PipelineTask) (interface{}, error)
	// Start 保证幂等
	Start(ctx context.Context, action *spec.PipelineTask) (interface{}, error)
	Update(ctx context.Context, action *spec.PipelineTask) (interface{}, error)

	// Status 只做简单重试
	Status(ctx context.Context, action *spec.PipelineTask) (apistructs.PipelineStatusDesc, error)
	Inspect(ctx context.Context, action *spec.PipelineTask) (apistructs.TaskInspect, error)

	Cancel(ctx context.Context, action *spec.PipelineTask) (interface{}, error)
	Remove(ctx context.Context, action *spec.PipelineTask) (interface{}, error)
	BatchDelete(ctx context.Context, actions []*spec.PipelineTask) (interface{}, error)
}

type CreateFn

type CreateFn func(name Name, options map[string]string) (ActionExecutor, error)

Create be used to create an action executor instance.

type K8sBaseExecutor

type K8sBaseExecutor interface {
	Kind() Kind
	Name() Name

	Status(ctx context.Context, action *spec.PipelineTask) (apistructs.PipelineStatusDesc, error)
	Delete(ctx context.Context, task *spec.PipelineTask) (data interface{}, err error)
	// CleanUp clean up all resources under this namespace
	CleanUp(ctx context.Context, namespace string) error
}

type K8sExecutor

type K8sExecutor struct {
	K8sBaseExecutor
	// contains filtered or unexported fields
}

func NewK8sExecutor

func NewK8sExecutor(exe K8sBaseExecutor) *K8sExecutor

func (*K8sExecutor) BatchDelete

func (k *K8sExecutor) BatchDelete(ctx context.Context, tasks []*spec.PipelineTask) (data interface{}, err error)

func (*K8sExecutor) Cancel

func (k *K8sExecutor) Cancel(ctx context.Context, task *spec.PipelineTask) (data interface{}, err error)

func (*K8sExecutor) Create

func (k *K8sExecutor) Create(ctx context.Context, task *spec.PipelineTask) (data interface{}, err error)

func (*K8sExecutor) Exist

func (k *K8sExecutor) Exist(ctx context.Context, task *spec.PipelineTask) (created bool, started bool, err error)

func (*K8sExecutor) Remove

func (k *K8sExecutor) Remove(ctx context.Context, task *spec.PipelineTask) (data interface{}, err error)

func (*K8sExecutor) Update

func (k *K8sExecutor) Update(ctx context.Context, task *spec.PipelineTask) (interface{}, error)

type Kind

type Kind string

Kind represents an executor's type.

func (Kind) GetClusterNameByExecutorName

func (s Kind) GetClusterNameByExecutorName(executorName Name) (string, error)

func (Kind) IsK8sKind

func (s Kind) IsK8sKind() bool

func (Kind) MakeK8sKindExecutorName

func (s Kind) MakeK8sKindExecutorName(clusterName string) Name

func (Kind) String

func (s Kind) String() string

func (Kind) Validate

func (s Kind) Validate() bool

type Name

type Name string

Name represents an executor's name.

func (Name) String

func (s Name) String() string

func (Name) Validate

func (s Name) Validate() bool

Jump to

Keyboard shortcuts

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