quota

package
v1.5.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

Add returns the result of a + b for each named resource

func CalculateUsage added in v1.4.0

func CalculateUsage(namespaceName string, scopes []api.ResourceQuotaScope, hardLimits api.ResourceList, registry Registry) (api.ResourceList, error)

CalculateUsage calculates and returns the requested ResourceList usage

func Contains

func Contains(items []api.ResourceName, item api.ResourceName) bool

Contains returns true if the specified item is in the list of items

func Equals

func Equals(a api.ResourceList, b api.ResourceList) bool

Equals returns true if the two lists are equivalent

func Intersection

func Intersection(a []api.ResourceName, b []api.ResourceName) []api.ResourceName

Intersection returns the intersection of both list of resources

func IsNegative added in v1.4.0

func IsNegative(a api.ResourceList) []api.ResourceName

IsNegative returns the set of resource names that have a negative value.

func IsZero

func IsZero(a api.ResourceList) bool

IsZero returns true if each key maps to the quantity value 0

func LessThanOrEqual

func LessThanOrEqual(a api.ResourceList, b api.ResourceList) (bool, []api.ResourceName)

LessThanOrEqual returns true if a < b for each key in b If false, it returns the keys in a that exceeded b

func Mask

func Mask(resources api.ResourceList, names []api.ResourceName) api.ResourceList

Mask returns a new resource list that only has the values with the specified names

func Max added in v1.4.0

Max returns the result of Max(a, b) for each named resource

func ResourceNames

func ResourceNames(resources api.ResourceList) []api.ResourceName

ResourceNames returns a list of all resource names in the ResourceList

func Subtract

Subtract returns the result of a - b for each named resource

func ToSet

func ToSet(resourceNames []api.ResourceName) sets.String

ToSet takes a list of resource names and converts to a string set

Types

type Evaluator

type Evaluator interface {
	// Constraints ensures that each required resource is present on item
	Constraints(required []api.ResourceName, item runtime.Object) error
	// Get returns the object with specified namespace and name
	Get(namespace, name string) (runtime.Object, error)
	// GroupKind returns the groupKind that this object knows how to evaluate
	GroupKind() unversioned.GroupKind
	// MatchesResources is the list of resources that this evaluator matches
	MatchesResources() []api.ResourceName
	// Matches returns true if the specified quota matches the input item
	Matches(resourceQuota *api.ResourceQuota, item runtime.Object) bool
	// OperationResources returns the set of resources that could be updated for the
	// specified operation for this kind.  If empty, admission control will ignore
	// quota processing for the operation.
	OperationResources(operation admission.Operation) []api.ResourceName
	// Usage returns the resource usage for the specified object
	Usage(object runtime.Object) api.ResourceList
	// UsageStats calculates latest observed usage stats for all objects
	UsageStats(options UsageStatsOptions) (UsageStats, error)
}

Evaluator knows how to evaluate quota usage for a particular group kind

type Registry

type Registry interface {
	// Evaluators returns the set Evaluator objects registered to a groupKind
	Evaluators() map[unversioned.GroupKind]Evaluator
}

Registry holds the list of evaluators associated to a particular group kind

type UnionRegistry added in v1.4.0

type UnionRegistry []Registry

UnionRegistry combines multiple registries. Order matters because first registry to claim a GroupKind is the "winner"

func (UnionRegistry) Evaluators added in v1.4.0

func (r UnionRegistry) Evaluators() map[unversioned.GroupKind]Evaluator

type UsageStats

type UsageStats struct {
	// Used maps resource to quantity used
	Used api.ResourceList
}

UsageStats is result of measuring observed resource use in the system

type UsageStatsOptions

type UsageStatsOptions struct {
	// Namespace where stats should be calculate
	Namespace string
	// Scopes that must match counted objects
	Scopes []api.ResourceQuotaScope
}

UsageStatsOptions is an options structs that describes how stats should be calculated

Directories

Path Synopsis
evaluator
core
core contains modules that interface with the core api group
core contains modules that interface with the core api group

Jump to

Keyboard shortcuts

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