Documentation ¶
Overview ¶
Package to help federation controllers to delete federated resources from underlying clusters when the resource is deleted from federation control plane.
Index ¶
Constants ¶
const ( // Add this finalizer to a federation resource if the resource should be // deleted from all underlying clusters before being deleted from // federation control plane. // This is ignored if FinalizerOrphan is also present on the resource. // In that case, both finalizers are removed from the resource and the // resource is deleted from federation control plane without affecting // the underlying clusters. FinalizerDeleteFromUnderlyingClusters string = "federation.kubernetes.io/delete-from-underlying-clusters" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeletionHelper ¶
type DeletionHelper struct {
// contains filtered or unexported fields
}
func NewDeletionHelper ¶
func NewDeletionHelper( updateObjFunc UpdateObjFunc, objNameFunc ObjNameFunc, informer util.FederatedInformer, updater util.FederatedUpdater) *DeletionHelper
func (*DeletionHelper) EnsureFinalizers ¶
Ensures that the given object has both FinalizerDeleteFromUnderlyingClusters and FinalizerOrphan finalizers. We do this so that the controller is always notified when a federation resource is deleted. If user deletes the resource with nil DeleteOptions or DeletionOptions.OrphanDependents = true then the apiserver removes the orphan finalizer and deletion helper does a cascading deletion. Otherwise, deletion helper just removes the federation resource and orphans the corresponding resources in underlying clusters. This method should be called before creating objects in underlying clusters.
func (*DeletionHelper) HandleObjectInUnderlyingClusters ¶
func (dh *DeletionHelper) HandleObjectInUnderlyingClusters(obj runtime.Object) ( runtime.Object, error)
Deletes the resources corresponding to the given federated resource from all underlying clusters, unless it has the FinalizerOrphan finalizer. Removes FinalizerOrphan and FinalizerDeleteFromUnderlyingClusters finalizers when done. Callers are expected to keep calling this (with appropriate backoff) until it succeeds.