service

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyStoragePool is the key used to get the storagepool name from the
	// volume create parameters map
	KeyStoragePool = "storagepool"

	// KeyProtectionDomain is the key used to get the StoragePool's Protection Domain name from the
	// volume create parameters map. This parameter is optional.
	KeyProtectionDomain = "protectiondomain"

	// KeyBandwidthLimitInKbps is the key used to get the bandwidth limit from the volume
	// create parameters map
	KeyBandwidthLimitInKbps = "bandwidthLimitInKbps"

	// KeyIopsLimit is the key used to get the IOPS limit from the volume
	// create parameters map
	KeyIopsLimit = "iopsLimit"

	// KeySystemID is the key used to get the array ID from the volume
	// create parameters map
	KeySystemID = "systemID"

	// KeyMkfsFormatOption is the key used to get the file system option from the
	// volume create parameters map
	KeyMkfsFormatOption = "mkfsFormatOption"

	// KeyNasName is the key used to get the NAS name from the
	// volume create parameters map
	KeyNasName = "nasName"

	// KeyFsType is the key used to get the filesystem type from the
	// volume create parameters map
	KeyFsType = "fsType"

	// NFSExportLocalPath is the local path for NFSExport
	NFSExportLocalPath = "/"

	// NFSExportNamePrefix is the prefix used for nfs exports created using
	// csi-powerflex driver
	NFSExportNamePrefix = "csishare-"

	// KeyPath is the key used to get path of the associated filesystem
	// from the volume create parameters map
	KeyPath = "path"

	// KeySoftLimit is the key used to get the soft limit of the filesystem
	// from the volume create parameters map
	KeySoftLimit = "softLimit"

	// KeyGracePeriod is the key used to get the grace period from the
	// volume create parameters map
	KeyGracePeriod = "gracePeriod"

	// DefaultVolumeSizeKiB is default volume sgolang/protobuf/blob/master/ptypesize
	// to create on a scaleIO cluster when no size is given, expressed in KiB
	DefaultVolumeSizeKiB = 16 * kiBytesInGiB

	// VolSizeMultipleGiB is the volume size that VxFlexOS creates volumes as
	// a multiple of, meaning that all volume sizes are a multiple of this
	// number
	VolSizeMultipleGiB = 8

	// VolumeIDList is the list of volume IDs
	VolumeIDList = "VolumeIDList"

	// TRUE means "true" (comment put in for lint check)
	TRUE = "TRUE"
	// FALSE means "false" (comment put in for lint check)
	FALSE = "FALSE"
)
View Source
const (
	// These are available when enabling --extra-create-metadata for the external-provisioner.
	CSIPersistentVolumeName           = "csi.storage.k8s.io/pv/name"
	CSIPersistentVolumeClaimName      = "csi.storage.k8s.io/pvc/name"
	CSIPersistentVolumeClaimNamespace = "csi.storage.k8s.io/pvc/namespace"
	// These map to the above fields in the form of HTTP header names.
	HeaderPersistentVolumeName           = "x-csi-pv-name"
	HeaderPersistentVolumeClaimName      = "x-csi-pv-claimname"
	HeaderPersistentVolumeClaimNamespace = "x-csi-pv-namespace"
	// These help identify the system used as part of a request.
	HeaderSystemIdentifier    = "x-csi-system-id"
	HeaderCSIPluginIdentifier = "x-csi-plugin-id"
)

Extra metadata field names for propagating to goscaleio and beyond.

View Source
const (
	// EnvSDCGUID is the name of the environment variable used to set the
	// GUID of the SDC. This is only used by the Node Service, and removes
	// a need for calling an external binary to retrieve the GUID
	EnvSDCGUID = "X_CSI_VXFLEXOS_SDCGUID"

	// EnvThick is the name of the environment variable used to specify
	// that thick provisioning should be used when creating volumes
	EnvThick = "X_CSI_VXFLEXOS_THICKPROVISIONING"

	// EnvAutoProbe is the name of the environment variable used to specify
	// that the controller service should automatically probe itself if it
	// receives incoming requests before having been probed, in direct
	// violation of the CSI spec
	EnvAutoProbe = "X_CSI_VXFLEXOS_AUTOPROBE" // #nosec G101

	// EnvAllowRWOMultiPodAccess is the name of the environment variable that specifies
	// within a single node multiple pods should be able to access the same Filesystem volume with access mode ReadWriteOnce.
	// Multi-node access is still not allowed for ReadWriteOnce Filesystem volumes.
	// Enabling this option techincally violates the CSI 1.3 spec in the NodePublishVolume stating the required error returns.
	EnvAllowRWOMultiPodAccess = "X_CSI_ALLOW_RWO_MULTI_POD_ACCESS"

	// EnvIsHealthMonitorEnabled is the name of the environment variable that specifies if
	// the driver should be reporting on volume condition. To do so, requires the alpha feature gate CSIVolumeHealth set
	// to true in the cluster. If the feature gate is on, this should be enabled. Otherwise, this should be set to false.
	EnvIsHealthMonitorEnabled = "X_CSI_HEALTH_MONITOR_ENABLED"

	// EnvIsSDCRenameEnabled is the name of the environment variable that specifies if the renaming for SDC is to be
	// carried out or not. This is only used by the Node Service.
	EnvIsSDCRenameEnabled = "X_CSI_RENAME_SDC_ENABLED" // #nosec G101

	// EnvSDCPrefix is the name of the environment variable used to set the prefix for SDC name. This is only used by
	// the Node Service.
	EnvSDCPrefix = "X_CSI_RENAME_SDC_PREFIX"

	// EnvIsApproveSDCEnabled is the name of the environment variable that specifies if the SDC approval is to be
	// carried out or not.
	EnvIsApproveSDCEnabled = "X_CSI_APPROVE_SDC_ENABLED"

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

	// EnvMaxVolumesPerNode specifies maximum number of volumes that controller can publish to the node.
	EnvMaxVolumesPerNode = "X_CSI_MAX_VOLUMES_PER_NODE"

	// EnvQuotaEnabled enables setting of quota for NFS volumes.
	EnvQuotaEnabled = "X_CSI_QUOTA_ENABLED"

	// EnvExternalAccess is the IP of an additional router you wish to add for nfs export
	EnvExternalAccess = "X_CSI_POWERFLEX_EXTERNAL_ACCESS"

	// EnvKubeNodeName is the name of the environment variable which stores current kubernetes node name
	EnvKubeNodeName = "X_CSI_POWERFLEX_KUBE_NODE_NAME"
)
View Source
const (
	// KeyReplicationRemoteSystem represents key for replication remote system
	KeyReplicationRemoteSystem = "remoteSystem"
	// KeyReplicationRemoteStoragePool represents key for replication remote storage pool
	KeyReplicationRemoteStoragePool = "remoteStoragePool"
	// KeyReplicationProtectionDomain represents key for replication protectionDomain
	KeyReplicationProtectionDomain = "protectionDomain"
	// KeyReplicationConsistencyGroupName represents key for replication consistency group name
	KeyReplicationConsistencyGroupName = "consistencyGroupName"
	// KeyReplicationRPO represents key for replication RPO
	KeyReplicationRPO = "rpo"
	// KeyReplicationClusterID represents key for replication remote cluster ID
	KeyReplicationClusterID = "remoteClusterID"
	// KeyReplicationVGPrefix represents key for replication vg prefix
	KeyReplicationVGPrefix = "volumeGroupPrefix"
)
View Source
const (
	// Name is the name of the CSI plug-in.
	Name = "csi-vxflexos.dellemc.com"

	// KeyThickProvisioning is the key used to get a flag indicating that
	// a volume should be thick provisioned from the volume create params
	KeyThickProvisioning = "thickprovisioning"

	// SystemTopologySystemValue is the supported topology key
	SystemTopologySystemValue string = "csi-vxflexos.dellemc.com"

	// DefaultLogLevel for csi logs
	DefaultLogLevel = logrus.DebugLevel

	// ParamCSILogLevel csi driver log level
	ParamCSILogLevel = "CSI_LOG_LEVEL"
)
View Source
const (
	//ExistingGroupID group id on powerflex array
	ExistingGroupID = "existingSnapshotGroupID"
)

Variables

View Source
var ArrayConfigFile string

ArrayConfigFile is file name with array connection data

View Source
var DriverConfigParamsFile string

DriverConfigParamsFile is the name of the input driver config params file

View Source
var (

	// GetNodeLabels - Get the node labels
	GetNodeLabels = getNodelabels
)
View Source
var K8sClientset kubernetes.Interface

K8sClientset is the client to query k8s

View Source
var KubeConfig string

KubeConfig is the kube config

View Source
var Log = logrus.New()

Log controlls the logger give default value, will be overwritten by configmap

View Source
var LookupEnv = lookupEnv

LookupEnv - Fetches the environment var value

View Source
var Manifest = map[string]string{
	"url":    "http://github.com/dell/csi-vxflexos",
	"semver": core.SemVer,
	"commit": core.CommitSha32,
	"formed": core.CommitTime.Format(time.RFC1123),
}

Manifest is the SP's manifest.

Functions

func Contains added in v2.8.0

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

Contains checks if the a string is present in a slice of strings

func GetIPListWithMaskFromString added in v2.9.0

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 GetMessage added in v2.8.0

func GetMessage(format string, args ...interface{}) string

GetMessage - Get message

func ParseCIDR added in v2.9.0

func ParseCIDR(externalAccessCIDR string) (string, error)

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

func ParseInt64FromContext added in v2.8.0

func ParseInt64FromContext(ctx context.Context, key string) (int64, error)

ParseInt64FromContext parses an environment variable into an int64 value.

Types

type ArrayConnectionData

type ArrayConnectionData struct {
	SystemID                  string `json:"systemID"`
	Username                  string `json:"username"`
	Password                  string `json:"password"`
	Endpoint                  string `json:"endpoint"`
	SkipCertificateValidation bool   `json:"skipCertificateValidation,omitempty"`
	Insecure                  bool   `json:"insecure,omitempty"`
	IsDefault                 bool   `json:"isDefault,omitempty"`
	AllSystemNames            string `json:"allSystemNames"`
	NasName                   string `json:"nasName"`
}

ArrayConnectionData contains data required to connect to array

type Device

type Device struct {
	FullPath string
	Name     string
	RealDev  string
}

Device is a struct for holding details about a block device

func GetDevice

func GetDevice(path string) (*Device, error)

GetDevice returns a Device struct with info about the given device, or an error if it doesn't exist or is not a block device

type Opts

type Opts struct {
	SdcGUID      string
	Thick        bool
	AutoProbe    bool
	DisableCerts bool   // used for unit testing only
	Lsmod        string // used for unit testing only

	EnableSnapshotCGDelete     bool   // when snapshot deleted, enable deleting of all snaps in the CG of the snapshot
	EnableListVolumesSnapshots bool   // when listing volumes, include snapshots and volumes
	AllowRWOMultiPodAccess     bool   // allow multiple pods to access a RWO volume on the same node
	IsHealthMonitorEnabled     bool   // allow driver to make use of the alpha feature gate, CSIVolumeHealth
	IsSdcRenameEnabled         bool   // allow driver to enable renaming SDC
	SdcPrefix                  string // prefix to be set for SDC name
	IsApproveSDCEnabled        bool

	MaxVolumesPerNode int64
	IsQuotaEnabled    bool   // allow driver to enable quota limits for NFS volumes
	ExternalAccess    string // used for adding extra IP/IP range to the NFS export
	KubeNodeName      string
	// contains filtered or unexported fields
}

Opts defines service configuration options.

type Service

type Service interface {
	csi.ControllerServer
	csi.IdentityServer
	csi.NodeServer
	BeforeServe(context.Context, *gocsi.StoragePlugin, net.Listener) error
	RegisterAdditionalServers(server *grpc.Server)
	ProcessMapSecretChange() error
}

Service is the CSI Mock service provider.

func New

func New() Service

New returns a handle to service

Jump to

Keyboard shortcuts

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