resourcequota

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNoResourceQuotaTemplate            = "found %d resources quota in ns: %s, expecting more than 0"
	ErrNoProperResourceQuotaFoundTemplate = "cannot find proper resource quota in namespace %s"
	ErrResourceQuotaStatusHardNilTemplate = "cannot find hard limit in the status of resource quota %s"
	ErrResourceQuotaTypeNotFoundTemplate  = "resource type %s not found in resource quota %s"
	ErrResourceQuotaInsufficientTemplate  = "insufficient resource left for %s in resource quota %s reserved %v/%v, request %v"
	ErrQueueUnitAlreadyReservedTemplate   = "queue unit %s already reserved"
)
View Source
const Name = "ResourceQuota"

Name is the name of the plugin used in the plugin registry and configurations.

Variables

This section is empty.

Functions

func New

New initializes a new plugin and returns it.

func QueueUnitToKey

func QueueUnitToKey(qu *framework.QueueUnitInfo) string

func SelectResourceQuota

func SelectResourceQuota(rqs []*corev1.ResourceQuota, ns string) (*corev1.ResourceQuota, error)

SelectResourceQuota returns the proper resource quota for the given namespace

Types

type ResourceQuota

type ResourceQuota struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ResourceQuota is a plugin that implements ResourceQuota filter.

func (*ResourceQuota) Filter

Filter returns Status with success if there are enough resource left for the given QueueUnitInfo

func (*ResourceQuota) GetReservedByResourceName

func (rq *ResourceQuota) GetReservedByResourceName(ns string, rName corev1.ResourceName) resource.Quantity

GetReservedByResourceName returns reserved resource quantity if the ResourceName is found, otherwise returns zero Quantity

func (*ResourceQuota) Name

func (rq *ResourceQuota) Name() string

Name returns name of the plugin.

func (*ResourceQuota) Reserve

Reserve resource for the given QueueUnitInfo

func (*ResourceQuota) Unreserve

func (rq *ResourceQuota) Unreserve(ctx context.Context, qu *framework.QueueUnitInfo)

Unreserve resource for the given QueueUnitInfo

Jump to

Keyboard shortcuts

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