Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSharedContextEvaluator ¶
func NewSharedContextEvaluator( name string, groupKind unversioned.GroupKind, operationResources map[admission.Operation][]kapi.ResourceName, matchedResourceNames []kapi.ResourceName, matchesScopeFunc generic.MatchesScopeFunc, getFuncByNamespace generic.GetFuncByNamespace, listFuncByNamespace generic.ListFuncByNamespace, constraintsFunc generic.ConstraintsFunc, usageComputerFactory UsageComputerFactory, ) quota.Evaluator
NewSharedContextEvaluator creates an evaluator object that allows to share context while computing usage of single namespace. Context is represented by an object returned by usageComputerFactory and is destroyed when the namespace is processed.
Types ¶
type SharedContextEvaluator ¶
type SharedContextEvaluator struct {}
SharedContextEvaluator provides an implementation for quota.Evaluator
func (*SharedContextEvaluator) Usage ¶
func (sce *SharedContextEvaluator) Usage(object runtime.Object) kapi.ResourceList
Usage evaluates usage of given object.
func (*SharedContextEvaluator) UsageStats ¶
func (sce *SharedContextEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageStats, error)
UsageStats calculates latest observed usage stats for all objects. UsageComputerFactory is used to create a UsageComputer object whose Usage is called on every object in a namespace.
type UsageComputer ¶
type UsageComputer interface {
Usage(object runtime.Object) kapi.ResourceList
}
UsageComputer knows how to measure usage associated with an object. Its implementation can store arbitrary data during `Usage()` run as a context while namespace is being evaluated.
type UsageComputerFactory ¶
type UsageComputerFactory func() UsageComputer
UsageComputerFactory returns a usage computer used during namespace evaluation.