controller

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 42 Imported by: 4

Documentation

Index

Constants

View Source
const (
	PrometheusNamespace = "operatorkit"
	PrometheusSubsystem = "controller"
)
View Source
const (
	DefaultResyncPeriod = 5 * time.Minute
)
View Source
const (
	DisableMetricsServing = "0"
)

Variables

This section is empty.

Functions

func IsExecutionFailed

func IsExecutionFailed(err error) bool

IsExecutionFailed asserts executionFailedError.

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsNoResourceSet

func IsNoResourceSet(err error) bool

IsNoResourceSet asserts noResourceSetError.

func IsPortforward

func IsPortforward(err error) bool

IsPortforward asserts portForwardError.

func IsStatusForbidden

func IsStatusForbidden(err error) bool

IsStatusForbiddenError asserts statusForbiddenError and apimachinery StatusError with StatusReasonForbidden.

func IsTooManyResourceSets

func IsTooManyResourceSets(err error) bool

IsTooManyResourceSets asserts tooManyResourceSetsError.

Types

type Config

type Config struct {
	// InitCtx is deprecated and should not be used anymore.
	InitCtx func(ctx context.Context, obj interface{}) (context.Context, error)
	// K8sClient is the client collection used to setup and manage certain
	// operatorkit primitives. The Controller Client is used to fetch runtime
	// objects. It therefore must be properly configured using the AddToScheme
	// option. The REST Client is used to patch finalizers on runtime objects.
	K8sClient k8sclient.Interface
	Logger    micrologger.Logger
	// NewRuntimeObjectFunc returns a new initialized pointer of a type
	// implementing the runtime object interface. The object returned is used with
	// the controller-runtime client to fetch the latest version of the object
	// itself. That way we can manage all runtime objects in a somewhat generic
	// way. See the example below.
	//
	//     func() pkgruntime.Object {
	//        return new(corev1.ConfigMap)
	//     }
	//
	NewRuntimeObjectFunc func() pkgruntime.Object
	Pause                map[string]string
	// Resources is the list of controller resources being executed on runtime
	// object reconciliation. Resources are executed in given order.
	Resources []resource.Interface
	// Selector is used to filter objects before passing them to the controller.
	Selector labels.Selector

	// Name is the name which the controller uses on finalizers for resources.
	// The name used should be unique in the kubernetes cluster, to ensure that
	// two operators which handle the same resource add two distinct finalizers.
	Name string
	// Namespace is where the controller would reconcile the runtime objects.
	// Empty string means all namespaces.
	Namespace string
	// ResyncPeriod is the duration after which a complete sync with all known
	// runtime objects the controller watches is performed. Defaults to
	// DefaultResyncPeriod.
	ResyncPeriod time.Duration
	// SentryDSN is the optional URL used to forward runtime errors to the sentry.io service.
	// If this field is empty, logs will not be forwarded.
	SentryDSN string
	// SentryTags is an optional map that allows to specify key-value pairs to be be sent alongside
	// errors to the sentry.io service.
	SentryTags map[string]string
}

type Controller

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

func New

func New(config Config) (*Controller, error)

New creates a new configured operator controller.

func (*Controller) Boot

func (c *Controller) Boot(ctx context.Context)

func (*Controller) Booted

func (c *Controller) Booted() chan struct{}

func (*Controller) Reconcile

func (c *Controller) Reconcile(req reconcile.Request) (reconcile.Result, error)

Reconcile implements the reconciler given to the controller-runtime controller. Reconcile never returns any error as we deal with them in operatorkit internally.

func (*Controller) Stop

func (c *Controller) Stop(ctx context.Context)

Directories

Path Synopsis
context
cachekeycontext
Package cachekeycontext stores and accesses the local context key in context.Context.
Package cachekeycontext stores and accesses the local context key in context.Context.
finalizerskeptcontext
Package finalizerskeptcontext stores and accesses the kept in context.Context.
Package finalizerskeptcontext stores and accesses the kept in context.Context.
reconciliationcanceledcontext
Package reconciliationcanceledcontext stores and accesses the canceled in context.Context.
Package reconciliationcanceledcontext stores and accesses the canceled in context.Context.
resourcecanceledcontext
Package resourcecanceledcontext stores and accesses the canceled in context.Context.
Package resourcecanceledcontext stores and accesses the canceled in context.Context.
updateallowedcontext
Package updateallowedcontext stores and accesses the update allowed in context.Context.
Package updateallowedcontext stores and accesses the update allowed in context.Context.
internal

Jump to

Keyboard shortcuts

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