garbagecollector

package
v1.14.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceResyncTime time.Duration = 0

Variables

This section is empty.

Functions

func DefaultIgnoredResources added in v1.7.0

func DefaultIgnoredResources() map[schema.GroupResource]struct{}

DefaultIgnoredResources returns the default set of resources that the garbage collector controller should ignore. This is exposed so downstream integrators can have access to the defaults, and add to them as necessary when constructing the controller.

func GetDeletableResources added in v1.8.0

func GetDeletableResources(discoveryClient discovery.ServerResourcesInterface) map[schema.GroupVersionResource]struct{}

GetDeletableResources returns all resources from discoveryClient that the garbage collector should recognize and work with. More specifically, all preferred resources which support the 'delete', 'list', and 'watch' verbs.

All discovery errors are considered temporary. Upon encountering any error, GetDeletableResources will log and return any discovered resources it was able to process (which may be none).

func NewDebugHandler added in v1.12.0

func NewDebugHandler(controller *GarbageCollector) http.Handler

func NewGonumVertex added in v1.12.0

func NewGonumVertex(node *node, nodeID int64) *gonumVertex

func NewMissingGonumVertex added in v1.12.0

func NewMissingGonumVertex(ownerRef metav1.OwnerReference, nodeID int64) *gonumVertex

Types

type GarbageCollector

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

GarbageCollector runs reflectors to watch for changes of managed API objects, funnels the results to a single-threaded dependencyGraphBuilder, which builds a graph caching the dependencies among objects. Triggered by the graph changes, the dependencyGraphBuilder enqueues objects that can potentially be garbage-collected to the `attemptToDelete` queue, and enqueues objects whose dependents need to be orphaned to the `attemptToOrphan` queue. The GarbageCollector has workers who consume these two queues, send requests to the API server to delete/update the objects accordingly. Note that having the dependencyGraphBuilder notify the garbage collector ensures that the garbage collector operates with a graph that is at least as up to date as the notification is sent.

func NewGarbageCollector

func NewGarbageCollector(
	dynamicClient dynamic.Interface,
	mapper resettableRESTMapper,
	deletableResources map[schema.GroupVersionResource]struct{},
	ignoredResources map[schema.GroupResource]struct{},
	sharedInformers informers.SharedInformerFactory,
	informersStarted <-chan struct{},
) (*GarbageCollector, error)

func (*GarbageCollector) GraphHasUID

func (gc *GarbageCollector) GraphHasUID(UIDs []types.UID) bool

*FOR TEST USE ONLY* GraphHasUID returns if the GraphBuilder has a particular UID store in its uidToNode graph. It's useful for debugging. This method is used by integration tests.

func (*GarbageCollector) IsSynced added in v1.8.0

func (gc *GarbageCollector) IsSynced() bool

func (*GarbageCollector) Run

func (gc *GarbageCollector) Run(workers int, stopCh <-chan struct{})

func (*GarbageCollector) Sync added in v1.8.0

func (gc *GarbageCollector) Sync(discoveryClient discovery.ServerResourcesInterface, period time.Duration, stopCh <-chan struct{})

Sync periodically resyncs the garbage collector when new resources are observed from discovery. When new resources are detected, Sync will stop all GC workers, reset gc.restMapper, and resync the monitors.

Note that discoveryClient should NOT be shared with gc.restMapper, otherwise the mapper's underlying discovery client will be unnecessarily reset during the course of detecting new resources.

type GraphBuilder added in v1.6.0

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

GraphBuilder: based on the events supplied by the informers, GraphBuilder updates uidToNode, a graph that caches the dependencies as we know, and enqueues items to the attemptToDelete and attemptToOrphan.

func (*GraphBuilder) IsSynced added in v1.8.0

func (gb *GraphBuilder) IsSynced() bool

IsSynced returns true if any monitors exist AND all those monitors' controllers HasSynced functions return true. This means IsSynced could return true at one time, and then later return false if all monitors were reconstructed.

func (*GraphBuilder) Run added in v1.6.0

func (gb *GraphBuilder) Run(stopCh <-chan struct{})

Run sets the stop channel and starts monitor execution until stopCh is closed. Any running monitors will be stopped before Run returns.

type ObjectMetaForPatch added in v1.11.0

type ObjectMetaForPatch struct {
	ResourceVersion string                  `json:"resourceVersion"`
	OwnerReferences []metav1.OwnerReference `json:"ownerReferences"`
}

type UIDCache added in v1.4.0

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

UIDCache is an LRU cache for uid.

func NewUIDCache added in v1.4.0

func NewUIDCache(maxCacheEntries int) *UIDCache

NewUIDCache returns a UIDCache.

func (*UIDCache) Add added in v1.4.0

func (c *UIDCache) Add(uid types.UID)

Add adds a uid to the cache.

func (*UIDCache) Has added in v1.4.0

func (c *UIDCache) Has(uid types.UID) bool

Has returns if a uid is in the cache.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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