util

package
v0.0.0-...-6111fc0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ZERO = int64(0)

Variables

This section is empty.

Functions

This section is empty.

Types

type DRFResource

type DRFResource struct {
	MilliCPU int64
	Memory   int64
}

func EmptyResource

func EmptyResource() *DRFResource

EmptyResource creates an empty resource object and returns

func GetPodResourceRequest

func GetPodResourceRequest(pod *v1.Pod) *DRFResource

func MaxResource

func MaxResource() DRFResource

func (*DRFResource) AddFromResourceList

func (r *DRFResource) AddFromResourceList(rl v1.ResourceList)

AddFromResourceList adds ResourceList into Resource.

func (*DRFResource) AddResource

func (r *DRFResource) AddResource(rr DRFResource) *DRFResource

AddResource is used to add the two resources

func (*DRFResource) GetResourceValue

func (r *DRFResource) GetResourceValue(rName v1.ResourceName) int64

resource type

func (*DRFResource) IsEmpty

func (r *DRFResource) IsEmpty() bool

IsEmpty returns bool after checking any of resource is less than min possible value

func (DRFResource) IsInit

func (r DRFResource) IsInit() bool

IsInit checks if the DRFResource has been initialized.

func (*DRFResource) IsZero

func (r *DRFResource) IsZero(rn v1.ResourceName) bool

IsZero checks whether that resource is less than min possible value

func (*DRFResource) Multi

func (r *DRFResource) Multi(ratio float64) *DRFResource

Multi multiples the resource with ratio provided

func (*DRFResource) ResourceNames

func (r *DRFResource) ResourceNames() []v1.ResourceName

ResourceNames returns all resource types

func (*DRFResource) SetMaxResource

func (r *DRFResource) SetMaxResource(rl v1.ResourceList)

SetMaxResource compares with ResourceList and takes max value for each Resource.

func (*DRFResource) SetResourceValue

func (r *DRFResource) SetResourceValue(rName v1.ResourceName, quantity int64)

SetResourceValue sets the resource value for that specific resource type.

func (*DRFResource) String

func (r *DRFResource) String() string

String returns resource details in string format

func (*DRFResource) SubResource

func (r *DRFResource) SubResource(rr DRFResource) *DRFResource

SubResource subtracts two Resource objects.

Jump to

Keyboard shortcuts

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