Documentation ¶
Index ¶
- type EnforcingReconciler
- func (er *EnforcingReconciler) GetLockedResourceStatuses(instance metav1.Object) map[string]status.Conditions
- func (er *EnforcingReconciler) GetStatusChangeChannel() <-chan event.GenericEvent
- func (er *EnforcingReconciler) ManageError(instance metav1.Object, issue error) (reconcile.Result, error)
- func (er *EnforcingReconciler) ManageSuccess(instance metav1.Object) (reconcile.Result, error)
- func (er *EnforcingReconciler) Terminate(instance metav1.Object, deleteResources bool) error
- func (er *EnforcingReconciler) UpdateLockedResources(instance metav1.Object, lockedResources []lockedresource.LockedResource) error
- type LockedResourceManager
- func (lrm *LockedResourceManager) GetResourceReconcilers() []*LockedResourceReconciler
- func (lrm *LockedResourceManager) GetResources() []lockedresource.LockedResource
- func (lrm *LockedResourceManager) IsSameResources(resources []lockedresource.LockedResource) (same bool, leftDifference []lockedresource.LockedResource, ...)
- func (lrm *LockedResourceManager) IsStarted() bool
- func (lrm *LockedResourceManager) Restart(resources []lockedresource.LockedResource, deleteResources bool) error
- func (lrm *LockedResourceManager) SetResources(resources []lockedresource.LockedResource) error
- func (lrm *LockedResourceManager) Start() error
- func (lrm *LockedResourceManager) Stop(deleteResources bool) error
- type LockedResourceReconciler
- type Patch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnforcingReconciler ¶
type EnforcingReconciler struct { util.ReconcilerBase // contains filtered or unexported fields }
EnforcingReconciler is a reconciler designed to as a base type to extend for those operators that compute a set of resources that then need to be kept in place (i.e. enforced) the enforcing piece is taken care for, an implementor would just neeed to take care of the logic that computes the resorces to be enforced.
func NewEnforcingReconciler ¶
func NewEnforcingReconciler(client client.Client, scheme *runtime.Scheme, restConfig *rest.Config, recorder record.EventRecorder) EnforcingReconciler
NewEnforcingReconciler creates a new EnforcingReconciler
func (*EnforcingReconciler) GetLockedResourceStatuses ¶
func (er *EnforcingReconciler) GetLockedResourceStatuses(instance metav1.Object) map[string]status.Conditions
GetLockedResourceStatuses returns the status for all LockedResources
func (*EnforcingReconciler) GetStatusChangeChannel ¶
func (er *EnforcingReconciler) GetStatusChangeChannel() <-chan event.GenericEvent
GetStatusChangeChannel returns the channel thoughr which status change events can be received
func (*EnforcingReconciler) ManageError ¶
func (er *EnforcingReconciler) ManageError(instance metav1.Object, issue error) (reconcile.Result, error)
ManageError manage error sets an error status in the CR and fires an event, finally it returns the error so the operator can re-attempt
func (*EnforcingReconciler) ManageSuccess ¶
ManageSuccess will update the status of the CR and return a successful reconcile result
func (*EnforcingReconciler) Terminate ¶
func (er *EnforcingReconciler) Terminate(instance metav1.Object, deleteResources bool) error
Terminate will stop the execution for the current istance. It will also optionally delete the locked resources.
func (*EnforcingReconciler) UpdateLockedResources ¶
func (er *EnforcingReconciler) UpdateLockedResources(instance metav1.Object, lockedResources []lockedresource.LockedResource) error
UpdateLockedResources will do the following:
- initialize or retrieve the LockedResourceManager related to the passed parent resource
- compare the currently enfrced resources with the one passed as parameters and then a. return immediately if they are the same b. restart the LockedResourceManager if they don't match
type LockedResourceManager ¶
type LockedResourceManager struct {
// contains filtered or unexported fields
}
LockedResourceManager is a manager designed to manage a set of LockedResourceReconciler. Each reconciler can handle a LockedResource. LockedResourceManager is designed to be sued within an operator to enforce a set of resources. It has methods to start and stop the enforcing and to detect whether a set of resources is equal to the currently enforce set.
func NewLockedResourceManager ¶
func NewLockedResourceManager(config *rest.Config, options manager.Options, parent metav1.Object, statusChange chan<- event.GenericEvent) (LockedResourceManager, error)
NewLockedResourceManager build a new LockedResourceManager config: the rest config client to be used by the controllers options: the manager options parent: an object to which send notification when a recocilianton cicle completes for one of the reconcilers statusChange: a channel through which send the notifications
func (*LockedResourceManager) GetResourceReconcilers ¶
func (lrm *LockedResourceManager) GetResourceReconcilers() []*LockedResourceReconciler
GetResourceReconcilers return the currently active resource reconcilers
func (*LockedResourceManager) GetResources ¶
func (lrm *LockedResourceManager) GetResources() []lockedresource.LockedResource
GetResources returns the currently enforced resources
func (*LockedResourceManager) IsSameResources ¶
func (lrm *LockedResourceManager) IsSameResources(resources []lockedresource.LockedResource) (same bool, leftDifference []lockedresource.LockedResource, intersection []lockedresource.LockedResource, rightDifference []lockedresource.LockedResource)
IsSameResources checks whether the currently enforced resources are the same as the ones passed as parameters same is true is current resources are the same as the resources passed as a parameter leftDifference containes the resources that are in the current reosurces but not in passed in the parameter intersection contains resources that are both in the current resources and the parameter rightDifference containes the resources that are in the parameter but not in the current resources
func (*LockedResourceManager) IsStarted ¶
func (lrm *LockedResourceManager) IsStarted() bool
IsStarted returns whether the LockedResourceManager is started
func (*LockedResourceManager) Restart ¶
func (lrm *LockedResourceManager) Restart(resources []lockedresource.LockedResource, deleteResources bool) error
Restart restarts the manager with a different set of resources if deleteResources is set, resources that were enforced are deleted.
func (*LockedResourceManager) SetResources ¶
func (lrm *LockedResourceManager) SetResources(resources []lockedresource.LockedResource) error
SetResources set the resources to be enfroced. Can be called only when the LockedResourceManager is stopped.
func (*LockedResourceManager) Start ¶
func (lrm *LockedResourceManager) Start() error
Start starts the LockedResourceManager
func (*LockedResourceManager) Stop ¶
func (lrm *LockedResourceManager) Stop(deleteResources bool) error
Stop stops the LockedResourceManager. deleteResource controls whether the managed resources should be deleted or left in place notice that lrm will always succed at stoppping the manager, but it might fail at deleting resources
type LockedResourceReconciler ¶
type LockedResourceReconciler struct { Resource unstructured.Unstructured ExcludePaths []string util.ReconcilerBase // contains filtered or unexported fields }
LockedResourceReconciler is a reconciler that will lock down a resource based preventi changes from external events. This reconciler cna be configured to ignore a set og json path. Changed occuring on the ignored path will be ignored, and therefore allowed by the reconciler
func NewLockedObjectReconciler ¶
func NewLockedObjectReconciler(mgr manager.Manager, object unstructured.Unstructured, excludePaths []string, statusChange chan<- event.GenericEvent, parentObject metav1.Object) (*LockedResourceReconciler, error)
NewLockedObjectReconciler returns a new reconcile.Reconciler
func (*LockedResourceReconciler) GetStatus ¶
func (lor *LockedResourceReconciler) GetStatus() status.Conditions
GetStatus returns the latest reconcile status