operator

package
v0.0.0-...-bb45038 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecLifecyclePreStart

func ExecLifecyclePreStart(handler Handler) error

ExecLifecyclePreStart execute PreStart step on handler if interface is implemented

func HandleP0

func HandleP0(ctx context.Context, handler ...HandleP0Func) (bool, error)

func HandleP1

func HandleP1[P1 interface{}](ctx context.Context, p1 P1, handler ...HandleP1Func[P1]) (bool, error)

func HandleP1WithStop

func HandleP1WithStop[P1 interface{}](ctx context.Context, p1 P1, handler ...HandleP1Func[P1]) (bool, error)

func HandleP2

func HandleP2[P1, P2 interface{}](ctx context.Context, p1 P1, p2 P2, handler ...HandleP2Func[P1, P2]) (bool, error)

func HandleP2WithStop

func HandleP2WithStop[P1, P2 interface{}](ctx context.Context, p1 P1, p2 P2, handler ...HandleP2Func[P1, P2]) (bool, error)

func HandleP3

func HandleP3[P1, P2, P3 interface{}](ctx context.Context, p1 P1, p2 P2, p3 P3, handler ...HandleP3Func[P1, P2, P3]) (bool, error)

func HandleP3WithCondition

func HandleP3WithCondition[P1, P2, P3 interface{}](ctx context.Context, conditions *api.ConditionList, condition api.ConditionType, p1 P1, p2 P2, p3 P3, handler ...HandleP3Func[P1, P2, P3]) (bool, error)

func HandleP3WithStop

func HandleP3WithStop[P1, P2, P3 interface{}](ctx context.Context, p1 P1, p2 P2, p3 P3, handler ...HandleP3Func[P1, P2, P3]) (bool, error)

func HandleP4

func HandleP4[P1, P2, P3, P4 interface{}](ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, handler ...HandleP4Func[P1, P2, P3, P4]) (bool, error)

func HandleP4WithCondition

func HandleP4WithCondition[P1, P2, P3, P4 interface{}](ctx context.Context, conditions *api.ConditionList, condition api.ConditionType, p1 P1, p2 P2, p3 P3, p4 P4, handler ...HandleP4Func[P1, P2, P3, P4]) (bool, error)

func HandleP4WithStop

func HandleP4WithStop[P1, P2, P3, P4 interface{}](ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, handler ...HandleP4Func[P1, P2, P3, P4]) (bool, error)

func HandleP5

func HandleP5[P1, P2, P3, P4, P5 interface{}](ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, handler ...HandleP5Func[P1, P2, P3, P4, P5]) (bool, error)

func HandleP5WithCondition

func HandleP5WithCondition[P1, P2, P3, P4, P5 interface{}](ctx context.Context, conditions *api.ConditionList, condition api.ConditionType, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, handler ...HandleP5Func[P1, P2, P3, P4, P5]) (bool, error)

func HandleP5WithStop

func HandleP5WithStop[P1, P2, P3, P4, P5 interface{}](ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, handler ...HandleP5Func[P1, P2, P3, P4, P5]) (bool, error)

func HandleP6

func HandleP6[P1, P2, P3, P4, P5, P6 interface{}](ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, p6 P6, handler ...HandleP6Func[P1, P2, P3, P4, P5, P6]) (bool, error)

func HandleP6WithCondition

func HandleP6WithCondition[P1, P2, P3, P4, P5, P6 interface{}](ctx context.Context, conditions *api.ConditionList, condition api.ConditionType, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, p6 P6, handler ...HandleP6Func[P1, P2, P3, P4, P5, P6]) (bool, error)

func HandleP6WithStop

func HandleP6WithStop[P1, P2, P3, P4, P5, P6 interface{}](ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, p6 P6, handler ...HandleP6Func[P1, P2, P3, P4, P5, P6]) (bool, error)

func HandleP9

func HandleP9[P1, P2, P3, P4, P5, P6, P7, P8, P9 interface{}](ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, p6 P6, p7 P7, p8 P8, p9 P9, handler ...HandleP9Func[P1, P2, P3, P4, P5, P6, P7, P8, P9]) (bool, error)

func HandleP9WithCondition

func HandleP9WithCondition[P1, P2, P3, P4, P5, P6, P7, P8, P9 interface{}](ctx context.Context, conditions *api.ConditionList, condition api.ConditionType, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, p6 P6, p7 P7, p8 P8, p9 P9, handler ...HandleP9Func[P1, P2, P3, P4, P5, P6, P7, P8, P9]) (bool, error)

func HandleP9WithStop

func HandleP9WithStop[P1, P2, P3, P4, P5, P6, P7, P8, P9 interface{}](ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, p6 P6, p7 P7, p8 P8, p9 P9, handler ...HandleP9Func[P1, P2, P3, P4, P5, P6, P7, P8, P9]) (bool, error)

func IsReconcile

func IsReconcile(err error) bool

func IsStop

func IsStop(err error) bool

func Reconcile

func Reconcile(msg string, args ...interface{}) error

func Stop

func Stop(msg string, args ...interface{}) error

func WithCondition

func WithCondition(conditions *api.ConditionList, condition api.ConditionType, changed bool, err error) (bool, error)

func WithUpdateStatusInterface

func WithUpdateStatusInterface[S interface{}, T Object[S]](ctx context.Context, client UpdateStatusInterface[S, T], obj T, status S, opts meta.UpdateOptions) (T, error)

func WithUpdateStatusInterfaceRetry

func WithUpdateStatusInterfaceRetry[S interface{}, T Object[S]](ctx context.Context, client UpdateStatusInterface[S, T], obj T, status S, opts meta.UpdateOptions) (T, error)

Types

type GetInterface

type GetInterface[S interface{}, T Object[S]] interface {
	Get(ctx context.Context, name string, options meta.GetOptions) (T, error)
}

type HandleP0Func

type HandleP0Func func(ctx context.Context) (bool, error)

type HandleP1Func

type HandleP1Func[P1 interface{}] func(ctx context.Context, p1 P1) (bool, error)

type HandleP2Func

type HandleP2Func[P1, P2 interface{}] func(ctx context.Context, p1 P1, p2 P2) (bool, error)

type HandleP3Func

type HandleP3Func[P1, P2, P3 interface{}] func(ctx context.Context, p1 P1, p2 P2, p3 P3) (bool, error)

type HandleP4Func

type HandleP4Func[P1, P2, P3, P4 interface{}] func(ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4) (bool, error)

type HandleP5Func

type HandleP5Func[P1, P2, P3, P4, P5 interface{}] func(ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5) (bool, error)

type HandleP6Func

type HandleP6Func[P1, P2, P3, P4, P5, P6 interface{}] func(ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, p6 P6) (bool, error)

type HandleP9Func

type HandleP9Func[P1, P2, P3, P4, P5, P6, P7, P8, P9 interface{}] func(ctx context.Context, p1 P1, p2 P2, p3 P3, p4 P4, p5 P5, p6 P6, p7 P7, p8 P8, p9 P9) (bool, error)

type Handler

type Handler interface {
	Name() string

	Handle(ctx context.Context, item operation.Item) error

	CanBeHandled(item operation.Item) bool
}

Handler define interface for operator actions

type InformerFilter

type InformerFilter func(obj meta.Object) bool

type LifecyclePreStart

type LifecyclePreStart interface {
	Handler

	LifecyclePreStart() error
}

LifecyclePreStart interface executed before operator starts

type Object

type Object[T interface{}] interface {
	meta.Object

	GetStatus() T
	SetStatus(T)
}

type Operator

type Operator interface {
	// Define prometheus collector interface
	prometheus.Collector

	Name() string
	Namespace() string
	Image() string

	Start(threadiness int, stopCh <-chan struct{}) error

	RegisterInformer(informer cache.SharedIndexInformer, group, version, kind string, filters ...InformerFilter) error
	RegisterStarter(starter Starter) error
	RegisterHandler(handler Handler) error

	EnqueueItem(item operation.Item)
	ProcessItem(item operation.Item) error
}

Operator interface for operator core functionality

func NewOperator

func NewOperator(name, namespace, image string) Operator

NewOperator creates new operator

type Starter

type Starter interface {
	Start(stopCh <-chan struct{})
}

Starter interface used by Operator to start new GoRoutines

type UpdateStatusInterface

type UpdateStatusInterface[S interface{}, T Object[S]] interface {
	GetInterface[S, T]

	UpdateStatus(ctx context.Context, in T, options meta.UpdateOptions) (T, error)
}

type UpdateStatusInterfaceClient

type UpdateStatusInterfaceClient[S interface{}, T Object[S]] func(namespace string) UpdateStatusInterface[S, T]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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