controller

package
v0.0.0-...-bbfefe4 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Error = "Error"
	Ready = "Ready"
)

Variables

This section is empty.

Functions

func WriteSnapshotStatus

func WriteSnapshotStatus[T client.Object](
	ctx context.Context,
	cl client.Client,
	nn types.NamespacedName,
	status v1.StoreSnapshotStatus,
	newResource func() T,
) error

WriteSnapshotStatus provides a generic status writer

Types

type JobCreator

type JobCreator func(store v1.Store, snapshot SnapshotResource) *batchv1.Job

JobCreator defines how to create the appropriate job for each snapshot type

type JobGetter

type JobGetter func(ctx context.Context, client client.Client, store v1.Store, snapshot SnapshotResource) (*batchv1.Job, error)

JobGetter defines how to get the appropriate job for each snapshot type

type SkipStatusUpdates

type SkipStatusUpdates = TypedSkipStatusPredicate[client.Object]

func NewSkipStatusUpdates

func NewSkipStatusUpdates(logger *zap.SugaredLogger, allowList ...client.Object) (SkipStatusUpdates, error)

NewSkipStatusUpdates creates a new SkipStatusUpdates predicate with the given logger and allow list. The logger is required to prevent nil pointer panics during logging operations.

type SnapshotGetter

type SnapshotGetter func(ctx context.Context, client client.Client, key types.NamespacedName) (SnapshotResource, error)

SnapshotGetter defines how to get the snapshot resource from k8s

type SnapshotResource

type SnapshotResource interface {
	GetRuntimeObject() runtime.Object
	GetObjectMeta() metav1.Object
	GetSpec() v1.StoreSnapshotSpec
	GetStatus() *v1.StoreSnapshotStatus
}

SnapshotResource represents a common interface for snapshot resources

type StatusWriter

type StatusWriter func(ctx context.Context, client client.Client, key types.NamespacedName, status v1.StoreSnapshotStatus) error

StatusWriter defines how to write the snapshot status back to k8s

type StoreDebugInstanceReconciler

type StoreDebugInstanceReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
	Logger   *zap.SugaredLogger
}

StoreDebugInstanceReconciler reconciles a StoreDebugInstance object

func (*StoreDebugInstanceReconciler) Reconcile

func (r *StoreDebugInstanceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (rr ctrl.Result, err error)

func (*StoreDebugInstanceReconciler) SetupWithManager

func (r *StoreDebugInstanceReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type StoreExecReconciler

type StoreExecReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
	Logger   *zap.SugaredLogger
}

func (*StoreExecReconciler) Reconcile

func (r *StoreExecReconciler) Reconcile(ctx context.Context, req ctrl.Request) (rr ctrl.Result, err error)

func (*StoreExecReconciler) SetupWithManager

func (r *StoreExecReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type StoreReconciler

type StoreReconciler struct {
	client.Client
	Clientset            *kubernetes.Clientset
	RestConfig           *rest.Config
	Scheme               *runtime.Scheme
	Recorder             record.EventRecorder
	DisableServiceChecks bool
	EventHandlers        []event.EventHandler
	Logger               *zap.SugaredLogger
}

StoreReconciler reconciles a Store object

func (*StoreReconciler) Reconcile

func (r *StoreReconciler) Reconcile(
	ctx context.Context,
	req ctrl.Request,
) (rr ctrl.Result, err error)

func (*StoreReconciler) SendEvent

func (c *StoreReconciler) SendEvent(ctx context.Context, store v1.Store, message string)

func (*StoreReconciler) SetupWithManager

func (r *StoreReconciler) SetupWithManager(mgr ctrl.Manager, logger *zap.SugaredLogger) error

SetupWithManager sets up the controller with the Manager.

type StoreSnapshotBaseReconciler

type StoreSnapshotBaseReconciler struct {
	Client        client.Client
	EventHandlers []event.EventHandler
	Scheme        *runtime.Scheme
	Recorder      record.EventRecorder
	Logger        *zap.SugaredLogger
}

StoreSnapshotBaseReconciler contains shared logic for snapshot controllers

func (*StoreSnapshotBaseReconciler) ReconcileSnapshot

func (r *StoreSnapshotBaseReconciler) ReconcileSnapshot(
	ctx context.Context,
	req ctrl.Request,
	snapshotType string,
	getSnapshot SnapshotGetter,
	getJob JobGetter,
	createJob JobCreator,
	writeStatus StatusWriter,
) (ctrl.Result, error)

ReconcileSnapshot provides the main reconciliation logic for snapshot controllers

type StoreSnapshotCreateReconciler

type StoreSnapshotCreateReconciler struct {
	StoreSnapshotBaseReconciler
}

Send EVENT StoreSnapshotCreateReconciler reconciles a StoreSnapshot object

func (*StoreSnapshotCreateReconciler) Reconcile

func (*StoreSnapshotCreateReconciler) SendEvent

func (*StoreSnapshotCreateReconciler) SetupWithManager

func (r *StoreSnapshotCreateReconciler) SetupWithManager(mgr ctrl.Manager) error

TODO: Filter if the state is failed or succeeded, because then we don't reconcile finished snapshots SetupWithManager sets up the controller with the Manager.

type StoreSnapshotRestoreReconciler

type StoreSnapshotRestoreReconciler struct {
	StoreSnapshotBaseReconciler
}

StoreSnapshotRestoreReconciler reconciles a StoreSnapshot object

func (*StoreSnapshotRestoreReconciler) Reconcile

func (*StoreSnapshotRestoreReconciler) SendEvent

func (*StoreSnapshotRestoreReconciler) SetupWithManager

func (r *StoreSnapshotRestoreReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type TypedSkipStatusPredicate

type TypedSkipStatusPredicate[object client.Object] struct {
	predicate.TypedFuncs[object]
	Logger    *zap.SugaredLogger
	AllowList []client.Object
}

TypedSkipStatusPredicate filters out status-only updates.

func (TypedSkipStatusPredicate[object]) Update

func (t TypedSkipStatusPredicate[object]) Update(e event.TypedUpdateEvent[object]) (update bool)

Update returns false if only the status has changed, skipping reconciliation.

Jump to

Keyboard shortcuts

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