helpers

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 238

Documentation

Index

Constants

View Source
const (
	// GB - GigaByte size
	GB = 1000 * 1000 * 1000
	// GiB - GibiByte size
	GiB = 1024 * 1024 * 1024

	// MB - MegaByte size
	MB = 1000 * 1000
	// MiB - MebiByte size
	MiB = 1024 * 1024

	// KB - KiloByte size
	KB = 1000
	// KiB - KibiByte size
	KiB = 1024
)

Variables

This section is empty.

Functions

func ChooseZonesForVolume

func ChooseZonesForVolume(zones sets.String, pvcName string, numZones uint32) sets.String

ChooseZonesForVolume is identical to ChooseZoneForVolume, but selects a multiple zones, for multi-zone disks.

func LabelZonesToList

func LabelZonesToList(labelZonesValue string) ([]string, error)

LabelZonesToList converts a PV label value from string containing a delimited list of zones to list

func LabelZonesToSet

func LabelZonesToSet(labelZonesValue string) (sets.String, error)

LabelZonesToSet converts a PV label value from string containing a delimited list of zones to set

func RoundUpToB added in v0.22.0

func RoundUpToB(size resource.Quantity) (int64, error)

RoundUpToB rounds up given quantity to chunks of bytes

func RoundUpToGiB

func RoundUpToGiB(size resource.Quantity) (int64, error)

RoundUpToGiB rounds up given quantity upto chunks of GiB

func RoundUpToGiBInt

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 RoundUpToGiBInt32 added in v0.19.0

func RoundUpToGiBInt32(size resource.Quantity) (int32, error)

RoundUpToGiBInt32 rounds up given quantity up to chunks of GiB. It returns an int32 instead of an int64 and an error if there's overflow

func RoundUpToKB

func RoundUpToKB(size resource.Quantity) (int64, error)

RoundUpToKB rounds up given quantity to chunks of KB

func RoundUpToKBInt

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

RoundUpToKBInt rounds up given quantity to chunks of KB. It returns an int instead of an int64 and an error if there's overflow

func RoundUpToKiB

func RoundUpToKiB(size resource.Quantity) (int64, error)

RoundUpToKiB rounds up given quantity to chunks of KiB

func RoundUpToKiBInt

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

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

func RoundUpToMB

func RoundUpToMB(size resource.Quantity) (int64, error)

RoundUpToMB rounds up given quantity to chunks of MB

func RoundUpToMBInt

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

RoundUpToMBInt rounds up given quantity to chunks of MB. It returns an int instead of an int64 and an error if there's overflow

func RoundUpToMiB

func RoundUpToMiB(size resource.Quantity) (int64, error)

RoundUpToMiB rounds up given quantity upto chunks of MiB

func RoundUpToMiBInt

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

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

func SelectZoneForVolume

func SelectZoneForVolume(zoneParameterPresent, zonesParameterPresent bool, zoneParameter string, zonesParameter, zonesWithNodes sets.String, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm, pvcName string) (string, error)

SelectZoneForVolume is a wrapper around SelectZonesForVolume to select a single zone for a volume based on parameters

func SelectZonesForVolume

func SelectZonesForVolume(zoneParameterPresent, zonesParameterPresent bool, zoneParameter string, zonesParameter, zonesWithNodes sets.String, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm, pvcName string, numReplicas uint32) (sets.String, error)

SelectZonesForVolume selects zones for a volume based on several factors: node.zone, allowedTopologies, zone/zones parameters from storageclass, zones with active nodes from the cluster. The number of zones = replicas.

func ZonesFromAllowedTopologies

func ZonesFromAllowedTopologies(allowedTopologies []v1.TopologySelectorTerm) (sets.String, error)

ZonesFromAllowedTopologies returns a list of zones specified in allowedTopologies

func ZonesSetToLabelValue

func ZonesSetToLabelValue(strSet sets.String) string

ZonesSetToLabelValue converts zones set to label value

func ZonesToSet

func ZonesToSet(zonesString string) (sets.String, error)

ZonesToSet converts a string containing a comma separated list of zones to set

Types

This section is empty.

Jump to

Keyboard shortcuts

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