Documentation ¶
Index ¶
- Constants
- Variables
- func AddUniqueStringItem(items []string, itemToAdd string) []string
- func Bash(cmd string) (string, error)
- func BuildInClusterClientset() (*kubernetes.Clientset, error)
- func BuildStoragePoolName(poolClass string, poolType string) (string, error)
- func ConvertBytesToStr(size int64) string
- func ConvertLVMBytesToNumeric(lvmbyte string) (int64, error)
- func ConvertNumericToLVMBytes(num int64) string
- func GenerateResourceName(substrs []string, addDatetime, addUuid bool, maxLen int) string
- func GetNamespace() string
- func GetNodeName() string
- func GetRFC3339LocalTime() string
- func LogGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func NumericToLVMBytes(bytes int64) int64
- func ParseBytes(sizeStr string) (int64, error)
- func PrettyPrintJSON(v interface{})
- func RemoveStringItem(items []string, itemToDelete string) []string
- func RunWithLease(ns string, identity string, lockName string, runFunc func(ctx context.Context)) error
- func SanitizeName(name string) string
- func WriteDataIntoSysFSFile(content, sysFilePath string) error
- type PCIDiskInfo
- type Route
Constants ¶
const (
TimeFormatOnResourceName = "20060102-15"
)
Variables ¶
var (
ErrNotLVMByteNum = errors.New("LVM byte format unrecognised")
)
var ( // NoOpEventHandlerFuncs for informer NoOpEventHandlerFuncs = cache.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) {}, UpdateFunc: func(oldObj, newObj interface{}) {}, DeleteFunc: func(obj interface{}) {}, } )
Functions ¶
func AddUniqueStringItem ¶
AddUniqueStringItem add a string from a slice without duplicate
func BuildInClusterClientset ¶
func BuildInClusterClientset() (*kubernetes.Clientset, error)
BuildInClusterClientset builds a kubernetes in-cluster clientset
func BuildStoragePoolName ¶
BuildStoragePoolName constructs storage pool name
func ConvertBytesToStr ¶
ConvertBytesToStr convert size into string
func GenerateResourceName ¶ added in v0.3.5
Return K8S compatible resource name using substrs and settings
e.g. sub1-sub2-20200101-01-f34rret4
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 GetRFC3339LocalTime ¶ added in v0.3.5
func GetRFC3339LocalTime() 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 ParseBytes ¶
ParseBytes parse size from string into bytes
func PrettyPrintJSON ¶ added in v0.3.5
func PrettyPrintJSON(v interface{})
PrettyPrintJSON for debug
func RemoveStringItem ¶
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 ¶
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 WriteDataIntoSysFSFile ¶
Types ¶
type PCIDiskInfo ¶
type PCIDiskInfo struct {
// contains filtered or unexported fields
}
PCIDiskInfo struct