generic

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateUsageStats

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 ListerFuncForResourceFunc

func ListerFuncForResourceFunc(f InformerForResourceFunc) quota.ListerForResourceFunc

ListerFuncForResourceFunc knows how to provision a lister from an informer func

func Matches

func Matches(
	resourceQuota *corev1.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 corev1.ScopedResourceSelectorRequirement, object runtime.Object) (bool, error)

MatchesNoScopeFunc returns false on all match checks

func NewConfiguration

func NewConfiguration(evaluators []quota.Evaluator, ignoredResources map[schema.GroupResource]struct{}) quota.Configuration

NewConfiguration creates a quota configuration

func NewObjectCountEvaluator

func NewObjectCountEvaluator(
	groupResource schema.GroupResource, listFuncByNamespace ListFuncByNamespace,
	alias corev1.ResourceName) quota.Evaluator

NewObjectCountEvaluator returns an evaluator that can perform generic object quota counting. It allows an optional alias for backwards compatibility purposes for the legacy object counting names in quota. Unless its supporting backward compatibility, alias should not be used.

func NewRegistry

func NewRegistry(evaluators []quota.Evaluator) quota.Registry

NewRegistry creates a simple registry with initial list of evaluators

func ObjectCountQuotaResourceNameFor

func ObjectCountQuotaResourceNameFor(groupResource schema.GroupResource) corev1.ResourceName

ObjectCountQuotaResourceNameFor returns the object count quota name for specified groupResource

Types

type InformerForResourceFunc

type InformerForResourceFunc func(schema.GroupVersionResource) (informers.GenericInformer, error)

InformerForResourceFunc knows how to provision an informer

type ListFuncByNamespace

type ListFuncByNamespace func(namespace string) ([]runtime.Object, error)

ListFuncByNamespace knows how to list resources in a namespace

func ListResourceUsingListerFunc

func ListResourceUsingListerFunc(l quota.ListerForResourceFunc, resource schema.GroupVersionResource) ListFuncByNamespace

ListResourceUsingListerFunc returns a listing function based on the shared informer factory for the specified resource.

type MatchesScopeFunc

type MatchesScopeFunc func(scope corev1.ScopedResourceSelectorRequirement, object runtime.Object) (bool, error)

MatchesScopeFunc knows how to evaluate if an object matches a scope

type MatchingResourceNamesFunc

type MatchingResourceNamesFunc func(input []corev1.ResourceName) []corev1.ResourceName

MatchingResourceNamesFunc is a function that returns the list of resources matched

type UsageFunc

type UsageFunc func(object runtime.Object) (corev1.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