deletionhelper

package
v1.8.1-rancher1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

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

View Source
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

func (dh *DeletionHelper) EnsureFinalizers(obj runtime.Object) (
	runtime.Object, error)

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.

type ObjNameFunc

type ObjNameFunc func(runtime.Object) string

type UpdateObjFunc added in v1.7.0

type UpdateObjFunc func(runtime.Object) (runtime.Object, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL