quota

package
v1.8.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2017 License: Apache-2.0 Imports: 7 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

func V1Equals added in v1.6.0

func V1Equals(a v1.ResourceList, b v1.ResourceList) bool

V1Equals returns true if the two lists are equivalent

Types

type Evaluator

type Evaluator interface {
	// Constraints ensures that each required resource is present on item
	Constraints(required []api.ResourceName, item runtime.Object) error
	// GroupKind returns the groupKind that this object knows how to evaluate
	GroupKind() schema.GroupKind
	// Handles determines if quota could be impacted by the specified operation.
	// If true, admission control must perform quota processing for the operation, otherwise it is safe to ignore quota.
	Handles(operation admission.Operation) bool
	// Matches returns true if the specified quota matches the input item
	Matches(resourceQuota *api.ResourceQuota, item runtime.Object) (bool, error)
	// MatchingResources takes the input specified list of resources and returns the set of resources evaluator matches.
	MatchingResources(input []api.ResourceName) []api.ResourceName
	// Usage returns the resource usage for the specified object
	Usage(item runtime.Object) (api.ResourceList, error)
	// 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[schema.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[schema.GroupKind]Evaluator

Evaluators returns a mapping of evaluators by group kind.

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
	// Resources are the set of resources to include in the measurement
	Resources []api.ResourceName
}

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