Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SingleObjectPredicate ¶
SingleObjectPredicate returns a Predicate which filters events by both name & namespace. The Predicate methods return true if the object matches.
Use this for client-side filtering when you can't use server-side fieldSelectors, like when an informer is shared between controllers.
Types ¶
type Controller ¶
type Controller struct { SyncScope declared.Scope SyncName string Client client.Client Mapper meta.RESTMapper Scheme *runtime.Scheme Finalizer Finalizer }
Controller that watches a RootSync or RepoSync, injects a finalizer when deletion propagation is enabled via annotation, handles deletion propagation when the RSync is marked for deletion, and removes the finalizer when deletion propagation is complete.
Use `configsync.gke.io/deletion-propagation-policy: Foreground` to enable deletion propagation.
Use `configsync.gke.io/deletion-propagation-policy: Orphan` or remove the annotation to disable deletion propagation (default behavior).
The `configsync.gke.io/reconciler` finalizer is used to block deletion until all the managed objects can be deleted.
func (*Controller) Reconcile ¶
func (c *Controller) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)
Reconcile responds to changes in the RootSync/RepoSync being watched.
func (*Controller) SetupWithManager ¶
func (c *Controller) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers the finalizer Controller with reconciler-manager.
type Finalizer ¶
type Finalizer interface { Finalize(ctx context.Context, syncObj client.Object) error AddFinalizer(ctx context.Context, syncObj client.Object) (bool, error) RemoveFinalizer(ctx context.Context, syncObj client.Object) (bool, error) }
Finalizer handles finalizing a RootSync or RepoSync for the reconciler.
type RepoSyncFinalizer ¶
type RepoSyncFinalizer struct { // Client used to update RSync spec and status. Client client.Client // StopControllers will be called by the Finalize() method to stop the Parser and Remediator. StopControllers context.CancelFunc // ControllersStopped will be closed by the caller when the parser and // remediator have fully stopped. This unblocks Finalize() to destroy // managed resource objects. ControllersStopped <-chan struct{} // contains filtered or unexported fields }
RepoSyncFinalizer handles finalizing RepoSync objects, using the Destroyer to destroy all managed user objects previously applied from source. Implements the Finalizer interface.
func (*RepoSyncFinalizer) AddFinalizer ¶
AddFinalizer adds the `configsync.gke.io/reconciler` finalizer to the specified object, and updates the server.
The specified syncObj must be of type `*v1beta1.RepoSync`.
func (*RepoSyncFinalizer) Finalize ¶
Finalize performs the following actions on the syncObj (RepoSync): - Stop other controllers - Wait for other controllers to stop - Sets the Finalizing condition - Uses the Destroyer to delete managed objects - Removes the Finalizing condition - Removes the Finalizer (unblocking deletion)
The specified syncObj must be of type `*v1beta1.RepoSync`.
func (*RepoSyncFinalizer) RemoveFinalizer ¶
func (f *RepoSyncFinalizer) RemoveFinalizer(ctx context.Context, syncObj client.Object) (bool, error)
RemoveFinalizer removes the `configsync.gke.io/reconciler` finalizer from the specified object, and updates the server.
The specified syncObj must be of type `*v1beta1.RepoSync`.
type RootSyncFinalizer ¶
type RootSyncFinalizer struct { // Client used to update RSync spec and status. Client client.Client // StopControllers will be called by the Finalize() method to stop the Parser and Remediator. StopControllers context.CancelFunc // ControllersStopped will be closed by the caller when the parser and // remediator have fully stopped. This unblocks Finalize() to destroy // managed resource objects. ControllersStopped <-chan struct{} // contains filtered or unexported fields }
RootSyncFinalizer handles finalizing RootSync objects, using the Destroyer to destroy all managed user objects previously applied from source. Implements the Finalizer interface.
func (*RootSyncFinalizer) AddFinalizer ¶
AddFinalizer adds the `configsync.gke.io/reconciler` finalizer to the specified object, and updates the server.
The specified syncObj must be of type `*v1beta1.RootSync`.
func (*RootSyncFinalizer) Finalize ¶
Finalize performs the following actions on the syncObj (RootSync): - Stop other controllers - Wait for other controllers to stop - Sets the Finalizing condition - Uses the Destroyer to delete managed objects - Removes the Finalizing condition - Removes the Finalizer (unblocking deletion)
The specified syncObj must be of type `*v1beta1.RootSync`.
func (*RootSyncFinalizer) RemoveFinalizer ¶
func (f *RootSyncFinalizer) RemoveFinalizer(ctx context.Context, syncObj client.Object) (bool, error)
RemoveFinalizer removes the `configsync.gke.io/reconciler` finalizer from the specified object, and updates the server.
The specified syncObj must be of type `*v1beta1.RootSync`.