utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

This file is a modified copy of k8s.io/kubernetes/pkg/quota/v1/resources.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

Add returns the result of a + b for each named resource

func AddIfExists

func AddIfExists(a v1.ResourceList, b v1.ResourceList) v1.ResourceList

Add returns the result of a + b for each named resource that exists in both a and b.

func Equals

func Equals(a v1.ResourceList, b v1.ResourceList) bool

Equals returns true if the two lists are equivalent

func FilterUnlimited

func FilterUnlimited(rawUsages v1.ResourceList, limits v1.ResourceList) v1.ResourceList

FilterUnlimited cleans up the raw usages by omitting not limited usages.

func LessThanOrEqual

func LessThanOrEqual(a v1.ResourceList, b v1.ResourceList) (bool, []v1.ResourceName)

LessThanOrEqual returns true if a < b for each key in b If false, it returns the keys in a that exceeded b

func Min

Min returns the result of Min(a, b) (i.e., smallest resource quantity) for each named resource. If a resource only exists in one but not all ResourceLists inputs, it will be returned.

func OmitLTEZero

func OmitLTEZero(a v1.ResourceList) v1.ResourceList

OmitLTEZero returns a list omitting zero or negative quantity resources.

func Subtract

Subtract returns the result of a - b for each named resource

Types

type Resources

type Resources map[v1.ResourceName]string

Resources maps a ResourceName to a string representation of a quantity.

Jump to

Keyboard shortcuts

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