utils

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 18 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotLVMByteNum = errors.New("LVM byte format unrecognised")
)

Functions

func AddPubKeyIntoAuthorizedKeys added in v0.4.0

func AddPubKeyIntoAuthorizedKeys(pubkey string) error

func AddUniqueStringItem

func AddUniqueStringItem(items []string, itemToAdd string) []string

AddUniqueStringItem add a string from a slice without duplicate

func Bash added in v0.4.0

func Bash(cmd string) (string, error)

func BuildInClusterClientset

func BuildInClusterClientset() (*kubernetes.Clientset, error)

BuildInClusterClientset builds a kubernetes in-cluster clientset

func BuildStoragePoolName

func BuildStoragePoolName(poolClass string) (string, error)

BuildStoragePoolName constructs storage pool name

func ConvertBytesToStr

func ConvertBytesToStr(size int64) string

ConvertBytesToStr convert size into string

func ConvertLVMBytesToNumeric

func ConvertLVMBytesToNumeric(lvmbyte string) (int64, error)

func ConvertNumericToLVMBytes

func ConvertNumericToLVMBytes(num int64) string

func GetNamespace

func GetNamespace() string

GetNamespace get Namespace from env, else it returns error

func GetNodeName

func GetNodeName() string

GetNodeName gets the node name from env, else returns an error

func GetPodName added in v0.7.2

func GetPodName() string

func GetSnapshotRestoreNameByVolume added in v0.12.3

func GetSnapshotRestoreNameByVolume(volumeName string) string

func LogGRPC

func LogGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

LogGRPC log grpc all info

func NumericToLVMBytes

func NumericToLVMBytes(bytes int64) int64

func ParseBytes

func ParseBytes(sizeStr string) (int64, error)

ParseBytes parse size from string into bytes

func RemovePubKeyFromAuthorizedKeys added in v0.4.1

func RemovePubKeyFromAuthorizedKeys() error

func RemoveStringItem

func RemoveStringItem(items []string, itemToDelete string) []string

RemoveStringItem removes a string from a slice

func RunWithLease

func RunWithLease(ns string, identity string, lockName string, runFunc func(ctx context.Context)) error

RunWithLease run a process with acquired leader lease. It's a blocking function

func SanitizeName

func SanitizeName(name string) string

SanitizeName sanitizes the provided string so it can be consumed by leader election library copy from github.com/kubernetes-csi/csi-lib-utils/leaderelection

func TouchFile added in v0.4.0

func TouchFile(filepath string) error

Types

type PCIDiskInfo

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

PCIDiskInfo struct

func (*PCIDiskInfo) IsNVMe

func (d *PCIDiskInfo) IsNVMe() bool

IsNVMe check if it's a nvme or not

Directories

Path Synopsis
Design for copy data from source PVC to destination PVC, continuously push statue into status channel for notifications
Design for copy data from source PVC to destination PVC, continuously push statue into status channel for notifications

Jump to

Keyboard shortcuts

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