component

package
v0.1.0-alpha.1....-6c12bc6 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OperationGetExistingResourceNames represents an operation to get existing resource names.
	OperationGetExistingResourceNames = "GetExistingResourceNames"
	// OperationSync represents a sync operation.
	OperationSync = "Sync"
	// OperationDelete represents a delete operation.
	OperationDelete = "Delete"
)

Constants for operations that an Operator can perform.

Variables

This section is empty.

Functions

This section is empty.

Types

type GroveCustomResourceType

GroveCustomResourceType defines a type bound for generic types.

type Kind

type Kind string

Kind represents kind of a resource.

const (
	// KindPodClique indicates that the resource is a PodClique.
	KindPodClique Kind = "PodClique"
	// KindServiceAccount indicates that the resource is a ServiceAccount.
	KindServiceAccount Kind = "ServiceAccount"
	// KindRole indicates that the resource is a Role.
	KindRole Kind = "Role"
	// KindRoleBinding indicates that the resource is a RoleBinding.
	KindRoleBinding Kind = "RoleBinding"
	// KindServiceAccountTokenSecret indicates that the resource is a Secret to generate ServiceAccount token.
	KindServiceAccountTokenSecret Kind = "ServiceAccountTokenSecret"
	// KindHeadlessService indicates that the resource is a headless Service.
	KindHeadlessService Kind = "HeadlessService"
	// KindHorizontalPodAutoscaler indicates that the resource is a HorizontalPodAutoscaler.
	KindHorizontalPodAutoscaler Kind = "HorizontalPodAutoscaler"
	// KindPod indicates that the resource is a Pod.
	KindPod Kind = "Pod"
	// KindPodCliqueScalingGroup indicates that the resource is a PodCliqueScalingGroup.
	KindPodCliqueScalingGroup Kind = "PodCliqueScalingGroup"
	// KindPodGang indicates that the resource is a PodGang.
	KindPodGang Kind = "PodGang"
	// KindPodCliqueSetReplica indicates that the resource is a PodCliqueSet replica.
	KindPodCliqueSetReplica Kind = "PodCliqueSetReplica"
)

type Operator

type Operator[T GroveCustomResourceType] interface {
	// GetExistingResourceNames returns the names of all the existing resources that this Operator manages.
	GetExistingResourceNames(ctx context.Context, logger logr.Logger, objMeta metav1.ObjectMeta) ([]string, error)
	// Sync synchronizes all resources that this Operator manages. If a component does not exist then it will
	// create it. If there are changes in the owning PodCliqueSet resource that transpires changes to one or more resources
	// managed by this Operator then those resource(s) will be either be updated or a deletion is triggered.
	Sync(ctx context.Context, logger logr.Logger, obj *T) error
	// Delete triggers the deletion of all resources that this Operator manages.
	Delete(ctx context.Context, logger logr.Logger, objMeta metav1.ObjectMeta) error
}

Operator is a facade that manages one or more resources that are provisioned for a PodCliqueSet.

type OperatorRegistry

type OperatorRegistry[T GroveCustomResourceType] interface {
	// Register registers a components operator against the kind of components it operates on.
	Register(kind Kind, operator Operator[T])
	// GetOperator gets a components operator that operates on the given kind.
	GetOperator(kind Kind) (Operator[T], error)
	// GetAllOperators returns all components operators.
	GetAllOperators() map[Kind]Operator[T]
}

OperatorRegistry is a facade that gives access to all components operators.

func NewOperatorRegistry

func NewOperatorRegistry[T GroveCustomResourceType]() OperatorRegistry[T]

NewOperatorRegistry creates a new OperatorRegistry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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