controllerutils

package
v0.0.0-...-f08864f Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCondition

func GetCondition(conditions []api.Condition, conditionType string) *api.Condition

func ReportSyncError

func ReportSyncError(syncErr error) controllerMutationFunc

func WriteController

func WriteController(ctx context.Context, controllerCRUD database.ResourceCRUD[api.Controller], controllerName string, initialControllerFn initialControllerFunc, mutationFns ...controllerMutationFunc) error

WriteController will read the existing value, call the mutations in order, then write the result. It only tries *once*. If it fails, then the an error is returned. This detail is important, it doesn't even retry conflicts. This is so that if a failure happens the control-loop will re-run and restablish the information it was trying to write as valid. This prevents accidental recreation of controller instances in cosmos during a delete.

Types

type ClusterSyncer

type ClusterSyncer interface {
	SyncOnce(ctx context.Context, keyObj HCPClusterKey) error
}

type Controller

type Controller interface {
	SyncOnce(ctx context.Context, keyObj any) error
	Run(ctx context.Context, threadiness int)
}

func NewClusterWatchingController

func NewClusterWatchingController(
	name string,
	cosmosClient database.DBClient,
	subscriptionLister listers.SubscriptionLister,
	resyncDuration time.Duration,
	syncer ClusterSyncer,
) Controller

NewClusterWatchingController periodically looks up all clusters and queues them

type HCPClusterKey

type HCPClusterKey struct {
	SubscriptionID    string `json:"subscriptionID"`
	ResourceGroupName string `json:"resourceGroupName"`
	HCPClusterName    string `json:"hcpClusterName"`
}

HCPClusterKey is for driving workqueues keyed for clusters

func (*HCPClusterKey) AddLoggerValues

func (k *HCPClusterKey) AddLoggerValues(logger *slog.Logger) *slog.Logger

func (*HCPClusterKey) GetResourceID

func (k *HCPClusterKey) GetResourceID() *azcorearm.ResourceID

func (*HCPClusterKey) InitialController

func (k *HCPClusterKey) InitialController(controllerName string) *api.Controller

type OperationKey

type OperationKey struct {
	SubscriptionID   string `json:"subscriptionID"`
	OperationName    string `json:"operationName"`
	ParentResourceID string `json:"parentResourceID"`
}

OperationKey is for driving workqueues keyed for operations

func (*OperationKey) AddLoggerValues

func (k *OperationKey) AddLoggerValues(logger *slog.Logger) *slog.Logger

func (*OperationKey) GetParentResourceID

func (k *OperationKey) GetParentResourceID() *azcorearm.ResourceID

func (*OperationKey) InitialController

func (k *OperationKey) InitialController(controllerName string) *api.Controller

Jump to

Keyboard shortcuts

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