worker

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WorkersAlreadyStartedError = errors.New("failed to start the workers as they are already running")
)

Errors

Functions

This section is empty.

Types

type OnDemandJob

type OnDemandJob struct {
	// Operation is the type of operation to perform on the given pod
	Operation Operations
	// UID is the unique ID of the pod
	UID string
	// PodName is the name of the pod
	PodName string
	// PodNamespace is the pod's namespace
	PodNamespace string
	// RequestCount is the number of resources to create for operations of type Create. Optional for other operations
	RequestCount int
	// NodeName is the k8s node name
	NodeName string
}

OnDemandJob represents the job that will be executed by the respective worker

func NewOnDemandCreateJob

func NewOnDemandCreateJob(podNamespace string, podName string, requestCount int) OnDemandJob

NewOnDemandDeleteJob returns an on demand job for operation Create or Update

func NewOnDemandDeleteNodeJob

func NewOnDemandDeleteNodeJob(nodeName string) OnDemandJob

NewOnDemandDeleteNodeJob returns a delete node job

func NewOnDemandDeletedJob

func NewOnDemandDeletedJob(nodeName string, uid types.UID) OnDemandJob

NewOnDemandDeleteJob returns an on demand job for operation Deleted

func NewOnDemandProcessDeleteQueueJob

func NewOnDemandProcessDeleteQueueJob(nodeName string) OnDemandJob

NewOnDemandProcessDeleteQueueJob returns a process delete queue job

func NewOnDemandReconcileNodeJob

func NewOnDemandReconcileNodeJob(nodeName string) OnDemandJob

NewOnDemandReconcileJob returns a reconcile job

type Operations

type Operations string

Operations are the supported operations for on demand resource handler

const (
	OperationProcessDeleteQueue Operations = "ProcessDeleteQueue"
	// OperationReconcileNode represents a reconcile operation that reclaims dangling network interfaces using local cache
	OperationReconcileNode Operations = "ReconcileNode"
	// OperationCreate represents pods that are in created state
	OperationCreate Operations = "Create"
	// OperationDelete represents pods that have been deleted
	OperationDeleted Operations = "Deleted"
	// OperationDeleting represents pods that are being deleted
	OperationDeleting Operations = "Deleting"
	// OperationReconcileNotRequired represents job that don't need execution
	OperationReconcileNotRequired Operations = "NoReconcile"
	// OperationReSyncPool represents a job to re-sync a dirty pool
	OperationReSyncPool Operations = "ReSyncPool"
	// OperationDeleteNode represents the job to delete the node
	OperationDeleteNode Operations = "NodeDelete"
)

type WarmPoolJob

type WarmPoolJob struct {
	// Operation is the type of operation on warm pool
	Operations Operations
	// Resources can hold the resource to delete or the created resources
	Resources []string
	// ResourceCount is the number of resource to be created
	ResourceCount int
	// NodeName is the name of the node
	NodeName string
}

WarmPoolJob represents the job for a resource handler for warm pool resources

func NewWarmPoolCreateJob

func NewWarmPoolCreateJob(nodeName string, count int) *WarmPoolJob

NewWarmPoolCreateJob returns a job on warm pool of resource

func NewWarmPoolDeleteJob

func NewWarmPoolDeleteJob(nodeName string, resourcesToDelete []string) *WarmPoolJob

func NewWarmPoolReSyncJob added in v1.1.0

func NewWarmPoolReSyncJob(nodeName string) *WarmPoolJob

NewWarmPoolReSyncJob returns a job to re-sync the warm pool with upstream

func NewWarmProcessDeleteQueueJob

func NewWarmProcessDeleteQueueJob(nodeName string) *WarmPoolJob

type Worker

type Worker interface {
	StartWorkerPool(func(interface{}) (ctrl.Result, error)) error
	SubmitJob(job interface{})
	SubmitJobAfter(job interface{}, submitAfter time.Duration)
}

func NewDefaultWorkerPool

func NewDefaultWorkerPool(resourceName string, workerCount int, maxRequeue int,
	logger logr.Logger, ctx context.Context) Worker

NewDefaultWorkerPool returns a new worker pool for a give resource type with the given configuration

Jump to

Keyboard shortcuts

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