Documentation ¶
Overview ¶
Package v1 provides helpers to implement an external object sync controller. It's based on the sync controller and adds a garbage collector sync function for the purpose of syncing objects between a kubernetes cluster and an external system. The garbage collector deletes orphan objects in the external system.
Index ¶
Constants ¶
const ( // DefaultGarbageCollectionPeriod is the default period at which garbage // collection is executed. DefaultGarbageCollectionPeriod time.Duration = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { syncv1.Controller // List lists all the objects in the external system. It returns a list of // NamespacedName of the external objects. This is used for garbage // collection and can be expensive. The garbage collector is run in a // separate goroutine periodically, not affecting the main reconciliation // control-loop. If the external system has no concept of namespace, the // namespace value can be empty. List(context.Context) ([]types.NamespacedName, error) }
Controller is an external object sync controller interface that must be implemented by an external sync controller. It provides methods required for reconciling and syncing a k8s object to external objects.
type Reconciler ¶
type Reconciler struct { syncv1.Reconciler Ctrlr Controller // contains filtered or unexported fields }
Reconciler defines an external object sync reconciler based on the Sync reconciler with a sync function for garbage collection of the external objects.
func (*Reconciler) Init ¶
func (s *Reconciler) Init(mgr ctrl.Manager, ctrlr Controller, prototype client.Object, prototypeList client.ObjectList, opts ...syncv1.ReconcilerOption) error
Init initializes the reconciler.
func (*Reconciler) SetGarbageCollectionPeriod ¶
func (s *Reconciler) SetGarbageCollectionPeriod(period time.Duration)
SetGarbageCollectionPeriod sets the garbage collection period.
func (*Reconciler) SetStartupGarbageCollectionDelay ¶
func (s *Reconciler) SetStartupGarbageCollectionDelay(period time.Duration)
SetStartupGarbageCollectionDelay sets a delay for the initial garbage collection at startup. NOTE: Setting this too low can result in failure due to uninitialized controller components.