controller

package
v2.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 20 Imported by: 7

Documentation

Index

Constants

View Source
const (
	RunningPhase   shared.PhaseName     = "running"
	StartingPhase  shared.PhaseName     = "starting"
	ReadyCondition shared.ConditionName = "Ready"
	BaseAnnotation string               = "operator-sdk-extra.webcenter.fr"
	ShortenError   int                  = 5000
)

Variables

View Source
var (
	ErrWhenCallConfigureFromReconciler      = errors.Sentinel("Error when call 'configure' from reconciler")
	ErrWhenCallReadFromReconciler           = errors.Sentinel("Error when call 'read' from reconciler")
	ErrWhenCallDeleteFromReconciler         = errors.Sentinel("Error when call 'delete' from reconciler")
	ErrWhenCallDiffFromReconciler           = errors.Sentinel("Error when call 'diff' from reconciler")
	ErrWhenCallCreateFromReconciler         = errors.Sentinel("Error when call 'create' from reconciler")
	ErrWhenCallUpdateFromReconciler         = errors.Sentinel("Error when call 'update' from reconciler")
	ErrWhenCallOnSuccessFromReconciler      = errors.Sentinel("Error when call 'onSuccess' from reconciler")
	ErrWhenCallStepReconcilerFromReconciler = errors.Sentinel("Error when call 'reconcile' from step reconciler")
	ErrWhenGetObjectFromReconciler          = errors.Sentinel("Error when get object from reconciler")
	ErrWhenAddFinalizer                     = errors.Sentinel("Error when add finalizer")
	ErrWhenDeleteFinalizer                  = errors.Sentinel("Error when delete finalizer")
	ErrWhenGetObjectStatus                  = errors.Sentinel("Error when get object status")
)

Functions

func DefaultControllerRateLimiter

func DefaultControllerRateLimiter[T comparable]() workqueue.TypedRateLimiter[T]

DefaultControllerRateLimiter set rate limiter that is lower agressive than the default

func EnsureNetworkPolicyForWebhook added in v2.0.6

func EnsureNetworkPolicyForWebhook(c client.Client, logger *logrus.Entry, namespace string, labels map[string]string, podSelecetors map[string]string) error

EnsureNetworkPolicyForWebhook permit to create / update NetworkPolicy for webhook

func GetObjectMeta

func GetObjectMeta(r client.Object) metav1.ObjectMeta

GetObjectMeta permit to get the metata from client.Object

func GetObjectStatus

func GetObjectStatus(r client.Object) any

GetObjectStatus permit to get the status from client.Object

func MustInjectTypeMeta

func MustInjectTypeMeta(src, dst client.Object)

MustInjectTypeMeta permit to inject the typeMeta from src to dst

func SetupIndexerWithManager

func SetupIndexerWithManager(mgr ctrl.Manager, indexers ...Indexer) (err error)

SetupIndexerWithManager permit to registers indexers on manager

func SetupWebhookWithManager

func SetupWebhookWithManager(mgr ctrl.Manager, client client.Client, webhookRegisters ...WebhookRegister) (err error)

SetupWebhookWithManager permit to registers webhooks on manager

Types

type BaseReconciler

type BaseReconciler interface {
	// Client get the client
	Client() client.Client

	// Recorder get the recorder
	Recorder() record.EventRecorder
}

BaseReconciler is the interface for all reconciler

func NewBaseReconciler

func NewBaseReconciler(client client.Client, recorder record.EventRecorder) BaseReconciler

NewBaseReconciler return the default implementation of BaseReconciler interface

type Controller

type Controller interface {
	Reconcile(context.Context, reconcile.Request) (reconcile.Result, error)

	// SetupWithManager permit to setup controller with manager
	SetupWithManager(mgr ctrl.Manager) error
}

Controller is the controller interface

func NewController

func NewController() Controller

NewController is the default implementation of Controller index can be nil

type DefaultBaseReconciler

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

DefaultBaseReconciler is the default implementation of BaseReconciler interface

func (*DefaultBaseReconciler) Client

func (h *DefaultBaseReconciler) Client() client.Client

func (*DefaultBaseReconciler) Recorder

type DefaultController

type DefaultController struct{}

DefaultController is the default controller implementation

func (*DefaultController) Reconcile

func (*DefaultController) SetupWithManager

func (h *DefaultController) SetupWithManager(mgr ctrl.Manager) error

type DefaultReconciler

type DefaultReconciler struct {
	BaseReconciler
	// contains filtered or unexported fields
}

DefaultReconciler is the default implementation of Reconciler interface

func (*DefaultReconciler) Finalizer

func (h *DefaultReconciler) Finalizer() shared.FinalizerName

func (*DefaultReconciler) Logger

func (h *DefaultReconciler) Logger() *logrus.Entry

type DefaultReconcilerAction

type DefaultReconcilerAction struct {
	BaseReconciler
	// contains filtered or unexported fields
}

DefaultReconcilerAction is the default implementation of ReconcilerAction interface

func (*DefaultReconcilerAction) Condition

type Indexer

type Indexer func(mgr ctrl.Manager) error

Indexer is a function to add indexer on manager

type Reconciler

type Reconciler interface {
	BaseReconciler

	// Finalizer get the finalier name
	Finalizer() shared.FinalizerName

	// Logger get the logger
	Logger() *logrus.Entry
}

func NewReconciler

func NewReconciler(client client.Client, recorder record.EventRecorder, finalizer shared.FinalizerName, logger *logrus.Entry) Reconciler

NewReconciler is the default implementation of the Reconciler interface

type ReconcilerAction

type ReconcilerAction interface {
	BaseReconciler

	// Condition get the condition name
	Condition() shared.ConditionName
}

func NewReconcilerAction

func NewReconcilerAction(client client.Client, recorder record.EventRecorder, conditionName shared.ConditionName) ReconcilerAction

NewReconcilerAction return the default implementation of ReconcilerAction

type WebhookRegister

type WebhookRegister func(mgr ctrl.Manager, client client.Client) error

WebhookRegister is a function to add Webhook on manager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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