Documentation
¶
Index ¶
- func IsBeingDeleted(obj resource) bool
- func Reconcile(r Reconciler, request reconcile.Request, instance resource, log logr.Logger) (result reconcile.Result, err error)
- type BaseReconciler
- func (br BaseReconciler) GetClient() client.Client
- func (br BaseReconciler) GetConfig() *rest.Config
- func (br BaseReconciler) GetRecorder() record.EventRecorder
- func (br *BaseReconciler) GetResourceInstance(request reconcile.Request, instance resource) error
- func (br BaseReconciler) GetScheme() *runtime.Scheme
- func (br *BaseReconciler) IsValid(instance resource) (bool, error)
- func (br *BaseReconciler) ManageError(instance resource, err error, log logr.Logger) (reconcile.Result, error)
- func (br *BaseReconciler) ManageSuccess(instance resource, log logr.Logger) (reconcile.Result, error)
- type Reconciler
- type StatusReconciler
- type SyncReconciler
- type WatchManager
- func (wm *WatchManager) AddWatchers(watchers ...watch.Watcher)
- func (wm *WatchManager) GetWatchers(instance resource) watch.Watchers
- func (wm *WatchManager) InjectStopChannel(stop <-chan struct{}) error
- func (wm *WatchManager) RefreshWatch(request reconcile.Request) error
- func (wm *WatchManager) StartWatching() error
- type WatchReconciler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBeingDeleted ¶
func IsBeingDeleted(obj resource) bool
IsBeingDeleted returns whether this object has been requested to be deleted
Types ¶
type BaseReconciler ¶
type BaseReconciler struct {
// contains filtered or unexported fields
}
BaseReconciler implements common logic for Reconciler
func NewBaseReconciler ¶
func NewBaseReconciler( client client.Client, scheme *runtime.Scheme, recorder record.EventRecorder, config *rest.Config, ) BaseReconciler
NewBaseReconciler creates a new BaseReconciler
func (BaseReconciler) GetClient ¶
func (br BaseReconciler) GetClient() client.Client
GetClient returns controller runtime client object
func (BaseReconciler) GetConfig ¶
func (br BaseReconciler) GetConfig() *rest.Config
GetConfig implements Reconciler.GetConfig
func (BaseReconciler) GetRecorder ¶
func (br BaseReconciler) GetRecorder() record.EventRecorder
GetRecorder implements Reconciler.GetRecorder
func (*BaseReconciler) GetResourceInstance ¶
func (br *BaseReconciler) GetResourceInstance(request reconcile.Request, instance resource) error
GetResourceInstance implements Reconciler.GetResourceInstance by fetching the requested k8s object and updating the `instance` struct
func (BaseReconciler) GetScheme ¶
func (br BaseReconciler) GetScheme() *runtime.Scheme
GetScheme implements Reconciler.GetScheme
func (*BaseReconciler) IsValid ¶
func (br *BaseReconciler) IsValid(instance resource) (bool, error)
IsValid signifies whether given instance is valid
func (*BaseReconciler) ManageError ¶
func (br *BaseReconciler) ManageError(instance resource, err error, log logr.Logger) (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 (*BaseReconciler) ManageSuccess ¶
func (br *BaseReconciler) ManageSuccess(instance resource, log logr.Logger) (reconcile.Result, error)
ManageSuccess will update the status of the CR and return a successful reconcile result
type Reconciler ¶
type Reconciler interface { GetClient() client.Client GetRecorder() record.EventRecorder GetScheme() *runtime.Scheme GetConfig() *rest.Config GetResourceInstance(request reconcile.Request, instance resource) error ManageError(instance resource, err error, log logr.Logger) (reconcile.Result, error) ManageSuccess(instance resource, log logr.Logger) (reconcile.Result, error) IsValid(instance resource) (bool, error) }
Reconciler provides common helper methods useful for reconciliation.
type StatusReconciler ¶
type StatusReconciler interface {
UpdateStatus(instance resource) error
}
StatusReconciler is called after reconciliation to update the status of CR instance
type SyncReconciler ¶
type SyncReconciler interface { SyncResources(instance resource) error GetOwnedResourceKinds(instance runtime.Object) []runtime.Object }
SyncReconciler syncs k8s resources for a requested CR instance
type WatchManager ¶
type WatchManager struct {
// contains filtered or unexported fields
}
WatchManager manages a set of watchers, each of them running in parallel goroutines. It also supports graceful shutdown of watchers by closing all the destination channels whenever the injected stop channel is triggered.
func NewWatchManager ¶
func NewWatchManager(stop <-chan struct{}) *WatchManager
NewWatchManager creates a new WatchManager with empty watchers and given stop channel
func (*WatchManager) AddWatchers ¶
func (wm *WatchManager) AddWatchers(watchers ...watch.Watcher)
AddWatchers adds a requested set of watchers to be managed
func (*WatchManager) GetWatchers ¶
func (wm *WatchManager) GetWatchers(instance resource) watch.Watchers
GetWatchers returns the set of managed watchers
func (*WatchManager) InjectStopChannel ¶
func (wm *WatchManager) InjectStopChannel(stop <-chan struct{}) error
InjectStopChannel sets the stop channel, which when triggered would stop ongoing goroutines and close all channels
func (*WatchManager) RefreshWatch ¶
func (wm *WatchManager) RefreshWatch(request reconcile.Request) error
RefreshWatch refreshes the managed-watchers with the given reconciliation request.
func (*WatchManager) StartWatching ¶
func (wm *WatchManager) StartWatching() error
StartWatching starts up the required goroutines of watchers, which either terminates due to error in Watch() or when all channels are closed.