Documentation ¶
Index ¶
- func CalculateUsageStats(options quota.UsageStatsOptions, listFunc ListFuncByNamespace, ...) (quota.UsageStats, error)
- func Matches(resourceQuota *api.ResourceQuota, item runtime.Object, ...) (bool, error)
- func MatchesNoScopeFunc(scope api.ResourceQuotaScope, object runtime.Object) (bool, error)
- type GenericRegistry
- type ListFuncByNamespace
- type MatchesScopeFunc
- type MatchingResourceNamesFunc
- type ObjectCountEvaluator
- func (o *ObjectCountEvaluator) Constraints(required []api.ResourceName, item runtime.Object) error
- func (o *ObjectCountEvaluator) GroupKind() schema.GroupKind
- func (o *ObjectCountEvaluator) Handles(operation admission.Operation) bool
- func (o *ObjectCountEvaluator) Matches(resourceQuota *api.ResourceQuota, item runtime.Object) (bool, error)
- func (o *ObjectCountEvaluator) MatchingResources(input []api.ResourceName) []api.ResourceName
- func (o *ObjectCountEvaluator) Usage(object runtime.Object) (api.ResourceList, error)
- func (o *ObjectCountEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageStats, error)
- type UsageFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateUsageStats ¶ added in v1.6.0
func CalculateUsageStats(options quota.UsageStatsOptions, listFunc ListFuncByNamespace, scopeFunc MatchesScopeFunc, usageFunc UsageFunc) (quota.UsageStats, error)
CalculateUsageStats is a utility function that knows how to calculate aggregate usage.
func Matches ¶ added in v1.6.0
func Matches(resourceQuota *api.ResourceQuota, item runtime.Object, matchFunc MatchingResourceNamesFunc, scopeFunc MatchesScopeFunc) (bool, error)
Matches returns true if the quota matches the specified item.
func MatchesNoScopeFunc ¶
MatchesNoScopeFunc returns false on all match checks
Types ¶
type GenericRegistry ¶
type GenericRegistry struct { // internal evaluators by group kind InternalEvaluators map[schema.GroupKind]quota.Evaluator }
GenericRegistry implements Registry
func (*GenericRegistry) Evaluators ¶
func (r *GenericRegistry) Evaluators() map[schema.GroupKind]quota.Evaluator
Evaluators returns the map of evaluators by groupKind
type ListFuncByNamespace ¶
type ListFuncByNamespace func(namespace string, options metav1.ListOptions) ([]runtime.Object, error)
ListFuncByNamespace knows how to list resources in a namespace
func ListResourceUsingInformerFunc ¶ added in v1.5.0
func ListResourceUsingInformerFunc(f informers.SharedInformerFactory, groupResource schema.GroupResource) ListFuncByNamespace
ListResourceUsingInformerFunc returns a listing function based on the shared informer factory for the specified resource.
type MatchesScopeFunc ¶
MatchesScopeFunc knows how to evaluate if an object matches a scope
type MatchingResourceNamesFunc ¶ added in v1.6.0
type MatchingResourceNamesFunc func(input []api.ResourceName) []api.ResourceName
MatchingResourceNamesFunc is a function that returns the list of resources matched
type ObjectCountEvaluator ¶ added in v1.6.0
type ObjectCountEvaluator struct { // AllowCreateOnUpdate if true will ensure the evaluator tracks create // and update operations. AllowCreateOnUpdate bool // GroupKind that this evaluator tracks. InternalGroupKind schema.GroupKind // A function that knows how to list resources by namespace. // TODO move to dynamic client in future ListFuncByNamespace ListFuncByNamespace // Name associated with this resource in the quota. ResourceName api.ResourceName }
ObjectCountEvaluator provides an implementation for quota.Evaluator that associates usage of the specified resource based on the number of items returned by the specified listing function.
func (*ObjectCountEvaluator) Constraints ¶ added in v1.6.0
func (o *ObjectCountEvaluator) Constraints(required []api.ResourceName, item runtime.Object) error
Constraints returns an error if the configured resource name is not in the required set.
func (*ObjectCountEvaluator) GroupKind ¶ added in v1.6.0
func (o *ObjectCountEvaluator) GroupKind() schema.GroupKind
GroupKind that this evaluator tracks
func (*ObjectCountEvaluator) Handles ¶ added in v1.6.0
func (o *ObjectCountEvaluator) Handles(operation admission.Operation) bool
Handles returns true if the object count evaluator needs to track this operation.
func (*ObjectCountEvaluator) Matches ¶ added in v1.6.0
func (o *ObjectCountEvaluator) Matches(resourceQuota *api.ResourceQuota, item runtime.Object) (bool, error)
Matches returns true if the evaluator matches the specified quota with the provided input item
func (*ObjectCountEvaluator) MatchingResources ¶ added in v1.6.0
func (o *ObjectCountEvaluator) MatchingResources(input []api.ResourceName) []api.ResourceName
MatchingResources takes the input specified list of resources and returns the set of resources it matches.
func (*ObjectCountEvaluator) Usage ¶ added in v1.6.0
func (o *ObjectCountEvaluator) Usage(object runtime.Object) (api.ResourceList, error)
Usage returns the resource usage for the specified object
func (*ObjectCountEvaluator) UsageStats ¶ added in v1.6.0
func (o *ObjectCountEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageStats, error)
UsageStats calculates aggregate usage for the object.