Documentation ¶
Overview ¶
Package errhandler provides a wrapper reconciler for automatically handling errors produced by a delegate, which are normally dropped and cause the request to be requeued.
It also includes errmark-compatible rules for common Kubernetes errors. You can use these to build up matching actions for the reconciler to handle.
Index ¶
- Variables
- func ChainReconciler(opts ...ReconcilerOption) filter.Chainable
- type ErrorHandler
- type ErrorHandlerFunc
- type ErrorMatcher
- type ErrorMatchersBuilder
- func (emb *ErrorMatchersBuilder) Append(rule errmark.Rule, hnd ErrorHandler) *ErrorMatchersBuilder
- func (emb *ErrorMatchersBuilder) Build() (matchers []ErrorMatcher)
- func (emb *ErrorMatchersBuilder) Prepend(rule errmark.Rule, hnd ErrorHandler) *ErrorMatchersBuilder
- func (emb *ErrorMatchersBuilder) SetFallback(hnd ErrorHandler) *ErrorMatchersBuilder
- type PanicHandler
- type PanicHandlerFunc
- type Reconciler
- type ReconcilerOption
- type ReconcilerOptionFunc
- type ReconcilerOptions
- type WithErrorMatchers
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RuleIsConflict = errmark.RuleAny( errmark.RuleFunc(errors.IsConflict), errmark.RuleFunc(errors.IsAlreadyExists), ) RuleIsTimeout = errmark.RuleAny( errmark.RuleFunc(errors.IsTimeout), errmark.RuleFunc(errors.IsServerTimeout), ) RuleIsForbidden = errmark.RuleFunc(errors.IsForbidden) RuleIsRequired = errmark.RuleType(&lifecycle.RequiredError{}) )
View Source
var DefaultErrorMatchers = NewDefaultErrorMatchersBuilder().Build()
Functions ¶
func ChainReconciler ¶
func ChainReconciler(opts ...ReconcilerOption) filter.Chainable
Types ¶
type ErrorHandler ¶
type ErrorHandler interface {
OnError(ctx context.Context, req reconcile.Request, err error) (reconcile.Result, error)
}
var ( LoggingErrorHandler ErrorHandler = ErrorHandlerFunc(func(ctx context.Context, req reconcile.Request, err error) (reconcile.Result, error) { klog.ErrorDepth(2, err) return reconcile.Result{}, err }) PropagatingErrorHandler ErrorHandler = ErrorHandlerFunc(func(ctx context.Context, req reconcile.Request, err error) (reconcile.Result, error) { return reconcile.Result{}, err }) MaskingErrorHandler ErrorHandler = ErrorHandlerFunc(func(ctx context.Context, req reconcile.Request, err error) (reconcile.Result, error) { return reconcile.Result{}, nil }) )
type ErrorHandlerFunc ¶
type ErrorMatcher ¶
type ErrorMatcher struct { Rule errmark.Rule Handler ErrorHandler }
type ErrorMatchersBuilder ¶
type ErrorMatchersBuilder struct {
// contains filtered or unexported fields
}
func NewDefaultErrorMatchersBuilder ¶
func NewDefaultErrorMatchersBuilder() *ErrorMatchersBuilder
func NewErrorMatchersBuilder ¶
func NewErrorMatchersBuilder() *ErrorMatchersBuilder
func (*ErrorMatchersBuilder) Append ¶
func (emb *ErrorMatchersBuilder) Append(rule errmark.Rule, hnd ErrorHandler) *ErrorMatchersBuilder
func (*ErrorMatchersBuilder) Build ¶
func (emb *ErrorMatchersBuilder) Build() (matchers []ErrorMatcher)
func (*ErrorMatchersBuilder) Prepend ¶
func (emb *ErrorMatchersBuilder) Prepend(rule errmark.Rule, hnd ErrorHandler) *ErrorMatchersBuilder
func (*ErrorMatchersBuilder) SetFallback ¶
func (emb *ErrorMatchersBuilder) SetFallback(hnd ErrorHandler) *ErrorMatchersBuilder
type PanicHandler ¶
type PanicHandlerFunc ¶
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
func NewReconciler ¶
func NewReconciler(delegate reconcile.Reconciler, opts ...ReconcilerOption) *Reconciler
func (*Reconciler) InjectFunc ¶
func (r *Reconciler) InjectFunc(f inject.Func) error
type ReconcilerOption ¶
type ReconcilerOption interface {
ApplyToReconcilerOptions(target *ReconcilerOptions)
}
func WithPanicHandler ¶
func WithPanicHandler(ph PanicHandler) ReconcilerOption
type ReconcilerOptionFunc ¶
type ReconcilerOptionFunc func(target *ReconcilerOptions)
func (ReconcilerOptionFunc) ApplyToReconcilerOptions ¶
func (rof ReconcilerOptionFunc) ApplyToReconcilerOptions(target *ReconcilerOptions)
type ReconcilerOptions ¶
type ReconcilerOptions struct { ErrorMatchers []ErrorMatcher PanicHandler PanicHandler }
func (*ReconcilerOptions) ApplyOptions ¶
func (o *ReconcilerOptions) ApplyOptions(opts []ReconcilerOption)
type WithErrorMatchers ¶
type WithErrorMatchers []ErrorMatcher
func (WithErrorMatchers) ApplyToReconcilerOptions ¶
func (wem WithErrorMatchers) ApplyToReconcilerOptions(target *ReconcilerOptions)
Click to show internal directories.
Click to hide internal directories.