Documentation ¶
Index ¶
- func Add(a api.ResourceList, b api.ResourceList) api.ResourceList
- func CalculateUsage(namespaceName string, scopes []api.ResourceQuotaScope, ...) (api.ResourceList, error)
- func Contains(items []api.ResourceName, item api.ResourceName) bool
- func Equals(a api.ResourceList, b api.ResourceList) bool
- func Intersection(a []api.ResourceName, b []api.ResourceName) []api.ResourceName
- func IsNegative(a api.ResourceList) []api.ResourceName
- func IsZero(a api.ResourceList) bool
- func LessThanOrEqual(a api.ResourceList, b api.ResourceList) (bool, []api.ResourceName)
- func Mask(resources api.ResourceList, names []api.ResourceName) api.ResourceList
- func Max(a api.ResourceList, b api.ResourceList) api.ResourceList
- func ResourceNames(resources api.ResourceList) []api.ResourceName
- func Subtract(a api.ResourceList, b api.ResourceList) api.ResourceList
- func ToSet(resourceNames []api.ResourceName) sets.String
- type Evaluator
- type Registry
- type UnionRegistry
- type UsageStats
- type UsageStatsOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
func Add(a api.ResourceList, b api.ResourceList) api.ResourceList
Add returns the result of a + b for each named resource
func CalculateUsage ¶ added in v1.4.2
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.2
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.2
func Max(a api.ResourceList, b api.ResourceList) api.ResourceList
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 ¶
func Subtract(a api.ResourceList, b api.ResourceList) api.ResourceList
Subtract returns the result of a - b for each named resource
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.2
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.2
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