generic

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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

func MatchesNoScopeFunc(scope api.ResourceQuotaScope, object runtime.Object) (bool, error)

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.1

func ListResourceUsingInformerFunc(f informers.SharedInformerFactory, resource schema.GroupVersionResource) 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, error)

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

Usage returns the resource usage for the specified object

func (*ObjectCountEvaluator) UsageStats added in v1.6.0

UsageStats calculates aggregate usage for the object.

type UsageFunc

type UsageFunc func(object runtime.Object) (api.ResourceList, error)

UsageFunc knows how to measure usage associated with an object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL