Documentation ¶
Index ¶
- type EnforcingReconciler
- func (er *EnforcingReconciler) GetLockedPatchStatuses(instance apis.Resource) map[string]status.Conditions
- func (er *EnforcingReconciler) GetLockedResourceStatuses(instance apis.Resource) map[string]status.Conditions
- func (er *EnforcingReconciler) GetStatusChangeChannel() <-chan event.GenericEvent
- func (er *EnforcingReconciler) ManageError(instance apis.Resource, issue error) (reconcile.Result, error)
- func (er *EnforcingReconciler) ManageSuccess(instance apis.Resource) (reconcile.Result, error)
- func (er *EnforcingReconciler) Terminate(instance apis.Resource, deleteResources bool) error
- func (er *EnforcingReconciler) UpdateLockedResources(instance apis.Resource, lockedResources []lockedresource.LockedResource, ...) error
- func (er *EnforcingReconciler) UpdateLockedResourcesWithRestConfig(instance apis.Resource, lockedResources []lockedresource.LockedResource, ...) error
- type LockedPatchReconciler
- type LockedResourceManager
- func (lrm *LockedResourceManager) GetPatchReconcilers() []*LockedPatchReconciler
- func (lrm *LockedResourceManager) GetPatches() []lockedpatch.LockedPatch
- func (lrm *LockedResourceManager) GetResourceReconcilers() []*LockedResourceReconciler
- func (lrm *LockedResourceManager) GetResources() []lockedresource.LockedResource
- func (lrm *LockedResourceManager) IsSamePatches(patches []lockedpatch.LockedPatch) (same bool, leftDifference []lockedpatch.LockedPatch, ...)
- func (lrm *LockedResourceManager) IsSameResources(resources []lockedresource.LockedResource) (same bool, leftDifference []lockedresource.LockedResource, ...)
- func (lrm *LockedResourceManager) IsStarted() bool
- func (lrm *LockedResourceManager) Restart(resources []lockedresource.LockedResource, patches []lockedpatch.LockedPatch, ...) error
- func (lrm *LockedResourceManager) SetPatches(patches []lockedpatch.LockedPatch) error
- func (lrm *LockedResourceManager) SetResources(resources []lockedresource.LockedResource) error
- func (lrm *LockedResourceManager) Start(config *rest.Config) error
- func (lrm *LockedResourceManager) Stop(deleteResources bool) error
- type LockedResourceReconciler
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, clusterWatchers bool) EnforcingReconciler
NewEnforcingReconciler creates a new EnforcingReconciler clusterWatcher detemines whether the created watchers should be at the cluster level or namespace level. this affects the kind of permissions needed to run the controlelr also creating multiple namespace level permissions can create performance issue as one watch per object type per namespace is opened to the API server, if in doubt pass true here.
func (*EnforcingReconciler) GetLockedPatchStatuses ¶ added in v0.2.5
func (er *EnforcingReconciler) GetLockedPatchStatuses(instance apis.Resource) map[string]status.Conditions
GetLockedPatchStatuses returns the status for all LockedPatches
func (*EnforcingReconciler) GetLockedResourceStatuses ¶
func (er *EnforcingReconciler) GetLockedResourceStatuses(instance apis.Resource) 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 apis.Resource, 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 apis.Resource, 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 apis.Resource, lockedResources []lockedresource.LockedResource, lockedPatches []lockedpatch.LockedPatch) 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
func (*EnforcingReconciler) UpdateLockedResourcesWithRestConfig ¶ added in v0.3.0
func (er *EnforcingReconciler) UpdateLockedResourcesWithRestConfig(instance apis.Resource, lockedResources []lockedresource.LockedResource, lockedPatches []lockedpatch.LockedPatch, config *rest.Config) error
UpdateLockedResourcesWithRestConfig 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
this varian allow passing a rest config
type LockedPatchReconciler ¶ added in v0.2.5
type LockedPatchReconciler struct { util.ReconcilerBase // contains filtered or unexported fields }
LockedPatchReconciler is a reconciler that can enforce a LockedPatch
func NewLockedPatchReconciler ¶ added in v0.2.5
func NewLockedPatchReconciler(mgr manager.Manager, patch lockedpatch.LockedPatch, statusChange chan<- event.GenericEvent, parentObject metav1.Object) (*LockedPatchReconciler, error)
NewLockedPatchReconciler returns a new reconcile.Reconciler
func (*LockedPatchReconciler) GetKey ¶ added in v0.2.5
func (lpr *LockedPatchReconciler) GetKey() string
GetKey return the patch no so unique identifier
func (*LockedPatchReconciler) GetStatus ¶ added in v0.2.5
func (lpr *LockedPatchReconciler) GetStatus() status.Conditions
GetStatus returns the status for this reconciler
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 apis.Resource, statusChange chan<- event.GenericEvent, clusterWatchers bool) (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) GetPatchReconcilers ¶ added in v0.2.5
func (lrm *LockedResourceManager) GetPatchReconcilers() []*LockedPatchReconciler
GetPatchReconcilers return the currently active patch reconcilers
func (*LockedResourceManager) GetPatches ¶ added in v0.2.5
func (lrm *LockedResourceManager) GetPatches() []lockedpatch.LockedPatch
GetPatches retunrs the currently enforced patches
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) IsSamePatches ¶ added in v0.2.5
func (lrm *LockedResourceManager) IsSamePatches(patches []lockedpatch.LockedPatch) (same bool, leftDifference []lockedpatch.LockedPatch, intersection []lockedpatch.LockedPatch, rightDifference []lockedpatch.LockedPatch)
IsSamePatches checks whether the currently enforced patches are the same as the ones passed as parameters same is true is current patches are the same as the patches passed as a parameter leftDifference contains the patches that are in the current patches but not in passed in the parameter intersection contains patches that are both in the current patches and the parameter, the patch definition may not be the same, the definitions of those in the parameter are returned rightDifference contains the patches that are in the parameter but not in the current patches
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 contains 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 contains 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, patches []lockedpatch.LockedPatch, deleteResources bool, config *rest.Config) error
Restart restarts the manager with a different set of resources if deleteResources is set, resources that were enforced are deleted.
func (*LockedResourceManager) SetPatches ¶ added in v0.2.5
func (lrm *LockedResourceManager) SetPatches(patches []lockedpatch.LockedPatch) error
SetPatches set the patches to be enfroced. Can be called only when the LockedResourceManager is stopped.
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(config *rest.Config) 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 apis.Resource) (*LockedResourceReconciler, error)
NewLockedObjectReconciler returns a new reconcile.Reconciler
func (*LockedResourceReconciler) GetStatus ¶
func (lor *LockedResourceReconciler) GetStatus() status.Conditions
GetStatus returns the latest reconcile status