Documentation ¶
Index ¶
- func ShouldTakeUpdatePath(targetVersion, currentVersion string, deploying bool) (bool, error)
- type CallbackDispatcher
- type ControllerConfigUpdater
- type CrManager
- type PerishablesSynchronizer
- type PreCreateHook
- type Reconciler
- func (r *Reconciler) AddCallback(obj client.Object, cb callbacks.ReconcileCallback)
- func (r *Reconciler) CheckDegraded(logger logr.Logger, cr client.Object) (bool, error)
- func (r *Reconciler) CheckForOrphans(logger logr.Logger, cr client.Object) (bool, error)
- func (r *Reconciler) CheckUpgrade(logger logr.Logger, cr client.Object, targetVersion string) error
- func (r *Reconciler) CleanupUnusedResources(logger logr.Logger, cr client.Object) error
- func (r *Reconciler) CrError(cr client.Object) error
- func (r *Reconciler) CrInit(cr client.Object, operatorVersion string) error
- func (r *Reconciler) CrSetVersion(cr client.Object, version string) error
- func (r *Reconciler) CrUpdate(cr client.Object) error
- func (r *Reconciler) CrUpdateStatus(phase sdkapi.Phase, cr client.Object) error
- func (r *Reconciler) GetAllDeployments(cr client.Object) ([]*appsv1.Deployment, error)
- func (r *Reconciler) GetCr(name types.NamespacedName) (client.Object, error)
- func (r *Reconciler) InvokeCallbacks(l logr.Logger, cr client.Object, s callbacks.ReconcileState, ...) error
- func (r *Reconciler) InvokeDeleteCallbacks(logger logr.Logger, cr client.Object) error
- func (r *Reconciler) Reconcile(request reconcile.Request, operatorVersion string, reqLogger logr.Logger) (reconcile.Result, error)
- func (r *Reconciler) ReconcileDelete(logger logr.Logger, cr client.Object, finalizerName string) (reconcile.Result, error)
- func (r *Reconciler) ReconcileError(cr client.Object, message string) (reconcile.Result, error)
- func (r *Reconciler) ReconcileUpdate(logger logr.Logger, cr client.Object, operatorVersion string) (reconcile.Result, error)
- func (r *Reconciler) WatchCR() error
- func (r *Reconciler) WatchDependantResources(cr client.Object) error
- func (r *Reconciler) WatchResourceTypes(resources ...client.Object) error
- func (r *Reconciler) WithController(controller controller.Controller) *Reconciler
- func (r *Reconciler) WithControllerConfigUpdater(updateConfig ControllerConfigUpdater) *Reconciler
- func (r *Reconciler) WithNamespacedCR() *Reconciler
- func (r *Reconciler) WithPerishablesSynchronizer(syncPerishables PerishablesSynchronizer) *Reconciler
- func (r *Reconciler) WithPreCreateHook(preCreate PreCreateHook) *Reconciler
- func (r *Reconciler) WithSanityChecker(checkSanity SanityChecker) *Reconciler
- func (r *Reconciler) WithWatchRegistrator(watch WatchRegistrator) *Reconciler
- func (r *Reconciler) WithWatching(watching bool) *Reconciler
- type SanityChecker
- type WatchRegistrator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallbackDispatcher ¶
type CallbackDispatcher interface { // AddCallback registers a callback for given object type AddCallback(client.Object, callbacks.ReconcileCallback) // InvokeCallbacks executes callbacks for desired/current object type InvokeCallbacks(l logr.Logger, cr interface{}, s callbacks.ReconcileState, desiredObj, currentObj client.Object, recorder record.EventRecorder) error }
CallbackDispatcher manages and executes resource callbacks
type ControllerConfigUpdater ¶
ControllerConfigUpdater is expected to update controller configuration if required
type CrManager ¶
type CrManager interface { // IsCreating checks whether creation of the managed resources will be executed IsCreating(cr client.Object) (bool, error) // Creates empty CR Create() client.Object // Status extracts status from the cr Status(cr client.Object) *sdkapi.Status // GetAllResources provides all resources managed by the cr GetAllResources(cr client.Object) ([]client.Object, error) // GetDependantResourcesListObjects returns resource list objects of dependant resources GetDependantResourcesListObjects() []client.ObjectList }
CrManager defines interface that needs to be provided for the reconciler to operate
type PerishablesSynchronizer ¶
PerishablesSynchronizer is expected to execute perishable resources (i.e. certificates) synchronization if required
type PreCreateHook ¶
PreCreateHook is expected to perform custom actions before the creation of the managed resources is initiated
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler is responsible for performing deployment reconciliation
func NewReconciler ¶
func NewReconciler(crManager CrManager, log logr.Logger, client client.Client, callbackDispatcher CallbackDispatcher, scheme *runtime.Scheme, getCache func() cache.Cache, createVersionLabel string, updateVersionLabel string, lastAppliedConfigAnnotation string, perishablesSyncInterval time.Duration, finalizerName string, subresourceEnabled bool, recorder record.EventRecorder) *Reconciler
NewReconciler creates new Reconciler instance configured with given parameters
func (*Reconciler) AddCallback ¶
func (r *Reconciler) AddCallback(obj client.Object, cb callbacks.ReconcileCallback)
AddCallback registers a callback for given object type
func (*Reconciler) CheckDegraded ¶
CheckDegraded checks whether the deployment is degraded and updates CR status conditions accordingly
func (*Reconciler) CheckForOrphans ¶
CheckForOrphans checks whether there are any orphaned resources (ones that exist in the cluster but shouldn't)
func (*Reconciler) CheckUpgrade ¶
CheckUpgrade checks whether an upgrade should be performed
func (*Reconciler) CleanupUnusedResources ¶
CleanupUnusedResources removes unused resources
func (*Reconciler) CrError ¶
func (r *Reconciler) CrError(cr client.Object) error
CrError sets the CR's phase to "Error"
func (*Reconciler) CrInit ¶
func (r *Reconciler) CrInit(cr client.Object, operatorVersion string) error
CrInit initializes the CR and moves it to CR to "Deploying" status
func (*Reconciler) CrSetVersion ¶
func (r *Reconciler) CrSetVersion(cr client.Object, version string) error
CrSetVersion sets version and phase on the CR object
func (*Reconciler) CrUpdate ¶
func (r *Reconciler) CrUpdate(cr client.Object) error
CrUpdate sets given phase on the CR and updates it in the cluster
func (*Reconciler) CrUpdateStatus ¶ added in v0.2.3
CrUpdateStatus sets given phase on the CR and updates it in the cluster
func (*Reconciler) GetAllDeployments ¶
func (r *Reconciler) GetAllDeployments(cr client.Object) ([]*appsv1.Deployment, error)
GetAllDeployments retrieves all deployments associated to the given CR object
func (*Reconciler) GetCr ¶
func (r *Reconciler) GetCr(name types.NamespacedName) (client.Object, error)
GetCr retrieves the CR
func (*Reconciler) InvokeCallbacks ¶
func (r *Reconciler) InvokeCallbacks(l logr.Logger, cr client.Object, s callbacks.ReconcileState, desiredObj, currentObj client.Object, recorder record.EventRecorder) error
InvokeCallbacks executes callbacks registered
func (*Reconciler) InvokeDeleteCallbacks ¶
InvokeDeleteCallbacks executes operator deletion callbacks
func (*Reconciler) Reconcile ¶
func (r *Reconciler) Reconcile(request reconcile.Request, operatorVersion string, reqLogger logr.Logger) (reconcile.Result, error)
Reconcile performs request reconciliation
func (*Reconciler) ReconcileDelete ¶
func (r *Reconciler) ReconcileDelete(logger logr.Logger, cr client.Object, finalizerName string) (reconcile.Result, error)
ReconcileDelete executes Delete operation
func (*Reconciler) ReconcileError ¶
ReconcileError Marks CR as failed
func (*Reconciler) ReconcileUpdate ¶
func (r *Reconciler) ReconcileUpdate(logger logr.Logger, cr client.Object, operatorVersion string) (reconcile.Result, error)
ReconcileUpdate executes Update operation
func (*Reconciler) WatchCR ¶
func (r *Reconciler) WatchCR() error
WatchCR registers watch for the managed CR
func (*Reconciler) WatchDependantResources ¶
func (r *Reconciler) WatchDependantResources(cr client.Object) error
WatchDependantResources registers watches for dependant resource types
func (*Reconciler) WatchResourceTypes ¶
func (r *Reconciler) WatchResourceTypes(resources ...client.Object) error
WatchResourceTypes registers watches for given resources types
func (*Reconciler) WithController ¶
func (r *Reconciler) WithController(controller controller.Controller) *Reconciler
WithController sets controller
func (*Reconciler) WithControllerConfigUpdater ¶
func (r *Reconciler) WithControllerConfigUpdater(updateConfig ControllerConfigUpdater) *Reconciler
WithControllerConfigUpdater sets ControllerConfigUpdater
func (*Reconciler) WithNamespacedCR ¶ added in v0.1.1
func (r *Reconciler) WithNamespacedCR() *Reconciler
WithNamespacedCR informs the Reconciler that the configuration CR is namespaced
func (*Reconciler) WithPerishablesSynchronizer ¶
func (r *Reconciler) WithPerishablesSynchronizer(syncPerishables PerishablesSynchronizer) *Reconciler
WithPerishablesSynchronizer sets PerishablesSynchronizer, which must not be nil
func (*Reconciler) WithPreCreateHook ¶
func (r *Reconciler) WithPreCreateHook(preCreate PreCreateHook) *Reconciler
WithPreCreateHook sets PreCreateHook
func (*Reconciler) WithSanityChecker ¶
func (r *Reconciler) WithSanityChecker(checkSanity SanityChecker) *Reconciler
WithSanityChecker sets SanityChecker
func (*Reconciler) WithWatchRegistrator ¶
func (r *Reconciler) WithWatchRegistrator(watch WatchRegistrator) *Reconciler
WithWatchRegistrator sets WatchRegistrator
func (*Reconciler) WithWatching ¶
func (r *Reconciler) WithWatching(watching bool) *Reconciler
WithWatching sets watching flag - for testing
type SanityChecker ¶
SanityChecker is expected to check if it makes sense to execute the reconciliation if required
type WatchRegistrator ¶
type WatchRegistrator func() error
WatchRegistrator is expected to register additional resource watchers if required