resourcequota

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2017 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

resourcequota contains a controller that makes resource quota usage observations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetQuotableResources added in v1.9.0

func GetQuotableResources(discoveryFunc NamespacedResourcesFunc) (map[schema.GroupVersionResource]struct{}, error)

GetQuotableResources returns all resources that the quota system should recognize. It requires a resource supports the following verbs: 'create','list','delete'

Types

type InformerFactory added in v1.9.0

type InformerFactory interface {
	ForResource(resource schema.GroupVersionResource) (informers.GenericInformer, error)
	Start(stopCh <-chan struct{})
}

InformerFactory is all the quota system needs to interface with informers.

type NamespacedResourcesFunc added in v1.9.0

type NamespacedResourcesFunc func() ([]*metav1.APIResourceList, error)

NamespacedResourcesFunc knows how to discover namespaced resources.

type QuotaMonitor added in v1.9.0

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

func (*QuotaMonitor) IsSynced added in v1.9.0

func (qm *QuotaMonitor) 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 (*QuotaMonitor) Run added in v1.9.0

func (qm *QuotaMonitor) 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 ReplenishmentFunc

type ReplenishmentFunc func(groupResource schema.GroupResource, namespace string)

ReplenishmentFunc is a signal that a resource changed in specified namespace that may require quota to be recalculated.

type ResourceQuotaController

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

ResourceQuotaController is responsible for tracking quota usage status in the system

func NewResourceQuotaController

func NewResourceQuotaController(options *ResourceQuotaControllerOptions) (*ResourceQuotaController, error)

NewResourceQuotaController creates a quota controller with specified options

func (*ResourceQuotaController) Run

func (rq *ResourceQuotaController) Run(workers int, stopCh <-chan struct{})

Run begins quota controller using the specified number of workers

func (*ResourceQuotaController) Sync added in v1.9.0

func (rq *ResourceQuotaController) Sync(discoveryFunc NamespacedResourcesFunc, period time.Duration, stopCh <-chan struct{})

Sync periodically resyncs the controller when new resources are observed from discovery.

type ResourceQuotaControllerOptions

type ResourceQuotaControllerOptions struct {
	// Must have authority to list all quotas, and update quota status
	QuotaClient corev1client.ResourceQuotasGetter
	// Shared informer for resource quotas
	ResourceQuotaInformer coreinformers.ResourceQuotaInformer
	// Controls full recalculation of quota usage
	ResyncPeriod controller.ResyncPeriodFunc
	// Maintains evaluators that know how to calculate usage for group resource
	Registry quota.Registry
	// Discover list of supported resources on the server.
	DiscoveryFunc NamespacedResourcesFunc
	// A function that returns the list of resources to ignore
	IgnoredResourcesFunc func() map[schema.GroupResource]struct{}
	// InformersStarted knows if informers were started.
	InformersStarted <-chan struct{}
	// InformerFactory interfaces with informers.
	InformerFactory InformerFactory
	// Controls full resync of objects monitored for replenishment.
	ReplenishmentResyncPeriod controller.ResyncPeriodFunc
}

ResourceQuotaControllerOptions holds options for creating a quota controller

Jump to

Keyboard shortcuts

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