util

package
v1.20.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	GIB = 1024 * 1024 * 1024
)

Variables

This section is empty.

Functions

func Contains added in v1.18.0

func Contains(list []string, strToSearch string) bool

Contains searches if a string list contains the given string or not.

func RoundUpSize added in v1.19.0

func RoundUpSize(volumeSizeBytes int64, allocationUnitBytes int64) int64

RoundUpSize calculates how many allocation units are needed to accommodate a volume of given size. E.g. when user wants 1500MiB volume, while AWS EBS allocates volumes in gibibyte-sized chunks, RoundUpSize(1500 * 1024*1024, 1024*1024*1024) returns '2' (2 GiB is the smallest allocatable volume that can hold 1500MiB)

func RoundUpSizeInt added in v1.19.0

func RoundUpSizeInt(volumeSizeBytes int64, allocationUnitBytes int64) (int, error)

RoundUpSizeInt calculates how many allocation units are needed to accommodate a volume of given size. It returns an int instead of an int64 and an error if there's overflow

func RoundUpToGiBInt added in v1.19.0

func RoundUpToGiBInt(size resource.Quantity) (int, error)

RoundUpToGiBInt rounds up given quantity upto chunks of GiB. It returns an int instead of an int64 and an error if there's overflow

func StringListEqual

func StringListEqual(list1, list2 []string) bool

StringListEqual compares two string list, returns true if they have the same items, order doesn't matter

Types

This section is empty.

Directories

Path Synopsis
net

Jump to

Keyboard shortcuts

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