csi_util

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 21 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
	MaxUltraHighPerformanceOption = 120

	InTransitEncryptionPackageName = "oci-fss-utils"
	FIPS_ENABLED_FILE_PATH         = "/host/proc/sys/crypto/fips_enabled"
	FINDMNT_COMMAND                = "findmnt"
	CAT_COMMAND                    = "cat"
	RPM_COMMAND                    = "rpm-host"
)

Variables

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

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 FindMount added in v1.24.0

func FindMount(target string) ([]string, error)

func FormatBytes

func FormatBytes(inputBytes int64) string

func GetBlockSizeBytes added in v1.24.0

func GetBlockSizeBytes(logger *zap.SugaredLogger, devicePath string) (int64, error)

func GetDevicePath

func GetDevicePath(sd *disk.Disk) string

func GetKubeClient

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

func IsFipsEnabled added in v1.24.0

func IsFipsEnabled() (string, error)

func IsInTransitEncryptionPackageInstalled added in v1.24.0

func IsInTransitEncryptionPackageInstalled() (bool, error)

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 FSSVolumeHandler added in v1.24.1

type FSSVolumeHandler struct {
	FilesystemOcid       string
	MountTargetIPAddress string
	FsExportPath         string
}

func ValidateFssId added in v1.24.1

func ValidateFssId(id string) *FSSVolumeHandler

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