Documentation ¶
Index ¶
- func MatchesNoScopeFunc(scope api.ResourceQuotaScope, object runtime.Object) bool
- type ConstraintsFunc
- type GenericEvaluator
- func (g *GenericEvaluator) Constraints(required []api.ResourceName, item runtime.Object) error
- func (g *GenericEvaluator) Get(namespace, name string) (runtime.Object, error)
- func (g *GenericEvaluator) GroupKind() unversioned.GroupKind
- func (g *GenericEvaluator) Matches(resourceQuota *api.ResourceQuota, item runtime.Object) bool
- func (g *GenericEvaluator) MatchesResource(resourceName api.ResourceName) bool
- func (g *GenericEvaluator) MatchesResources() []api.ResourceName
- func (g *GenericEvaluator) MatchesScope(scope api.ResourceQuotaScope, object runtime.Object) bool
- func (g *GenericEvaluator) OperationResources(operation admission.Operation) []api.ResourceName
- func (g *GenericEvaluator) Usage(object runtime.Object) api.ResourceList
- func (g *GenericEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageStats, error)
- type GenericRegistry
- type GetFuncByNamespace
- type ListFuncByNamespace
- type MatchesScopeFunc
- type UsageFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchesNoScopeFunc ¶
func MatchesNoScopeFunc(scope api.ResourceQuotaScope, object runtime.Object) bool
MatchesNoScopeFunc returns false on all match checks
Types ¶
type ConstraintsFunc ¶
type ConstraintsFunc func(required []api.ResourceName, item runtime.Object) error
ConstraintsFunc takes a list of required resources that must match on the input item
func ObjectCountConstraintsFunc ¶
func ObjectCountConstraintsFunc(resourceName api.ResourceName) ConstraintsFunc
ObjectCountConstraintsFunc returns ConstraintsFunc that returns nil if the specified resource name is in the required set of resource names
type GenericEvaluator ¶
type GenericEvaluator struct { // Name used for logging Name string // The GroupKind that this evaluator tracks InternalGroupKind unversioned.GroupKind // The set of resources that are pertinent to the mapped operation InternalOperationResources map[admission.Operation][]api.ResourceName // The set of resource names this evaluator matches MatchedResourceNames []api.ResourceName // A function that knows how to evaluate a matches scope request MatchesScopeFunc MatchesScopeFunc // A function that knows how to return usage for an object UsageFunc UsageFunc // A function that knows how to list resources by namespace ListFuncByNamespace ListFuncByNamespace // A function that knows how to get resource in a namespace // This function must be specified if the evaluator needs to handle UPDATE GetFuncByNamespace GetFuncByNamespace // A function that checks required constraints are satisfied ConstraintsFunc ConstraintsFunc }
GenericEvaluator provides an implementation for quota.Evaluator
func (*GenericEvaluator) Constraints ¶
func (g *GenericEvaluator) Constraints(required []api.ResourceName, item runtime.Object) error
Constraints checks required constraints are satisfied on the input object
func (*GenericEvaluator) Get ¶
func (g *GenericEvaluator) Get(namespace, name string) (runtime.Object, error)
Get returns the object by namespace and name
func (*GenericEvaluator) GroupKind ¶
func (g *GenericEvaluator) GroupKind() unversioned.GroupKind
GroupKind that this evaluator tracks
func (*GenericEvaluator) Matches ¶
func (g *GenericEvaluator) Matches(resourceQuota *api.ResourceQuota, item runtime.Object) bool
Matches returns true if the evaluator matches the specified quota with the provided input item
func (*GenericEvaluator) MatchesResource ¶
func (g *GenericEvaluator) MatchesResource(resourceName api.ResourceName) bool
MatchesResource returns true if this evaluator can match on the specified resource
func (*GenericEvaluator) MatchesResources ¶
func (g *GenericEvaluator) MatchesResources() []api.ResourceName
MatchesResources is the list of resources that this evaluator matches
func (*GenericEvaluator) MatchesScope ¶
func (g *GenericEvaluator) MatchesScope(scope api.ResourceQuotaScope, object runtime.Object) bool
MatchesScope returns true if the input object matches the specified scope
func (*GenericEvaluator) OperationResources ¶
func (g *GenericEvaluator) OperationResources(operation admission.Operation) []api.ResourceName
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.
func (*GenericEvaluator) Usage ¶
func (g *GenericEvaluator) Usage(object runtime.Object) api.ResourceList
Usage returns the resource usage for the specified object
func (*GenericEvaluator) UsageStats ¶
func (g *GenericEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageStats, error)
UsageStats calculates latest observed usage stats for all objects
type GenericRegistry ¶
type GenericRegistry struct { // internal evaluators by group kind InternalEvaluators map[unversioned.GroupKind]quota.Evaluator }
GenericRegistry implements Registry
func (*GenericRegistry) Evaluators ¶
func (r *GenericRegistry) Evaluators() map[unversioned.GroupKind]quota.Evaluator
Evaluators returns the map of evaluators by groupKind
type GetFuncByNamespace ¶
GetFuncByNamespace knows how to get a resource with specified namespace and name
type ListFuncByNamespace ¶
ListFuncByNamespace knows how to list resources in a namespace
func ListResourceUsingInformerFunc ¶ added in v1.5.1
func ListResourceUsingInformerFunc(f informers.SharedInformerFactory, groupResource unversioned.GroupResource) ListFuncByNamespace
ListResourceUsingInformerFunc returns a listing function based on the shared informer factory for the specified resource.
type MatchesScopeFunc ¶
type MatchesScopeFunc func(scope api.ResourceQuotaScope, object runtime.Object) bool
MatchesScopeFunc knows how to evaluate if an object matches a scope
type UsageFunc ¶
type UsageFunc func(object runtime.Object) api.ResourceList
UsageFunc knows how to measure usage associated with an object
func ObjectCountUsageFunc ¶
func ObjectCountUsageFunc(resourceName api.ResourceName) UsageFunc
ObjectCountUsageFunc is useful if you are only counting your object It always returns 1 as the usage for the named resource