Documentation
¶
Index ¶
- Variables
- func CombineTwoStrings(s1 string, s2 string, sign string) string
- func ConfigureLogger(debugEnabled bool) context.Context
- func GetAccessMode(req *csi.ControllerPublishVolumeRequest) (*csi.VolumeCapability_AccessMode_Mode, error)
- func GetExportIDFromConflictMessage(message string) int
- func GetFQDNByIP(ip string) (string, error)
- func GetIsiPathFromExportPath(exportPath string) string
- func GetNewUUID() (string, error)
- func GetNormalizedVolumeID(volName string, exportID int, accessZone string) string
- func GetOwnFQDN() (string, error)
- func GetPathForVolume(isiPath, volName string) string
- func GetQuotaIDFromDescription(export isi.Export) (string, error)
- func GetQuotaIDWithCSITag(quotaID string) string
- func GetVolumeNameFromExportPath(exportPath string) string
- func IsStringInSlice(str string, list []string) bool
- func IsStringInSlices(str string, list ...[]string) bool
- func LogMap(mapName string, m map[string]string)
- func ParseBooleanFromContext(ctx context.Context, key string) bool
- func ParseNormalizedVolumeID(volID string) (string, int, string, error)
- func ParseUintFromContext(ctx context.Context, key string) uint
- func RemoveExistingCSISockFile() error
- func RemoveStringFromSlice(str string, list []string) []string
- func RemoveStringsFromSlice(filters []string, list []string) []string
- func RemoveSurroundingQuotes(s string) string
Constants ¶
This section is empty.
Variables ¶
var CSIQuotaIDPrefix = "CSI_QUOTA_ID:"
CSIQuotaIDPrefix is the CSI tag for quota id stored in the export's description field set by csi driver
var ExportConflictMessagePattern = regexp.MustCompile(fmt.Sprintf("^Export rules (\\d+) and (\\d+) conflict on '(.+)'$"))
ExportConflictMessagePattern is the regex pattern that identifies the error message of export conflict
var QuotaIDPattern = regexp.MustCompile(fmt.Sprintf("^%s(.*)", CSIQuotaIDPrefix))
QuotaIDPattern the regex pattern that identifies the quota id set in the export's description field set by csi driver
var VolumeIDPattern = regexp.MustCompile(fmt.Sprintf("^(.+)%s(\\d+)%s(.+)$", VolumeIDSeparator, VolumeIDSeparator))
VolumeIDPattern is the regex pattern that identifies the quota id set in the export's description field set by csi driver
var VolumeIDSeparator = "=_=_="
VolumeIDSeparator is the separator that separates volume name and export ID (two components that a normalized volume ID is comprised of)
Functions ¶
func CombineTwoStrings ¶
CombineTwoStrings combines two string variables isolated by defined sign
func ConfigureLogger ¶
ConfigureLogger sets log level for the logger
func GetAccessMode ¶
func GetAccessMode(req *csi.ControllerPublishVolumeRequest) (*csi.VolumeCapability_AccessMode_Mode, error)
GetAccessMode extracts the access mode from the given *csi.ControllerPublishVolumeRequest instance
func GetExportIDFromConflictMessage ¶
GetExportIDFromConflictMessage returns the export id of the export which is creating or just created when there occurs a conflict
func GetFQDNByIP ¶
GetFQDNByIP returns the FQDN based on the parsed ip address
func GetIsiPathFromExportPath ¶
GetIsiPathFromExportPath returns isiPath based on the export path
func GetNormalizedVolumeID ¶
GetNormalizedVolumeID combines volume name (i.e. the directory name), export ID and access zone to form the normalized volume ID e.g. k8s-e89c9d089e + 19 + csi0zone => k8s-e89c9d089e=_=_=19=_=_=csi0zone
func GetOwnFQDN ¶
GetOwnFQDN returns the FQDN of the node or controller itself
func GetPathForVolume ¶
GetPathForVolume gets the volume full path by the combination of isiPath and volumeName
func GetQuotaIDFromDescription ¶
GetQuotaIDFromDescription extracts quota id from the description field of export
func GetQuotaIDWithCSITag ¶
GetQuotaIDWithCSITag formats a given quota id with the CSI tag, e.g. AABpAQEAAAAAAAAAAAAAQA0AAAAAAAAA -> CSI_QUOTA_ID:AABpAQEAAAAAAAAAAAAAQA0AAAAAAAAA
func GetVolumeNameFromExportPath ¶
GetVolumeNameFromExportPath returns volume name based on the export path
func IsStringInSlice ¶
IsStringInSlice checks if a string is an element of a string slice
func IsStringInSlices ¶
IsStringInSlices checks if a string is an element of a any of the string slices
func ParseBooleanFromContext ¶
ParseBooleanFromContext parses an environment variable into a boolean value. If an error is encountered, default is set to false, and error is logged
func ParseNormalizedVolumeID ¶
ParseNormalizedVolumeID parses the volume ID (following the pattern '^(.+)=_=_=(d+)=_=_=(.+)$') to extract the volume name, export ID and access zone that make up the volume ID e.g. k8s-e89c9d089e=_=_=19=_=_=csi0zone => k8s-e89c9d089e, 19, csi0zone
func ParseUintFromContext ¶ added in v1.1.0
ParseUintFromContext parses an environment variable into a uint value. If an error is encountered, default is set to 0, and error is logged
func RemoveExistingCSISockFile ¶
func RemoveExistingCSISockFile() error
RemoveExistingCSISockFile When the sock file that the gRPC server is going to be listening on already exists, error will be thrown saying the address is already in use, thus remove it first
func RemoveStringFromSlice ¶
RemoveStringFromSlice returns a slice that is a copy of the input "list" slice with the input "str" string removed
func RemoveStringsFromSlice ¶
RemoveStringsFromSlice generates a slice that is a copy of the input "list" slice with elements from the input "strs" slice removed
func RemoveSurroundingQuotes ¶
RemoveSurroundingQuotes removes the surrounding double quotes of a given string (if there are no surrounding quotes, do nothing)
Types ¶
This section is empty.