Documentation ¶
Index ¶
- Constants
- Variables
- func EnsureConditionsRegistered(conditions []corev1alpha1.ConditionSpec, resource Object)
- func RequeueUnless(result reconcile.Result, err error, duration time.Duration) (reconcile.Result, error)
- type ConditionManager
- func (c *ConditionManager) ActionRequired(message string, args ...interface{})
- func (c *ConditionManager) Deleting(message string, args ...interface{})
- func (c *ConditionManager) Disabled(message string, args ...interface{})
- func (c *ConditionManager) Failed(err error, message string, args ...interface{})
- func (c *ConditionManager) GetCondition() *corev1alpha1.Condition
- func (c *ConditionManager) InProgress(message string, args ...interface{})
- func (c *ConditionManager) Success(message string, args ...interface{})
- func (c *ConditionManager) Warning(message string, args ...interface{})
- type EnsureFunc
- type EnsureRunner
- type Finalizable
- type Finalizer
- func (c *Finalizer) Add(resource Finalizable) error
- func (c *Finalizer) EnsureEmpty(resource Finalizable) EnsureFunc
- func (c *Finalizer) EnsurePresent(resource Finalizable) func(context.Context) (reconcile.Result, error)
- func (c *Finalizer) EnsureRemoved(resource Finalizable) func(context.Context) (reconcile.Result, error)
- func (c *Finalizer) IsDeletionCandidate(resource Finalizable) bool
- func (c *Finalizer) NeedToAdd(resource Finalizable) bool
- func (c *Finalizer) Remove(resource Finalizable) error
- type Object
Constants ¶
const ( // ResourceReady is the default message we use for the ready condition, if the // controller has not set a message ResourceReady = "Resource ready" )
Variables ¶
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{} )
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
Types ¶
type ConditionManager ¶
type ConditionManager struct {
// contains filtered or unexported fields
}
ConditionManager manages the condition of the resource
func ConditionMgr ¶
func ConditionMgr(resource corev1alpha1.CommonStatusAware, condition corev1alpha1.ConditionType, recorder record.EventRecorder) *ConditionManager
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 golint: govet
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 ¶
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
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 ¶
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