handler

package
v0.0.0-...-3388463 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// LabelControllerValueKusciaJob is the label value for common.LabelController with KusciaJob
	LabelControllerValueKusciaJob = "kuscia-job"
	// KusciaJobKind is KusciaJob CRD Kind
	KusciaJobKind = "KusciaJob"
)

Variables

This section is empty.

Functions

func ShouldReconcile

func ShouldReconcile(job *kusciaapisv1alpha1.KusciaJob) bool

ShouldReconcile return whether this job need to reconcile again.

Types

type ApprovalRejectHandler

type ApprovalRejectHandler struct {
	*JobScheduler
}

ApprovalRejectHandler will handle kuscia job in ApprovalReject phase.

func NewApprovalRejectHandler

func NewApprovalRejectHandler(deps *Dependencies) *ApprovalRejectHandler

NewApprovalRejectHandler return ApprovalRejectHandler to handle ApprovalReject kuscia job.

func (*ApprovalRejectHandler) HandlePhase

func (h *ApprovalRejectHandler) HandlePhase(kusciaJob *kusciaapisv1alpha1.KusciaJob) (needUpdate bool, err error)

HandlePhase implements the KusciaJobPhaseHandler interface.

type AwaitingApprovalHandler

type AwaitingApprovalHandler struct {
	*JobScheduler
}

AwaitingApprovalHandler will handle kuscia job in AwaitingApproval phase.

func NewAwaitingApprovalHandler

func NewAwaitingApprovalHandler(deps *Dependencies) *AwaitingApprovalHandler

NewAwaitingApprovalHandler return AwaitingApprovalHandler to handle AwaitingApproval kuscia job.

func (*AwaitingApprovalHandler) HandlePhase

func (h *AwaitingApprovalHandler) HandlePhase(kusciaJob *kusciaapisv1alpha1.KusciaJob) (needUpdate bool, err error)

HandlePhase implements the KusciaJobPhaseHandler interface.

type CancelledHandler

type CancelledHandler struct {
	*JobScheduler
}

CancelledHandler will handle kuscia job in Cancelled phase.

func NewCancelledHandler

func NewCancelledHandler(deps *Dependencies) *CancelledHandler

NewCancelledHandler return CancelledHandler to handle Cancelled kuscia job.

func (*CancelledHandler) HandlePhase

func (h *CancelledHandler) HandlePhase(kusciaJob *kusciaapisv1alpha1.KusciaJob) (needUpdate bool, err error)

HandlePhase implements the KusciaJobPhaseHandler interface.

type Dependencies

type Dependencies struct {
	Recorder              record.EventRecorder
	KusciaClient          versioned.Interface
	KusciaTaskLister      kuscialistersv1alpha1.KusciaTaskLister
	NamespaceLister       corelisters.NamespaceLister
	DomainLister          kuscialistersv1alpha1.DomainLister
	EnableWorkloadApprove bool
}

Dependencies defines KusciaJobPhaseHandlerFactory's dependencies.

type FailedHandler

type FailedHandler struct {
	*JobScheduler
}

FailedHandler will handle kuscia job in Failed phase.

func NewFailedHandler

func NewFailedHandler(deps *Dependencies) *FailedHandler

NewFailedHandler return FailedHandler to handle Failed kuscia job.

func (*FailedHandler) HandlePhase

func (h *FailedHandler) HandlePhase(job *kusciaapisv1alpha1.KusciaJob) (needUpdate bool, err error)

HandlePhase implements the KusciaJobPhaseHandler interface. It will do some tail-in work when the job phase is failed.

type InitializedHandler

type InitializedHandler struct {
	*JobScheduler
}

InitializedHandler will handle kuscia job in "" or Initialized phase.

func NewInitializedHandler

func NewInitializedHandler(deps *Dependencies) *InitializedHandler

NewInitializedHandler return InitializedHandler to handle Initialized kuscia job.

func (*InitializedHandler) HandlePhase

func (h *InitializedHandler) HandlePhase(kusciaJob *kusciaapisv1alpha1.KusciaJob) (needUpdate bool, err error)

HandlePhase implements the KusciaJobPhaseHandler interface. It will validate task and do the first scheduling when the job is committed(phase is "" or Initialized).

type JobScheduler

type JobScheduler struct {
	// contains filtered or unexported fields
}

JobScheduler will compute current kuscia job and do scheduling until the kuscia job finished.

func NewJobScheduler

func NewJobScheduler(deps *Dependencies) *JobScheduler

NewJobScheduler return kuscia job scheduler.

type KusciaJobPhaseHandler

type KusciaJobPhaseHandler interface {
	HandlePhase(kusciaJob *kusciaapisv1alpha1.KusciaJob) (bool, error)
}

KusciaJobPhaseHandler defines that how to handle the kuscia job in each phase.

type KusciaJobPhaseHandlerFactory

type KusciaJobPhaseHandlerFactory struct {
	KusciaTaskStateHandlerMap map[kusciaapisv1alpha1.KusciaJobPhase]KusciaJobPhaseHandler
}

KusciaJobPhaseHandlerFactory is a state machine to handle the kuscia job in each phase.

func NewKusciaJobPhaseHandlerFactory

func NewKusciaJobPhaseHandlerFactory(deps *Dependencies) *KusciaJobPhaseHandlerFactory

NewKusciaJobPhaseHandlerFactory return a state machine to handle the kuscia job in each phase.

func (*KusciaJobPhaseHandlerFactory) KusciaJobPhaseHandlerFor

KusciaJobPhaseHandlerFor get handler for phase.

type PendingHandler

type PendingHandler struct {
	*JobScheduler
}

PendingHandler will handle kuscia job in "" or Pending phase.

func NewPendingHandler

func NewPendingHandler(deps *Dependencies) *PendingHandler

NewPendingHandler return PendingHandler to handle Pending kuscia job.

func (*PendingHandler) HandlePhase

func (h *PendingHandler) HandlePhase(kusciaJob *kusciaapisv1alpha1.KusciaJob) (needUpdate bool, err error)

HandlePhase implements the KusciaJobPhaseHandler interface.

type RunningHandler

type RunningHandler struct {
	*JobScheduler
}

RunningHandler will handle kuscia job in Running phase.

func NewRunningHandler

func NewRunningHandler(deps *Dependencies) *RunningHandler

NewRunningHandler return RunningHandler to handle Running kuscia job.

func (*RunningHandler) HandlePhase

func (h *RunningHandler) HandlePhase(job *kusciaapisv1alpha1.KusciaJob) (needUpdate bool, retErr error)

HandlePhase implements the KusciaJobPhaseHandler interface. It will do scheduling when the job phase is Running.

type SucceededHandler

type SucceededHandler struct {
	// contains filtered or unexported fields
}

SucceededHandler will handle kuscia job in Succeeded phase.

func NewSucceededHandler

func NewSucceededHandler(deps *Dependencies) *SucceededHandler

NewSucceededHandler return SucceededHandler to handle Succeeded kuscia job.

func (*SucceededHandler) HandlePhase

func (h *SucceededHandler) HandlePhase(kusciaJob *kusciaapisv1alpha1.KusciaJob) (bool, error)

HandlePhase implements the KusciaJobPhaseHandler interface. It will do some tail-in work when the job phase is Succeeded.

type SuspendedHandler

type SuspendedHandler struct {
	*JobScheduler
}

SuspendedHandler will handle kuscia job in suspend phase.

func NewSuspendedHandler

func NewSuspendedHandler(deps *Dependencies) *SuspendedHandler

NewSuspendedHandler return SuspendedHandler to handle 'suspend' kuscia job.

func (*SuspendedHandler) HandlePhase

func (h *SuspendedHandler) HandlePhase(job *kusciaapisv1alpha1.KusciaJob) (needUpdate bool, err error)

HandlePhase implements the KusciaJobPhaseHandler interface.

Jump to

Keyboard shortcuts

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