controller

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIgnore is used to used to stop the ensure chain
	ErrIgnore = errors.New("resource is being ignored")
	// DefaultEnsureHandler is the default sequential runner for a list of ensure functions
	DefaultEnsureHandler = EnsureRunner{}
	// ResourceReady is the default message we use for the ready condition, if the
	// controller has not set a message
	ResourceReady = "Resource ready"
)
View Source
var RequeueImmediate = reconcile.Result{RequeueAfter: 5 * time.Millisecond}

RequeueImmediate should be used anywhere we wish an immediate / ASAP requeue to be performed

Functions

func EnsureConditionsRegistered

func EnsureConditionsRegistered(conditions []corev1alpha1.ConditionSpec, resource Object)

EnsureConditionsRegistered is responsible for ensuring all the conditions are registered

func RequeueUnless added in v0.4.0

func RequeueUnless(result reconcile.Result, err error, duration time.Duration) (reconcile.Result, error)

RequeueUnless is a helper function to return a requeue result unless a requeue is already set or an error is present

Types

type ConditionManager

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

ConditionManager manages the condition of the resource

func ConditionMgr

ConditionMgr returns a manager for the condition

func (*ConditionManager) ActionRequired

func (c *ConditionManager) ActionRequired(message string, args ...interface{})

ActionRequired sets the condition to action required

func (*ConditionManager) Deleting

func (c *ConditionManager) Deleting(message string, args ...interface{})

Deleting sets the condition to deleting

func (*ConditionManager) Disabled added in v0.3.25

func (c *ConditionManager) Disabled(message string, args ...interface{})

Disabled sets the condition to disabled

func (*ConditionManager) Failed

func (c *ConditionManager) Failed(err error, message string, args ...interface{})

Failed sets the condition to failed

func (*ConditionManager) GetCondition

func (c *ConditionManager) GetCondition() *corev1alpha1.Condition

GetCondition returns the condition

func (*ConditionManager) InProgress

func (c *ConditionManager) InProgress(message string, args ...interface{})

InProgress sets the condition to in progress

func (*ConditionManager) Success

func (c *ConditionManager) Success(message string, args ...interface{})

Success sets the condition to successful

func (*ConditionManager) Warning

func (c *ConditionManager) Warning(message string, args ...interface{})

Warning sets the condition to successful

type EnsureFunc

type EnsureFunc func(ctx context.Context) (reconcile.Result, error)

EnsureFunc defines a method to ensure a state

func RequeueAfter

func RequeueAfter(d time.Duration) EnsureFunc

RequeueAfter is a helper function to return a requeue result with the given duration

type EnsureRunner

type EnsureRunner struct{}

EnsureRunner provides a wrapper for running ensure funcs

func (*EnsureRunner) Run

func (e *EnsureRunner) Run(ctx context.Context, cc client.Client, resource Object, ensures []EnsureFunc) (result reconcile.Result, rerr error)

Run is a generic handler for running the ensure methods

type Finalizable

type Finalizable interface {
	client.Object
	GetFinalizers() []string
	SetFinalizers(finalizers []string)
	GetDeletionTimestamp() *metav1.Time
}

Finalizable is an kubernetes resource api object that supports finalizers

type Finalizer

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

Finalizer manages the finalizers for resources in kubernetes

func NewFinalizer

func NewFinalizer(driver client.Client, finalizerValue string) *Finalizer

NewFinalizer constructs a new finalizer manager

func (*Finalizer) Add

func (c *Finalizer) Add(resource Finalizable) error

Add adds a finalizer to an object

func (*Finalizer) EnsureEmpty

func (c *Finalizer) EnsureEmpty(resource Finalizable) EnsureFunc

EnsureEmpty finalizer only includes us - so we can continue and delete the resource

func (*Finalizer) EnsurePresent

func (c *Finalizer) EnsurePresent(resource Finalizable) func(context.Context) (reconcile.Result, error)

EnsurePresent ensures the finalizer is present on the resource

func (*Finalizer) EnsureRemoved

func (c *Finalizer) EnsureRemoved(resource Finalizable) func(context.Context) (reconcile.Result, error)

EnsureRemoved is called to ensure we have removed ourself from the finalizers

func (*Finalizer) IsDeletionCandidate

func (c *Finalizer) IsDeletionCandidate(resource Finalizable) bool

IsDeletionCandidate checks if the resource is a candidate for deletion @note: this method should not be used by a dependent - they should simply check resource.GetDeletionTimestamp() != nil

func (*Finalizer) NeedToAdd

func (c *Finalizer) NeedToAdd(resource Finalizable) bool

NeedToAdd checks if the resource should have but does not have the finalizer

func (*Finalizer) Remove

func (c *Finalizer) Remove(resource Finalizable) error

Remove removes a finalizer from an object

type Object

type Object interface {
	client.Object
	corev1alpha1.CommonStatusAware
}

Object provides a convenience wrapper around the object

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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