downstream

package
v1.23.0-cx Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(ctx context.Context) error

Init registers the downstream handlers.

func Start

func Start(ctx context.Context)

Start starts the downstream handlers.

Types

type ConfigUpdateJobHandler

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

func (*ConfigUpdateJobHandler) CanDownstreamPhase

func (h *ConfigUpdateJobHandler) CanDownstreamPhase(obj any) bool

func (*ConfigUpdateJobHandler) ExecutorChan

func (h *ConfigUpdateJobHandler) ExecutorChan() chan wrap.NodeJob

func (*ConfigUpdateJobHandler) InterruptExecutor

func (h *ConfigUpdateJobHandler) InterruptExecutor(obj any)

func (*ConfigUpdateJobHandler) Logger

func (h *ConfigUpdateJobHandler) Logger() logr.Logger

func (*ConfigUpdateJobHandler) UpdateNodeTaskStatus

func (h *ConfigUpdateJobHandler) UpdateNodeTaskStatus(
	ctx context.Context,
	job wrap.NodeJob,
	task wrap.NodeJobTask,
)

type DownstreamHandler

type DownstreamHandler interface {
	// Logger returns the downstream handler logger.
	Logger() logr.Logger

	// CanDownstreamPhase returns whether node tasks can be performed during the node job phase.
	CanDownstreamPhase(job any) bool

	// ExecutorChan returns the channel of the node job. The channel data is generated by NodeJobEventHandler
	ExecutorChan() chan wrap.NodeJob

	// InterruptExecutor interrupts downstream executor if it is running.
	// When a node job CR is deleted, it is necessary to determine whether a node job's executor exists.
	// If exists, it means that there are node tasks being executed and this executor needs to be interrupted.
	InterruptExecutor(job any)

	// UpdateNodeTaskStatus updates the status of the node task.
	UpdateNodeTaskStatus(ctx context.Context, job wrap.NodeJob, task wrap.NodeJobTask)
}

func MustGetHandlerWithObj

func MustGetHandlerWithObj(obj any) (DownstreamHandler, error)

MustGetHandlerWithObj returns the downstream handler for the given obj type.

type ImagePrePullJobHandler

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

func (*ImagePrePullJobHandler) CanDownstreamPhase

func (h *ImagePrePullJobHandler) CanDownstreamPhase(obj any) bool

func (*ImagePrePullJobHandler) ExecutorChan

func (h *ImagePrePullJobHandler) ExecutorChan() chan wrap.NodeJob

func (*ImagePrePullJobHandler) InterruptExecutor

func (h *ImagePrePullJobHandler) InterruptExecutor(obj any)

func (*ImagePrePullJobHandler) Logger

func (h *ImagePrePullJobHandler) Logger() logr.Logger

func (*ImagePrePullJobHandler) UpdateNodeTaskStatus

func (h *ImagePrePullJobHandler) UpdateNodeTaskStatus(
	ctx context.Context,
	job wrap.NodeJob,
	task wrap.NodeJobTask,
)

type NodeJobEventHandler

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

NodeJobEventHandler is a common resource event handler for node job

func NewNodeJobEventHandler

func NewNodeJobEventHandler(logger logr.Logger, downstream chan<- wrap.NodeJob) *NodeJobEventHandler

NewNodeJobEventHandler creates a new NodeJobEventHandler

func (*NodeJobEventHandler) OnAdd

func (h *NodeJobEventHandler) OnAdd(obj any, isInInitialList bool)

OnAdd gets the watched node job addition event, and uses CanDownstreamPhase method to determine whether to send the node job wrap to downstream channel.

func (*NodeJobEventHandler) OnDelete

func (h *NodeJobEventHandler) OnDelete(obj any)

OnDelete gets the watched node job deletion event, and uses InterruptExecutor method to interrupt the downstream executor.

func (*NodeJobEventHandler) OnUpdate

func (h *NodeJobEventHandler) OnUpdate(_oldObj, newObj any)

OnUpdate gets the watched node job update event, and uses CanDownstreamPhase method to determine whether to send the node job wrap to downstream channel.

type NodeUpgradeJobHandler

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

func (*NodeUpgradeJobHandler) CanDownstreamPhase

func (h *NodeUpgradeJobHandler) CanDownstreamPhase(obj any) bool

func (*NodeUpgradeJobHandler) ExecutorChan

func (h *NodeUpgradeJobHandler) ExecutorChan() chan wrap.NodeJob

func (*NodeUpgradeJobHandler) InterruptExecutor

func (h *NodeUpgradeJobHandler) InterruptExecutor(obj any)

func (*NodeUpgradeJobHandler) Logger

func (h *NodeUpgradeJobHandler) Logger() logr.Logger

func (*NodeUpgradeJobHandler) UpdateNodeTaskStatus

func (h *NodeUpgradeJobHandler) UpdateNodeTaskStatus(
	ctx context.Context,
	job wrap.NodeJob,
	task wrap.NodeJobTask,
)

Jump to

Keyboard shortcuts

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