csi_util

package
v1.29.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHROOT_BASH_COMMAND                   = "chroot-bash"
	LOAD_LNET_KERNEL_MODULE_COMMAND       = "modprobe lnet"
	CONFIGURE_LNET_KERNEL_SERVICE_COMMAND = "lnetctl lnet configure"
	SHOW_CONFIGURED_LNET                  = "lnetctl net show --net %s"
	DELETE_LNET_INTERFACE                 = "lnetctl net del --net %s"
	CONFIGURE_LNET_INTERFACE              = "lnetctl net add --net %s --if %s --peer-timeout 180 --peer-credits 120 --credits 1024"
	RPM_PACKAGE_QUERY                     = "rpm -q %s"
	DPKG_PACKAGE_QEURY                    = "dpkg -s %s"
)
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"
	CAT_COMMAND                    = "cat"
	RPM_COMMAND                    = "rpm-host"
	LabelIpFamilyPreferred         = "oci.oraclecloud.com/ip-family-preferred"
	LabelIpFamilyIpv4              = "oci.oraclecloud.com/ip-family-ipv4"
	LabelIpFamilyIpv6              = "oci.oraclecloud.com/ip-family-ipv6"
	IscsiIpv6Prefix                = "fd00:00c1::"

	Ipv6Stack = "IPv6"
	Ipv4Stack = "IPv4"

	// For Raw Block Volumes, the name of the bind-mounted file inside StagingTargetPath
	RawBlockStagingFile = "mountfile"
)

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 ConvertIscsiIpFromIpv4ToIpv6 added in v1.28.2

func ConvertIscsiIpFromIpv4ToIpv6(ipv4IscsiIp string) (string, error)

func CreateFilePath added in v1.28.2

func CreateFilePath(logger *zap.SugaredLogger, path string) error

Creates a file on the specified path after creating the containing directory

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 FormatValidIp added in v1.28.2

func FormatValidIp(ipAddress string) string

func FormatValidIpStackInK8SConvention added in v1.28.2

func FormatValidIpStackInK8SConvention(ipStack string) string

func GetBlockSizeBytes added in v1.24.0

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

func GetIsFeatureEnabledFromEnv added in v1.26.4

func GetIsFeatureEnabledFromEnv(logger *zap.SugaredLogger, featureName string, defaultValue bool) bool

func GetKubeClient

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

func GetPathForBlock added in v1.28.2

func GetPathForBlock(volumePath string) string

Get the staging target filepath inside the given stagingTargetPath, to be used for raw block volume support

func IsDualStackSubnet added in v1.28.2

func IsDualStackSubnet(subnet *core.Subnet) bool

func IsFipsEnabled added in v1.24.0

func IsFipsEnabled() (string, error)

func IsInTransitEncryptionPackageInstalled added in v1.24.0

func IsInTransitEncryptionPackageInstalled() (bool, error)

func IsIpv4 added in v1.28.2

func IsIpv4(ipAddress string) bool

func IsIpv4SingleStackSubnet added in v1.28.2

func IsIpv4SingleStackSubnet(subnet *core.Subnet) bool

func IsIpv6 added in v1.28.2

func IsIpv6(ipAddress string) bool

func IsIpv6SingleStackSubnet added in v1.28.2

func IsIpv6SingleStackSubnet(subnet *core.Subnet) bool

func IsLnetActive added in v1.28.2

func IsLnetActive(logger *zap.SugaredLogger, lnetLabel string) bool

IsLnetActive takes lnetLabel (ex. tcp0, tcp1) as input and tries to check if at leaset one lnet interface is active to consider lnet as active. It returns true when active lnet interface is identified else returns false singling down lnet.

func IsValidIpFamilyPresentInClusterIpFamily added in v1.28.2

func IsValidIpFamilyPresentInClusterIpFamily(clusterIpFamily string) bool

func MaxOfInt

func MaxOfInt(a, b int64) int64

func RoundUpMinSize

func RoundUpMinSize() int64

func RoundUpSize

func RoundUpSize(volumeSizeBytes int64, allocationUnitBytes int64) int64

func SetupLnet added in v1.28.2

func SetupLnet(logger *zap.SugaredLogger, lustreSubnetCIDR string, lnetLabel string) error

func ValidateDNSName added in v1.28.2

func ValidateDNSName(name string) bool

func ValidateFsType

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

func ValidateLustreVolumeId added in v1.28.2

func ValidateLustreVolumeId(lusterVolumeId string) (bool, string)

ValidateLustreVolumeId takes lustreVolumeId as input and returns if its valid or not along with lnetLabel Ex. volume handle : 10.112.10.6@tcp1:/fsname

volume handle : <MGS NID>[:<MGS NID>]:/<fsname>

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 NetInfo added in v1.28.2

type NetInfo struct {
	Net []struct {
		NetType string `yaml:"net type"`
		LocalNI []struct {
			NID        string         `yaml:"nid"`
			Status     string         `yaml:"status"`
			Interfaces map[int]string `yaml:"interfaces"`
		} `yaml:"local NI(s)"`
	} `yaml:"net"`
}

type NetInterface added in v1.28.2

type NetInterface struct {
	InterfaceIPv4  string
	InterfaceName  string
	LnetConfigured bool
}

type NodeIpFamily added in v1.28.2

type NodeIpFamily struct {
	PreferredNodeIpFamily string
	Ipv4Enabled           bool
	Ipv6Enabled           bool
}

func GetNodeIpFamily added in v1.28.2

func GetNodeIpFamily(k kubernetes.Interface, nodeID string, logger *zap.SugaredLogger) (*NodeIpFamily, error)

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