errhandler

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: Apache-2.0 Imports: 9 Imported by: 8

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

Constants

This section is empty.

Variables

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 ErrorHandlerFunc func(ctx context.Context, req reconcile.Request, err error) (reconcile.Result, error)

func (ErrorHandlerFunc) OnError

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 (*ErrorMatchersBuilder) Build

func (emb *ErrorMatchersBuilder) Build() (matchers []ErrorMatcher)

func (*ErrorMatchersBuilder) Prepend

func (*ErrorMatchersBuilder) SetFallback

type PanicHandler

type PanicHandler interface {
	OnPanic(ctx context.Context, req reconcile.Request, rv interface{}) (reconcile.Result, error)
}

type PanicHandlerFunc

type PanicHandlerFunc func(ctx context.Context, req reconcile.Request, rv interface{}) (reconcile.Result, error)

func (PanicHandlerFunc) OnPanic

func (phf PanicHandlerFunc) OnPanic(ctx context.Context, req reconcile.Request, rv interface{}) (reconcile.Result, error)

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

func (Reconciler) Reconcile

func (r Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (result reconcile.Result, err 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)

Jump to

Keyboard shortcuts

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