package deletionhelper

import "k8s.io/kubernetes/federation/pkg/federation-controller/util/deletionhelper"

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"
)

Types

type AddFinalizerFunc

type AddFinalizerFunc func(runtime.Object, string) (runtime.Object, error)

type DeletionHelper

type DeletionHelper struct {
	// contains filtered or unexported fields
}

func NewDeletionHelper

func NewDeletionHelper(
	hasFinalizerFunc HasFinalizerFunc, removeFinalizerFunc RemoveFinalizerFunc,
	addFinalizerFunc AddFinalizerFunc, objNameFunc ObjNameFunc,
	updateTimeout time.Duration, eventRecorder record.EventRecorder,
	informer util.FederatedInformer,
	updater util.FederatedUpdater) *DeletionHelper

func (*DeletionHelper) EnsureDeleteFromUnderlyingClustersFinalizer

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

Ensures that the given object has the required finalizer to ensure that objects are deleted in underlying clusters when this object is deleted from federation control plane. 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 HasFinalizerFunc

type HasFinalizerFunc func(runtime.Object, string) bool

type ObjNameFunc

type ObjNameFunc func(runtime.Object) string

type RemoveFinalizerFunc

type RemoveFinalizerFunc func(runtime.Object, string) (runtime.Object, error)

Source Files

deletion_helper.go

Version
v1.5.0-beta.0
Published
Nov 6, 2016
Platform
darwin/amd64
Imports
9 packages
Last checked
15 minutes ago

Tools for package owners.