Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultControllerRateLimiter[T comparable]() workqueue.TypedRateLimiter[T]
- func DeferStatusUpdate(ctx context.Context, c client.Client, o client.Object, logger *logrus.Entry) (deferred func() error, err error)
- func EnsureNetworkPolicyForWebhook(ctx context.Context, c client.Client, logger *logrus.Entry, namespace string, ...) error
- func GetObjectFromReconciler(ctx context.Context, c client.Client, req reconcile.Request, o client.Object, ...) (found bool, err error)
- func GetObjectMeta(r client.Object) metav1.ObjectMeta
- func GetObjectStatus(r client.Object) any
- func IsReconcileIgnored(o client.Object) bool
- func MustInjectTypeMeta(src, dst client.Object)
- func SetupIndexerWithManager(mgr ctrl.Manager, indexers ...Indexer) (err error)
- func SetupWebhookWithManager(mgr ctrl.Manager, client client.Client, webhookRegisters ...WebhookRegister) (err error)
- func UserFacingError(err error, maxLen int) string
- type BaseReconciler
- type Controller
- type DefaultBaseReconciler
- type DefaultController
- type DefaultReconciler
- type DefaultReconcilerAction
- type Indexer
- type Reconciler
- type ReconcilerAction
- type WebhookRegister
Constants ¶
const ( RunningPhase shared.PhaseName = "running" StartingPhase shared.PhaseName = "starting" ReadyCondition shared.ConditionName = "Ready" BaseAnnotation string = "operator-sdk-extra.webcenter.fr" // ShortenError is the historical max length used for truncating error messages. // Deprecated: use MaxConditionMessage, MaxEventMessage or MaxStatusMessage instead, // combined with UserFacingError to extract the root cause before truncating. ShortenError int = 5000 // MaxConditionMessage is the recommended max length for a metav1.Condition.Message // stored in a CRD status. The Kubernetes spec allows up to 32 KiB, but most // controllers cap well below 1 KiB to keep `kubectl get` / `kubectl describe` readable. MaxConditionMessage = 1024 // MaxEventMessage is the recommended max length for a corev1.Event message. // The Kubernetes event recorder silently drops events whose total size exceeds // the etcd object limit (~1.5 MiB), and messages above ~1 KiB are rarely useful // when surfaced via `kubectl describe`. MaxEventMessage = 512 // MaxStatusMessage is the recommended max length for the LastErrorMessage // field stored in CRD status. Stored in etcd, so kept short to avoid document // bloat across repeated failing reconcile loops. MaxStatusMessage = 1024 )
Variables ¶
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") ErrWhenCallApplyFromReconciler = errors.Sentinel("Error when call 'apply' from reconciler") ErrWhenCallOnSuccessFromReconciler = errors.Sentinel("Error when call 'onSuccess' from reconciler") ErrWhenCallOnDiffFromReconciler = errors.Sentinel("Error when call 'onDiff' 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 DeferStatusUpdate ¶
func DeferStatusUpdate(ctx context.Context, c client.Client, o client.Object, logger *logrus.Entry) (deferred func() error, err error)
DeferStatusUpdate snapshots the current object status and returns a deferred function that updates the status on the API server if it changed. It returns a no-op function when the object has no status.
func EnsureNetworkPolicyForWebhook ¶
func EnsureNetworkPolicyForWebhook(ctx context.Context, 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 GetObjectFromReconciler ¶
func GetObjectFromReconciler(ctx context.Context, c client.Client, req reconcile.Request, o client.Object, logger *logrus.Entry) (found bool, err error)
GetObjectFromReconciler fetches the reconciled object into o. It returns (found=false, nil) when the object no longer exists, so the caller can stop the reconcile loop cleanly.
func GetObjectMeta ¶
func GetObjectMeta(r client.Object) metav1.ObjectMeta
GetObjectMeta permit to get the metata from client.Object
func GetObjectStatus ¶
GetObjectStatus permit to get the status from client.Object
func IsReconcileIgnored ¶
IsReconcileIgnored returns true when the object carries the ignoreReconcile annotation.
func MustInjectTypeMeta ¶
MustInjectTypeMeta permit to inject the typeMeta from src to dst
func SetupIndexerWithManager ¶
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
func UserFacingError ¶
UserFacingError returns a short, human-useful error message from an error chain.
It extracts the deepest (root) cause through errors.Cause — the one produced by the underlying library or API — discarding the intermediate wrapping messages added by errors.Wrap / errors.Wrapf up the call stack. Those wrapping messages remain available via the logger.
The result is truncated to maxLen bytes. When truncation occurs the string is suffixed with "..." so the user can see the message was not complete.
If the chain has no extractable cause, the top-level error message is used as-is.
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
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 ¶
func (h *DefaultBaseReconciler) Recorder() record.EventRecorder
type DefaultController ¶
type DefaultController struct{}
DefaultController is the default controller implementation
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 ¶
func (h *DefaultReconcilerAction) Condition() shared.ConditionName
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
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package certificate provides pluggable TLSBackend abstractions for certificate management in Kubernetes operators.
|
Package certificate provides pluggable TLSBackend abstractions for certificate management in Kubernetes operators. |
|
byo
Package byo provides a TLSBackend that references an existing user-managed Secret.
|
Package byo provides a TLSBackend that references an existing user-managed Secret. |
|
certmanager
Package certmanager provides a TLSBackend that emits cert-manager Issuer and Certificate custom resources.
|
Package certmanager provides a TLSBackend that emits cert-manager Issuer and Certificate custom resources. |
|
selfmanaged
Package selfmanaged provides a TLSBackend that generates and manages CA and leaf certificates using Go's crypto/x509 standard library.
|
Package selfmanaged provides a TLSBackend that generates and manages CA and leaf certificates using Go's crypto/x509 standard library. |
|
Package workflow provides a multi-cycle saga abstraction on top of the multiphase reconciler pattern.
|
Package workflow provides a multi-cycle saga abstraction on top of the multiphase reconciler pattern. |