identifiers

package
v2.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package identifiers provides common constants, variables and function used in both controller and node services.

Index

Constants

View Source
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"

	// 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

	// EnvExclusiveAccess indicates whether only externalAccess entries should be added to the NFS export.
	// If true, node IP is excluded, and only IP/CIDR from externalAccess is used.
	EnvExclusiveAccess = "X_CSI_POWERSTORE_EXCLUSIVE_ACCESS"

	// 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"

	// 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"

	// EnvMultiNASThreshold specifies the failure threshold used to put NAS in cooldown.
	EnvMultiNASFailureThreshold = "X_CSI_MULTI_NAS_FAILURE_THRESHOLD"

	// EnvMultiNASCooldownPeriod specifies the cooldown period for multiple NAS devices.
	EnvMultiNASCooldownPeriod = "X_CSI_MULTI_NAS_COOLDOWN_PERIOD"

	// EnvDriverNamespace is the namespace where the powerstore driver is deployed
	EnvDriverNamespace = "X_CSI_DRIVER_NAMESPACE"

	// EnvPowerstoreAPITimeout specifies the timeout for Powerstore REST API calls
	EnvPowerstoreAPITimeout = "X_CSI_POWERSTORE_API_TIMEOUT"

	// EnvPodmonArrayConnectivityTimeout specifies the timeout for array connectivity for podmon
	EnvPodmonArrayConnectivityTimeout = "X_CSI_PODMON_ARRAY_CONNECTIVITY_TIMEOUT"

	// EnvVolumeDisconnectMaxRetries specifies the maximum number of retry attempts for volume disconnection
	EnvVolumeDisconnectMaxRetries = "X_CSI_VOLUME_DISCONNECT_MAX_RETRIES"

	// EnvVolumeDisconnectRetryInterval specifies the wait time (in seconds) between volume disconnection retries
	EnvVolumeDisconnectRetryInterval = "X_CSI_VOLUME_DISCONNECT_RETRY_INTERVAL"

	// EnvVolumeDisconnectTimeoutSeconds specifies the timeout duration (in seconds) for each volume disconnection attempt
	EnvVolumeDisconnectTimeoutSeconds = "X_CSI_VOLUME_DISCONNECT_TIMEOUT_SECONDS"

	// EnvCSMDREnabled indicates if CSM-DR is enabled
	EnvCSMDREnabled = "X_CSM_DR_ENABLED"
)
View Source
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"
	// TargetMapDeviceWWN indicates target map device wwn
	TargetMapDeviceWWN = "DEVICE_WWN"
	// TargetMapLUNAddress indicates publish context LUN address
	TargetMapLUNAddress = "LUN_ADDRESS"
	// TargetMapISCSIPortalsPrefix indicates target map iSCSI portals prefix
	TargetMapISCSIPortalsPrefix = "PORTAL"
	// TargetMapISCSITargetsPrefix indicates target map iSCSI targets prefix
	TargetMapISCSITargetsPrefix = "TARGET"
	// TargetMapNVMETCPPortalsPrefix indicates target map NVMeTCP portals prefix
	TargetMapNVMETCPPortalsPrefix = "NVMETCPPORTAL"
	// TargetMapNVMETCPTargetsPrefix indicates target mapNVMe targets prefix
	TargetMapNVMETCPTargetsPrefix = "NVMETCPTARGET"
	// TargetMapNVMEFCPortalsPrefix indicates publish context NVMe targets prefix
	TargetMapNVMEFCPortalsPrefix = "NVMEFCPORTAL"
	// TargetMapNVMEFCTargetsPrefix indicates target map NVMe targets prefix
	TargetMapNVMEFCTargetsPrefix = "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"
	// TargetMapFCWWPNPrefix indicates target map FC WWPN prefix
	TargetMapFCWWPNPrefix = "FCWWPN"
	// TargetMapRemoteDeviceWWN indicates target map device wwn of remote device
	TargetMapRemoteDeviceWWN = "REMOTE_DEVICE_WWN"
	// TargetMapRemoteLUNAddress indicates target map LUN address of remote device
	TargetMapRemoteLUNAddress = "REMOTE_LUN_ADDRESS"
	// TargetMapRemoteISCSIPortalsPrefix indicates target map iSCSI portals prefix of remote array
	TargetMapRemoteISCSIPortalsPrefix = "REMOTE_PORTAL"
	// TargetMapRemoteISCSITargetsPrefix indicates target map iSCSI targets prefix of remote array
	TargetMapRemoteISCSITargetsPrefix = "REMOTE_TARGET"
	// TargetMapRemoteNVMETCPPortalsPrefix indicates target map NVMeTCP portals prefix of remote array
	TargetMapRemoteNVMETCPPortalsPrefix = "REMOTE_NVMETCPPORTAL"
	// TargetMapRemoteNVMETCPTargetsPrefix indicates target map NVMe targets prefix of remote array
	TargetMapRemoteNVMETCPTargetsPrefix = "REMOTE_NVMETCPTARGET"
	// TargetMapRemoteNVMEFCPortalsPrefix indicates target map NVMe targets prefix of remote array
	TargetMapRemoteNVMEFCPortalsPrefix = "REMOTE_NVMEFCPORTAL"
	// TargetMapRemoteNVMEFCTargetsPrefix indicates target map NVMe targets prefix of remote array
	TargetMapRemoteNVMEFCTargetsPrefix = "REMOTE_NVMEFCTARGET"
	// TargetMapRemoteFCWWPNPrefix indicates target map FC WWPN prefix of remote array
	TargetMapRemoteFCWWPNPrefix = "REMOTE_FCWWPN"
	// WWNPrefix indicates WWN prefix
	WWNPrefix = "naa."
	// SyncMode indicates Synchronous Replication
	SyncMode = "SYNC"
	// AsyncMode indicats Asynchronous Replication
	AsyncMode = "ASYNC"
	// MetroMode indicates Metro Replication
	MetroMode = "METRO"
	// Zero indicates value zero for RPO
	Zero = "Zero"

	// 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

	// ArrayStatus is the endPoint for polling to check array status
	ArrayStatus = "/array-status"

	// KeyNodeID represents key for node id
	KeyNodeID = "csi.volume.kubernetes.io/nodeid"
)

Variables

View Source
var APIPort string

APIPort port for API calls

View Source
var DefaultPodmonArrayConnectivityTimeout = 10 * time.Second

DefaultPodmonArrayConnectivityTimeout specifies default timeout for making http requests to node services by podmon

View Source
var DefaultPowerstoreRESTApiTimeout = 120 * time.Second

DefaultPowerstoreRESTApiTimeout specifies default timeout for making http requests by Powerstore client

View Source
var DefaultVolumeDisconnectMaxRetries = 5

DefaultVolumeDisconnectMaxRetries specifies the default maximum number of retry attempts for volume disconnection

View Source
var DefaultVolumeDisconnectRetryInterval = 5 * time.Second

DefaultVolumeDisconnectRetryInterval specifies the default wait time between volume disconnection retries

View Source
var DefaultVolumeDisconnectTimeout = 120 * time.Second

DefaultVolumeDisconnectTimeout specifies the default timeout duration for each volume disconnection attempt

View Source
var Manifest = map[string]string{
	"semver": ManifestSemver,
	"formed": core.CommitTime.Format(time.RFC1123),
}

Manifest contains additional information about the driver

View Source
var ManifestSemver string

Update when the manifest version changes.

View Source
var Name = "csi-powerstore.dellemc.com"

Name contains default name of the driver, can be overridden

View Source
var PodmonArrayConnectivityTimeout = GetPodmonArrayConnectivityTimeout()

PodmonArrayConnectivityTimeout specifies timeout for making http requests to node services by podmon

View Source
var PowerstoreRESTApiTimeout = GetPowerStoreRESTApiTimeout()

PowerstoreRESTApiTimeout specifies timeout for making http requests by Powerstore client

Functions

func Contains

func Contains(slice []string, element string) bool

Contains return true if element is present in the slice

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 targets by querying PowerStore array

func GetIPListFromString

func GetIPListFromString(input string) []string

GetIPListFromString returns list of ips in string form found in input string A return value of nil indicates no match

func GetIPListWithMaskFromString

func GetIPListWithMaskFromString(input string) (string, error)

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 targets by querying PowerStore array

func GetIntFromEnv added in v2.16.0

func GetIntFromEnv(envvar string) (int, error)

GetIntFromEnv retrieves an integer value from the specified environment variable or returns an error.

func GetMountFlags

func GetMountFlags(vc *csi.VolumeCapability) []string

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 GetNVMETCPTargetsInfoFromStorage

func GetNVMETCPTargetsInfoFromStorage(client gopowerstore.Client, volumeApplianceID string) ([]gobrick.NVMeTargetInfo, error)

GetNVMETCPTargetsInfoFromStorage returns list of gobrick compatible NVME TCP targets by querying PowerStore array

func GetNfsTopology

func GetNfsTopology(arrIP string) []*csi.Topology

GetNfsTopology Returns a topology array with only nfs

func GetPodmonArrayConnectivityTimeout

func GetPodmonArrayConnectivityTimeout() time.Duration

GetPodmonArrayConnectivityPollRate retrieves a timeout value for podmon node array connectivity check from env var or returns default value.

func GetPowerStoreRESTApiTimeout

func GetPowerStoreRESTApiTimeout() time.Duration

GetPowerStoreRESTApiTimeout retrieves a timeout value for PowerStore REST API requests from env var or returns default value..

func GetTimeoutFromEnv

func GetTimeoutFromEnv(envvar string) (time.Duration, error)

GetTimeoutFromEnv retrieves a timeout value from the specified environment variable or returns default value.

func GetVolumeDisconnectMaxRetries added in v2.16.0

func GetVolumeDisconnectMaxRetries() int

GetVolumeDisconnectMaxRetries retrieves the maximum number of retry attempts for volume disconnection from env var or returns the default value.

func GetVolumeDisconnectRetryInterval added in v2.16.0

func GetVolumeDisconnectRetryInterval() time.Duration

GetVolumeDisconnectRetryInterval retrieves the wait time between volume disconnection retries from env var or returns the default value.

func GetVolumeDisconnectTimeout added in v2.16.0

func GetVolumeDisconnectTimeout() time.Duration

GetVolumeDisconnectTimeout retrieves a timeout value for volume disconnection from env var or returns the default value.

func HasRequiredTopology

func HasRequiredTopology(topologies []*csi.Topology, arrIP string, requiredTopology string) bool

HasRequiredTopology Checks if requiredTopology is present in the topology array and is true

func HostAlreadyPresentInNFSExport added in v2.16.0

func HostAlreadyPresentInNFSExport(export gopowerstore.NFSExport, ip string) bool

HostAlreadyPresentInNFSExport checks if the given host IP is already present in any of the NFS export host lists.

func IsK8sMetadataSupported

func IsK8sMetadataSupported(client gopowerstore.Client) bool

IsK8sMetadataSupported returns info whether Metadata is supported or not

func IsNFSServiceEnabled

func IsNFSServiceEnabled(ctx context.Context, client gopowerstore.Client) (bool, error)

IsNFSServiceEnabled checks if NFS service is enabled for the given PowerStore array.

func ParseCIDR

func ParseCIDR(externalAccessCIDR string) (string, error)

ParseCIDR parses the CIDR address to the valid start IP range with Mask

func RandomString

func RandomString(length int) string

RandomString returns a random string of specified length. String is generated by using crypto/rand.

func ReachableEndPoint

func ReachableEndPoint(endpoint string) bool

ReachableEndPoint checks if this endpoint is reachable or not

func RmSockFile

func RmSockFile(f fs.Interface)

RmSockFile removes socket files that left after previous installation

func SetAPIPort

func SetAPIPort(ctx context.Context)

SetAPIPort set the port for running server

func SetPollingFrequency

func SetPollingFrequency(ctx context.Context) int64

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 csmlog Debug method

func (*CustomLogger) Error

func (lg *CustomLogger) Error(ctx context.Context, format string, args ...interface{})

Error is a wrapper of csmlog Error method

func (*CustomLogger) Info

func (lg *CustomLogger) Info(ctx context.Context, format string, args ...interface{})

Info is a wrapper of csmlog Info method

type TransportType

type TransportType string

TransportType differentiates different SCSI transport protocols (FC, iSCSI, Auto, None)

Directories

Path Synopsis
Package fs provides wrappers for os/fs dependent operations.
Package fs provides wrappers for os/fs dependent operations.

Jump to

Keyboard shortcuts

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