helpers

package
v1.14.9 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

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 RoundUpToGB

func RoundUpToGB(size resource.Quantity) int64

RoundUpToGB rounds up given quantity to chunks of GB

func RoundUpToGBInt

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

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

func RoundUpToGiB

func RoundUpToGiB(size resource.Quantity) int64

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 RoundUpToKB

func RoundUpToKB(size resource.Quantity) int64

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

RoundUpToKiB rounds up given quantity upto 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

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

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