csi_util

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// minimumVolumeSizeInBytes is used to validate that the user is not trying
	// to create a volume that is smaller than what we support
	MinimumVolumeSizeInBytes int64 = 50 * client.GiB

	// maximumVolumeSizeInBytes is used to validate that the user is not trying
	// to create a volume that is larger than what we support
	MaximumVolumeSizeInBytes int64 = 32 * client.TiB

	// Block Volume Performance Units
	VpusPerGB                 = "vpusPerGB"
	LowCostPerformanceOption  = 0
	BalancedPerformanceOption = 10
	HigherPerformanceOption   = 20
)

Variables

View Source
var (
	DiskByPathPatternPV    = `/dev/disk/by-path/pci-\d+:\d+:\d+\.\d+-scsi-\d+:\d+:\d+:\d+$`
	DiskByPathPatternISCSI = `/dev/disk/by-path/ip-[\w\.]+:\d+-iscsi-[\w\.\-:]+-lun-1$`
)

Functions

func ExtractBlockVolumePerformanceLevel added in v1.19.12

func ExtractBlockVolumePerformanceLevel(attribute string) (int64, error)

Extracts the vpusPerGB as int64 from given string input

func ExtractISCSIInformation

func ExtractISCSIInformation(attributes map[string]string) (*disk.Disk, error)

func ExtractISCSIInformationFromMountPath

func ExtractISCSIInformationFromMountPath(logger *zap.SugaredLogger, diskPath []string) (*disk.Disk, error)

func ExtractStorage

func ExtractStorage(capRange *csi.CapacityRange) (int64, error)

extractStorage extracts the storage size in bytes from the given capacity range. If the capacity range is not satisfied it returns the default volume size. If the capacity range is below or above supported sizes, it returns an error.

func FormatBytes

func FormatBytes(inputBytes int64) string

func GetDevicePath

func GetDevicePath(sd *disk.Disk) string

func GetKubeClient

func GetKubeClient(logger *zap.SugaredLogger, master, kubeconfig string) *kubernetes.Clientset

func MaxOfInt

func MaxOfInt(a, b int64) int64

func RoundUpMinSize

func RoundUpMinSize() int64

func RoundUpSize

func RoundUpSize(volumeSizeBytes int64, allocationUnitBytes int64) int64

func ValidateFsType

func ValidateFsType(logger *zap.SugaredLogger, fsType string) string

Types

type Util

type Util struct {
	Logger *zap.SugaredLogger
}

Util interface

func (*Util) GetAvailableDomainInNodeLabel

func (u *Util) GetAvailableDomainInNodeLabel(fullAD string) string

convert "zkJl:US-ASHBURN-AD-1" to "US-ASHBURN-AD-1"

func (*Util) LookupNodeAvailableDomain

func (u *Util) LookupNodeAvailableDomain(k kubernetes.Interface, nodeID string) (string, error)

func (*Util) LookupNodeID

func (u *Util) LookupNodeID(k kubernetes.Interface, nodeName string) (string, error)

func (*Util) WaitForPathToExist

func (u *Util) WaitForPathToExist(path string, maxRetries int) bool

waitForPathToExist waits for for a given filesystem path to exist.

type VolumeLocks

type VolumeLocks struct {
	// contains filtered or unexported fields
}

func NewVolumeLocks

func NewVolumeLocks() *VolumeLocks

func (*VolumeLocks) Release

func (vl *VolumeLocks) Release(volumeID string)

func (*VolumeLocks) TryAcquire

func (vl *VolumeLocks) TryAcquire(volumeID string) bool

Jump to

Keyboard shortcuts

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