cloud-providerk8s.io/cloud-provider/volume/helpers Index | Files

package helpers

import "k8s.io/cloud-provider/volume/helpers"

Index

Constants

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
)

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

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

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

Source Files

rounding.go zones.go

Version
v0.32.2 (latest)
Published
Feb 13, 2025
Platform
linux/amd64
Imports
12 packages
Last checked
2 months ago

Tools for package owners.