Documentation ¶
Overview ¶
Package common provides common constants, variables and function used in both controller and node services.
Index ¶
- Constants
- Variables
- func Contains(slice []string, element string) bool
- func ExternalAccessAlreadyAdded(export gopowerstore.NFSExport, externalAccess string) bool
- func GetFCTargetsInfoFromStorage(client gopowerstore.Client, volumeApplianceID string) ([]gobrick.FCTargetInfo, error)
- func GetIPListFromString(input string) []string
- func GetIPListWithMaskFromString(input string) (string, error)
- func GetISCSITargetsInfoFromStorage(client gopowerstore.Client, volumeApplianceID string) ([]gobrick.ISCSITargetInfo, error)
- func GetLogFields(ctx context.Context) log.Fields
- func GetNVMEFCTargetInfoFromStorage(client gopowerstore.Client, volumeApplianceID string) ([]gobrick.NVMeTargetInfo, error)
- func GetNfsTopology(arrIP string) []*csi.Topology
- func HasRequiredTopology(topologies []*csi.Topology, arrIP string, requiredTopology string) bool
- func IsK8sMetadataSupported(client gopowerstore.Client) bool
- func ParseCIDR(externalAccessCIDR string) (string, error)
- func RandomString(len int) string
- func ReachableEndPoint(endpoint string) bool
- func RmSockFile(f fs.Interface)
- func SetAPIPort(ctx context.Context)
- func SetLogFields(ctx context.Context, fields log.Fields) context.Context
- func SetPollingFrequency(ctx context.Context) int64
- type ArrayConnectivityStatus
- type CustomLogger
- type TransportType
Constants ¶
const ( // KeyAllowRoot key value to check if driver should enable root squashing for nfs volumes KeyAllowRoot = "allowRoot" // KeyNfsExportPath key value to pass in publish context KeyNfsExportPath = "NfsExportPath" // KeyHostIP key value to pass in publish context KeyHostIP = "HostIP" // KeyExportID key value to pass in publish context KeyExportID = "ExportID" // KeyNatIP key value to pass in publish context KeyNatIP = "NatIP" // KeyArrayID key value to check in request parameters for array ip KeyArrayID = "arrayID" // KeyArrayVolumeName key value to check in request parameters for volume name KeyArrayVolumeName = "Name" // KeyProtocol key value to check in request parameters for volume name KeyProtocol = "Protocol" // KeyNfsACL key value to specify NFS ACLs for NFS volume KeyNfsACL = "nfsAcls" // KeyNasName key value to specify NAS server name KeyNasName = "nasName" // KeyVolumeDescription key value to specify volume description KeyVolumeDescription = "csi.dell.com/description" // KeyApplianceID key value to specify appliance_id KeyApplianceID = "csi.dell.com/appliance_id" // KeyProtectionPolicyID key value to specify protection_policy_id KeyProtectionPolicyID = "csi.dell.com/protection_policy_id" // KeyPerformancePolicyID key value to specify performance_policy_id KeyPerformancePolicyID = "csi.dell.com/performance_policy_id" // KeyAppType key value to specify app_type KeyAppType = "csi.dell.com/app_type" // KeyAppTypeOther key value to specify app_type_other KeyAppTypeOther = "csi.dell.com/app_type_other" // KeyConfigType key value to specify volume config_type KeyConfigType = "csi.dell.com/config_type" // KeyAccessPolicy key value to specify volume access_policy KeyAccessPolicy = "csi.dell.com/access_policy" // KeyLockingPolicy key value to specify volume locking_policy KeyLockingPolicy = "csi.dell.com/locking_policy" // KeyFolderRenamePolicy key value to specify volume folder_rename_policy KeyFolderRenamePolicy = "csi.dell.com/folder_rename_policy" // KeyIsAsyncMtimeEnabled key value to specify volume is_async_mtime_enabled KeyIsAsyncMtimeEnabled = "csi.dell.com/is_async_mtime_enabled" // KeyFileEventsPublishingMode key value to specify volume file_events_publishing_mode KeyFileEventsPublishingMode = "csi.dell.com/file_events_publishing_mode" // KeyHostIoSize key value to specify volume host_io_size KeyHostIoSize = "csi.dell.com/host_io_size" // KeyVolumeGroupID key value to specify volume_group_id KeyVolumeGroupID = "csi.dell.com/volume_group_id" // KeyFlrCreateMode key value to specify flr_attributes.flr_create.mode KeyFlrCreateMode = "csi.dell.com/flr_attributes.flr_create.mode" // KeyFlrDefaultRetention key value to specify flr_attributes.flr_create.default_retention KeyFlrDefaultRetention = "csi.dell.com/flr_attributes.flr_create.default_retention" // KeyFlrMinRetention key value to specify flr_attributes.flr_create.minimum_retention KeyFlrMinRetention = "csi.dell.com/flr_attributes.flr_create.minimum_retention" // KeyFlrMaxRetention key value to specify flr_attributes.flr_create.maximum_retention KeyFlrMaxRetention = "csi.dell.com/flr_attributes.flr_create.maximum_retention" // KeyServiceTag has the service tag associated to an Appliance KeyServiceTag = "serviceTag" // VerboseName longer description of the driver VerboseName = "CSI Driver for Dell EMC PowerStore" // FcTransport indicates that FC is chosen as a SCSI transport protocol FcTransport TransportType = "FC" // ISCSITransport indicates that ISCSI is chosen as a SCSI transport protocol ISCSITransport TransportType = "ISCSI" // AutoDetectTransport indicates that SCSI transport protocol would be detected automatically AutoDetectTransport TransportType = "AUTO" // NoneTransport indicates that no SCSI transport protocol needed NoneTransport TransportType = "NONE" // PublishContextDeviceWWN indicates publish context device wwn PublishContextDeviceWWN = "DEVICE_WWN" // PublishContextLUNAddress indicates publish context LUN address PublishContextLUNAddress = "LUN_ADDRESS" // PublishContextISCSIPortalsPrefix indicates publish context iSCSI portals prefix PublishContextISCSIPortalsPrefix = "PORTAL" // PublishContextISCSITargetsPrefix indicates publish context iSCSI targets prefix PublishContextISCSITargetsPrefix = "TARGET" // PublishContextNVMETCPPortalsPrefix indicates publish context NVMeTCP portals prefix PublishContextNVMETCPPortalsPrefix = "NVMETCPPORTAL" // PublishContextNVMETCPTargetsPrefix indicates publish context NVMe targets prefix PublishContextNVMETCPTargetsPrefix = "NVMETCPTARGET" // PublishContextNVMEFCPortalsPrefix indicates publish context NVMe targets prefix PublishContextNVMEFCPortalsPrefix = "NVMEFCPORTAL" // PublishContextNVMEFCTargetsPrefix indicates publish context NVMe targets prefix PublishContextNVMEFCTargetsPrefix = "NVMEFCTARGET" // NVMETCPTransport indicates that NVMe/TCP is chosen as the transport protocol NVMETCPTransport TransportType = "NVMETCP" // NVMEFCTransport indicates that NVMe/FC is chosen as the transport protocol NVMEFCTransport TransportType = "NVMEFC" // PublishContextFCWWPNPrefix indicates publish context FC WWPN prefix PublishContextFCWWPNPrefix = "FCWWPN" // WWNPrefix indicates WWN prefix WWNPrefix = "naa." // DefaultPodmonAPIPortNumber is the port number in default to expose internal health APIs DefaultPodmonAPIPortNumber = "8083" // DefaultPodmonPollRate is the default polling frequency to check for array connectivity DefaultPodmonPollRate = 60 // Timeout for making http requests Timeout = time.Second * 5 // ArrayStatus is the endPoint for polling to check array status ArrayStatus = "/array-status" )
const ( // EnvDriverName is the name of the csi driver (provisioner) EnvDriverName = "X_CSI_DRIVER_NAME" // EnvNodeIDFilePath is the name of the environment variable used to // specify the file with the node ID EnvNodeIDFilePath = "X_CSI_POWERSTORE_NODE_ID_PATH" // EnvKubeNodeName is the name of the environment variable which stores current kubernetes // node name EnvKubeNodeName = "X_CSI_POWERSTORE_KUBE_NODE_NAME" //EnvKubeConfigPath indicates kubernetes configuration path that has to be used by CSI Driver EnvKubeConfigPath = "KUBECONFIG" // EnvNodeNamePrefix is the name of the environment variable which stores prefix which will be // used when registering node on PowerStore array EnvNodeNamePrefix = "X_CSI_POWERSTORE_NODE_NAME_PREFIX" // EnvMaxVolumesPerNode specifies maximum number of volumes that controller can publish to the node EnvMaxVolumesPerNode = "X_CSI_POWERSTORE_MAX_VOLUMES_PER_NODE" // EnvNodeChrootPath is the name of the environment variable which store path to chroot where // to execute iSCSI commands EnvNodeChrootPath = "X_CSI_POWERSTORE_NODE_CHROOT_PATH" // EnvCtrlRootPath is the name of the environment variable which store path to directory where // the host root is mounted EnvCtrlRootPath = "X_CSI_POWERSTORE_CTRL_ROOT_PATH" // EnvTmpDir is the name of the environment variable which store path to the folder which will be used // for csi-powerstore temporary files EnvTmpDir = "X_CSI_POWERSTORE_TMP_DIR" // #nosec G101 // EnvFCPortsFilterFilePath is the name of the environment variable which store path to the file which // provide list of WWPN which should be used by the driver for FC connection on this node // example: // content of the file: // 21:00:00:29:ff:48:9f:6e,21:00:00:29:ff:48:9f:6e // If file not exist or empty or in invalid format, then the driver will use all available FC ports EnvFCPortsFilterFilePath = "X_CSI_FC_PORTS_FILTER_FILE_PATH" // EnvThrottlingRateLimit sets a number of concurrent requests to APi EnvThrottlingRateLimit = "X_CSI_POWERSTORE_THROTTLING_RATE_LIMIT" // EnvEnableCHAP is the flag which determines if the driver is going // to set the CHAP credentials in the ISCSI node database at the time // of node plugin boot EnvEnableCHAP = "X_CSI_POWERSTORE_ENABLE_CHAP" // EnvExternalAccess is the IP of an additional router you wish to add for nfs export // Used to provide NFS volumes behind NAT EnvExternalAccess = "X_CSI_POWERSTORE_EXTERNAL_ACCESS" // #nosec G101 // EnvArrayConfigFilePath is filepath to powerstore arrays config file EnvArrayConfigFilePath = "X_CSI_POWERSTORE_CONFIG_PATH" // EnvConfigParamsFilePath is filepath to powerstore driver params config file EnvConfigParamsFilePath = "X_CSI_POWERSTORE_CONFIG_PARAMS_PATH" // EnvDebugEnableTracing allow to enable tracing in driver EnvDebugEnableTracing = "ENABLE_TRACING" // EnvReplicationContextPrefix enables sidecars to read required information from volume context EnvReplicationContextPrefix = "X_CSI_REPLICATION_CONTEXT_PREFIX" // EnvReplicationPrefix is used as a prefix to find out if replication is enabled EnvReplicationPrefix = "X_CSI_REPLICATION_PREFIX" // #nosec G101 // EnvGOCSIDebug indicates whether to print REQUESTs and RESPONSEs of all CSI method calls(from gocsi) EnvGOCSIDebug = "X_CSI_DEBUG" // EnvIsHealthMonitorEnabled specifies if health monitor is enabled. EnvIsHealthMonitorEnabled = "X_CSI_HEALTH_MONITOR_ENABLED" // EnvNfsAcls specifies acls to be set on NFS mount directory EnvNfsAcls = "X_CSI_NFS_ACLS" // EnvK8sVisibilityAutoRegistration specifies if k8s cluster should be automatically registered to PowerStore Array EnvK8sVisibilityAutoRegistration = "X_CSI_K8S_VISIBILITY_AUTO_REGISTRATION" // EnvMetadataRetrieverEndpoint specifies the endpoint address for csi-metadata-retriever sidecar EnvMetadataRetrieverEndpoint = "CSI_RETRIEVER_ENDPOINT" // EnvAllowAutoRoundOffFilesystemSize specifies if auto round off minimum filesystem size is enabled EnvAllowAutoRoundOffFilesystemSize = "CSI_AUTO_ROUND_OFF_FILESYSTEM_SIZE" //EnvPodmonEnabled indicates that podmon is enabled EnvPodmonEnabled = "X_CSI_PODMON_ENABLED" //EnvPodmonAPIPORT indicates the port to be used for exposing podmon API health, ToDo: Rename to var EnvPodmonArrayConnectivityAPIPORT EnvPodmonAPIPORT = "X_CSI_PODMON_API_PORT" //EnvPodmonArrayConnectivityPollRate indicates the polling frequency to check array connectivity EnvPodmonArrayConnectivityPollRate = "X_CSI_PODMON_ARRAY_CONNECTIVITY_POLL_RATE" )
Variables ¶
var APIPort string
APIPort port for API calls
var Manifest = map[string]string{ "url": "https://github.com/dell/csi-powerstore", "semver": core.SemVer, "commit": core.CommitSha32, "formed": core.CommitTime.Format(time.RFC1123), }
Manifest contains additional information about the driver
var Name = "csi-powerstore.dellemc.com"
Name contains default name of the driver, can be overridden
Functions ¶
func ExternalAccessAlreadyAdded ¶
func ExternalAccessAlreadyAdded(export gopowerstore.NFSExport, externalAccess string) bool
ExternalAccessAlreadyAdded return true if externalAccess is present on ARRAY in any access mode type
func GetFCTargetsInfoFromStorage ¶
func GetFCTargetsInfoFromStorage(client gopowerstore.Client, volumeApplianceID string) ([]gobrick.FCTargetInfo, error)
GetFCTargetsInfoFromStorage returns list of gobrick compatible FC tragets by querying PowerStore array
func GetIPListFromString ¶
GetIPListFromString returns list of ips in string form found in input string A return value of nil indicates no match
func GetIPListWithMaskFromString ¶
GetIPListWithMaskFromString returns ip and mask in string form found in input string A return value of nil indicates no match
func GetISCSITargetsInfoFromStorage ¶
func GetISCSITargetsInfoFromStorage(client gopowerstore.Client, volumeApplianceID string) ([]gobrick.ISCSITargetInfo, error)
GetISCSITargetsInfoFromStorage returns list of gobrick compatible iscsi tragets by querying PowerStore array
func GetLogFields ¶
GetLogFields extracts log fields from context by using contextLogFieldsKey key
func GetNVMEFCTargetInfoFromStorage ¶
func GetNVMEFCTargetInfoFromStorage(client gopowerstore.Client, volumeApplianceID string) ([]gobrick.NVMeTargetInfo, error)
GetNVMEFCTargetInfoFromStorage returns a list of gobrick compatible NVMeFC targets by quering Powerstore Array
func GetNfsTopology ¶
GetNfsTopology Returns a topology array with only nfs
func HasRequiredTopology ¶
HasRequiredTopology Checks if requiredTopology is present in the topology array and is true
func IsK8sMetadataSupported ¶
func IsK8sMetadataSupported(client gopowerstore.Client) bool
IsK8sMetadataSupported returns info whether Metadata is supported or not
func RandomString ¶
RandomString returns a random string of specified length. String is generated by using crypto/rand.
func ReachableEndPoint ¶
ReachableEndPoint checks if this endpoint is reachable or not
func RmSockFile ¶
RmSockFile removes socket files that left after previous installation
func SetLogFields ¶
SetLogFields returns modified context with fields inserted as values by using contextLogFieldsKey key
func SetPollingFrequency ¶
SetPollingFrequency reads the pollingFrequency from Env, sets default vale if ENV not found
Types ¶
type ArrayConnectivityStatus ¶
type ArrayConnectivityStatus struct { LastSuccess int64 `json:"lastSuccess"` // connectivity status LastAttempt int64 `json:"lastAttempt"` // last timestamp attempted to check connectivity }
ArrayConnectivityStatus Status of the array probe
type CustomLogger ¶
type CustomLogger struct{}
CustomLogger is logger wrapper that can be passed to gopowerstore, gobrick allowing to logging context fields with each call
func (*CustomLogger) Debug ¶
func (lg *CustomLogger) Debug(ctx context.Context, format string, args ...interface{})
Debug is a wrapper of logrus Debug method
type TransportType ¶
type TransportType string
TransportType differentiates different SCSI transport protocols (FC, iSCSI, Auto, None)