driver

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Pending :
	Pending = "PENDING"
)

Variables

This section is empty.

Functions

func NewControllerServiceCapability

func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability

NewControllerServiceCapability wraps the given type into a proper capability as expected by the spec

func NewNodeServiceCapability

func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability

NewNodeServiceCapability wraps the given type into a property capability as expected by the spec

func NewPluginCapabilityVolumeExpansion

func NewPluginCapabilityVolumeExpansion(cap csi.PluginCapability_VolumeExpansion_Type) *csi.PluginCapability_VolumeExpansion

NewPluginCapabilityVolumeExpansion wraps the given volume expansion into a plugin capability volume expansion required by the spec

func NewVolumeCapabilityAccessMode

func NewVolumeCapabilityAccessMode(mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability_AccessMode

NewVolumeCapabilityAccessMode wraps the given access mode into a volume capability access mode required by the spec

func ParseEndpoint

func ParseEndpoint(ep string) (string, string, error)

ParseEndpoint parses the gRPC endpoint provided

Types

type Driver

type Driver struct {
	DBService dbservice.DBService
	// contains filtered or unexported fields
}

Driver is the object that implements the CSI interfaces

func NewDriver

func NewDriver(name, version, endpoint, flavorName string, nodeService bool, dbServer string, dbPort string, podMonitor bool, podMonitorInterval int64) (*Driver, error)

NewDriver returns a driver that implements the gRPC endpoints required to support CSI

func (*Driver) AddControllerServiceCapabilities

func (driver *Driver) AddControllerServiceCapabilities(capabilities []csi.ControllerServiceCapability_RPC_Type)

AddControllerServiceCapabilities configures the service capabilities returned by the controller service nolint: dupl

func (*Driver) AddNodeServiceCapabilities

func (driver *Driver) AddNodeServiceCapabilities(capabilities []csi.NodeServiceCapability_RPC_Type)

AddNodeServiceCapabilities configures the service capabilities returned by the node service nolint: dupl

func (*Driver) AddPluginCapabilityVolumeExpansion

func (driver *Driver) AddPluginCapabilityVolumeExpansion(expansionTypes []csi.PluginCapability_VolumeExpansion_Type)

AddPluginCapabilityVolumeExpansion returns the plugin volume expansion capabilities nolint: dupl

func (*Driver) AddRequest

func (driver *Driver) AddRequest(key string, value interface{})

AddRequest inserts the request entry into the driver cache map

func (*Driver) AddStorageProvider

func (driver *Driver) AddStorageProvider(credentials *storageprovider.Credentials) error

AddStorageProvider adds a storage provider to the driver

func (*Driver) AddToDB

func (driver *Driver) AddToDB(key string, value interface{}) error

AddToDB creates an entry in the DB for the given key-value pair

func (*Driver) AddVolumeCapabilityAccessModes

func (driver *Driver) AddVolumeCapabilityAccessModes(accessModes []csi.VolumeCapability_AccessMode_Mode)

AddVolumeCapabilityAccessModes returns the volume capability access modes nolint: dupl

func (*Driver) AreVolumeCapabilitiesSupported

func (driver *Driver) AreVolumeCapabilitiesSupported(volCapabilities []*csi.VolumeCapability) (bool, error)

AreVolumeCapabilitiesSupported verifies if the given volcaps are supported by the driver nolint : gocyclo

func (*Driver) ClearRequest

func (driver *Driver) ClearRequest(key string)

ClearRequest removes the request entry from the driver cache map

func (*Driver) ControllerExpandVolume

func (driver *Driver) ControllerExpandVolume(ctx context.Context, request *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)

ControllerExpandVolume ...

A Controller plugin MUST implement this RPC call if plugin has EXPAND_VOLUME controller capability. This RPC allows the CO to expand the size of a volume.

This call MAY be made by the CO during any time in the lifecycle of the volume after creation if plugin has VolumeExpansion.ONLINE capability. If plugin has EXPAND_VOLUME node capability, then NodeExpandVolume MUST be called after successful ControllerExpandVolume and node_expansion_required in ControllerExpandVolumeResponse is true.

If the plugin has only VolumeExpansion.OFFLINE expansion capability and volume is currently published or available on a node then ControllerExpandVolume MUST be called ONLY after either:

The plugin has controller PUBLISH_UNPUBLISH_VOLUME capability and ControllerUnpublishVolume has been invoked successfully.

OR ELSE

The plugin does NOT have controller PUBLISH_UNPUBLISH_VOLUME capability, the plugin has node STAGE_UNSTAGE_VOLUME capability, and
NodeUnstageVolume has been completed successfully.

OR ELSE

The plugin does NOT have controller PUBLISH_UNPUBLISH_VOLUME capability, nor node STAGE_UNSTAGE_VOLUME capability, and
NodeUnpublishVolume has completed successfully.

nolint: dupl

func (*Driver) ControllerGetCapabilities

func (driver *Driver) ControllerGetCapabilities(ctx context.Context, request *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)

ControllerGetCapabilities ...

A Controller Plugin MUST implement this RPC call. This RPC allows the CO to check the supported capabilities of controller service provided by the Plugin. nolint: dupl

func (*Driver) ControllerGetVolume added in v1.3.0

func (driver *Driver) ControllerGetVolume(ctx context.Context, request *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error)

ControllerGetVolume ...

ALPHA FEATURE

This optional RPC MAY be called by the CO to fetch current information about a volume. A Controller Plugin MUST implement this ControllerGetVolume RPC call if it has GET_VOLUME capability. A Controller Plugin MUST provide a non-empty volume_condition field in ControllerGetVolumeResponse if it has VOLUME_CONDITION capability. ControllerGetVolumeResponse should contain current information of a volume if it exists. If the volume does not exist any more, ControllerGetVolume should return gRPC error code NOT_FOUND

func (*Driver) ControllerPublishVolume

func (driver *Driver) ControllerPublishVolume(ctx context.Context, request *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error)

ControllerPublishVolume ...

A Controller Plugin MUST implement this RPC call if it has PUBLISH_UNPUBLISH_VOLUME controller capability. This RPC will be called by the CO when it wants to place a workload that uses the volume onto a node. The Plugin SHOULD perform the work that is necessary for making the volume available on the given node. The Plugin MUST NOT assume that this RPC will be executed on the node where the volume will be used.

This operation MUST be idempotent. If the volume corresponding to the volume_id has already been published at the node corresponding to the node_id, and is compatible with the specified volume_capability and readonly flag, the Plugin MUST reply 0 OK.

If the operation failed or the CO does not know if the operation has failed or not, it MAY choose to call ControllerPublishVolume again or choose to call ControllerUnpublishVolume.

The CO MAY call this RPC for publishing a volume to multiple nodes if the volume has MULTI_NODE capability (i.e., MULTI_NODE_READER_ONLY, MULTI_NODE_SINGLE_WRITER or MULTI_NODE_MULTI_WRITER). nolint: gocyclo

func (*Driver) ControllerUnpublishVolume

func (driver *Driver) ControllerUnpublishVolume(ctx context.Context, request *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error)

ControllerUnpublishVolume ...

Controller Plugin MUST implement this RPC call if it has PUBLISH_UNPUBLISH_VOLUME controller capability. This RPC is a reverse operation of ControllerPublishVolume. It MUST be called after all NodeUnstageVolume and NodeUnpublishVolume on the volume are called and succeed. The Plugin SHOULD perform the work that is necessary for making the volume ready to be consumed by a different node. The Plugin MUST NOT assume that this RPC will be executed on the node where the volume was previously used.

This RPC is typically called by the CO when the workload using the volume is being moved to a different node, or all the workload using the volume on a node has finished.

This operation MUST be idempotent. If the volume corresponding to the volume_id is not attached to the node corresponding to the node_id, the Plugin MUST reply 0 OK. If this operation failed, or the CO does not know if the operation failed or not, it can choose to call ControllerUnpublishVolume again.

func (*Driver) CreateSnapshot

func (driver *Driver) CreateSnapshot(ctx context.Context, request *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error)

CreateSnapshot ...

A Controller Plugin MUST implement this RPC call if it has CREATE_DELETE_SNAPSHOT controller capability. This RPC will be called by the CO to create a new snapshot from a source volume on behalf of a user.

This operation MUST be idempotent. If a snapshot corresponding to the specified snapshot name is successfully cut and ready to use (meaning it MAY be specified as a volume_content_source in a CreateVolumeRequest), the Plugin MUST reply 0 OK with the corresponding CreateSnapshotResponse.

If an error occurs before a snapshot is cut, CreateSnapshot SHOULD return a corresponding gRPC error code that reflects the error condition.

For plugins that supports snapshot post processing such as uploading, CreateSnapshot SHOULD return 0 OK and ready_to_use SHOULD be set to false after the snapshot is cut but still being processed. CO SHOULD then reissue the same CreateSnapshotRequest periodically until boolean ready_to_use flips to true indicating the snapshot has been "processed" and is ready to use to create new volumes. If an error occurs during the process, CreateSnapshot SHOULD return a corresponding gRPC error code that reflects the error condition.

A snapshot MAY be used as the source to provision a new volume. A CreateVolumeRequest message MAY specify an OPTIONAL source snapshot parameter. Reverting a snapshot, where data in the original volume is erased and replaced with data in the snapshot, is an advanced functionality not every storage system can support and therefore is currently out of scope. nolint: dupl

func (*Driver) CreateVolume

func (driver *Driver) CreateVolume(ctx context.Context, request *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)

CreateVolume ...

A Controller Plugin MUST implement this RPC call if it has CREATE_DELETE_VOLUME controller capability. This RPC will be called by the CO to provision a new volume on behalf of a user (to be consumed as either a block device or a mounted filesystem).

This operation MUST be idempotent. If a volume corresponding to the specified volume name already exists, is accessible from accessibility_requirements, and is compatible with the specified capacity_range, volume_capabilities and parameters in the CreateVolumeRequest, the Plugin MUST reply 0 OK with the corresponding CreateVolumeResponse.

Plugins MAY create 3 types of volumes:

Empty volumes. When plugin supports CREATE_DELETE_VOLUME OPTIONAL capability. From an existing snapshot. When plugin supports CREATE_DELETE_VOLUME and CREATE_DELETE_SNAPSHOT OPTIONAL capabilities. From an existing volume. When plugin supports cloning, and reports the OPTIONAL capabilities CREATE_DELETE_VOLUME and CLONE_VOLUME. nolint : gocyclo

func (*Driver) DeleteSnapshot

func (driver *Driver) DeleteSnapshot(ctx context.Context, request *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error)

DeleteSnapshot ...

A Controller Plugin MUST implement this RPC call if it has CREATE_DELETE_SNAPSHOT capability. This RPC will be called by the CO to delete a snapshot.

This operation MUST be idempotent. If a snapshot corresponding to the specified snapshot_id does not exist or the artifacts associated with the snapshot do not exist anymore, the Plugin MUST reply 0 OK. nolint: dupl

func (*Driver) DeleteVolume

func (driver *Driver) DeleteVolume(ctx context.Context, request *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)

DeleteVolume ...

A Controller Plugin MUST implement this RPC call if it has CREATE_DELETE_VOLUME capability. This RPC will be called by the CO to deprovision a volume.

This operation MUST be idempotent. If a volume corresponding to the specified volume_id does not exist or the artifacts associated with the volume do not exist anymore, the Plugin MUST reply 0 OK.

func (*Driver) DeleteVolumeByName

func (driver *Driver) DeleteVolumeByName(name string, secrets map[string]string, force bool) error

DeleteVolumeByName deletes the volume by name. If force is true, then destroys it immediately.

func (*Driver) GenerateStorageProviderCacheKey added in v1.1.0

func (driver *Driver) GenerateStorageProviderCacheKey(credentials *storageprovider.Credentials) string

GenerateStorageProviderCacheKey generates unique hash for the credential pair {Backend, Username}

func (*Driver) GetCapacity

func (driver *Driver) GetCapacity(ctx context.Context, request *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)

GetCapacity ...

A Controller Plugin MUST implement this RPC call if it has GET_CAPACITY controller capability. The RPC allows the CO to query the capacity of the storage pool from which the controller provisions volumes. nolint: dupl

func (*Driver) GetPluginCapabilities

func (driver *Driver) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)

GetPluginCapabilities ...

This REQUIRED RPC allows the CO to query the supported capabilities of the Plugin "as a whole": it is the grand sum of all capabilities of all instances of the Plugin software, as it is intended to be deployed. All instances of the same version (see vendor_version of GetPluginInfoResponse) of the Plugin SHALL return the same set of capabilities, regardless of both: (a) where instances are deployed on the cluster as well as; (b) which RPCs an instance is serving.

func (*Driver) GetPluginInfo

func (driver *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)

GetPluginInfo ...

The name says it all

func (*Driver) GetRequest

func (driver *Driver) GetRequest(key string) interface{}

GetRequest retrieves the value in the driver cache map. If not exists, returns nil

func (*Driver) GetStorageProvider

func (driver *Driver) GetStorageProvider(secrets map[string]string) (storageprovider.StorageProvider, error)

GetStorageProvider gets the storage provider given the map of secrets nolint: misspell

func (*Driver) GetVolumeByID

func (driver *Driver) GetVolumeByID(id string, secrets map[string]string) (*model.Volume, error)

GetVolumeByID retrieves the volume instance from the CSP if exists

func (*Driver) GetVolumeByName

func (driver *Driver) GetVolumeByName(name string, secrets map[string]string) (*model.Volume, error)

GetVolumeByName retrieves the volume instance by name from the CSP if exists

func (*Driver) HandleDuplicateRequest

func (driver *Driver) HandleDuplicateRequest(key string) error

HandleDuplicateRequest checks for the duplicate request in the cache map. If yes, then returns ABORTED error, else inserts the entry into cache map and returns nil

func (*Driver) IsNFSResourceRequest

func (driver *Driver) IsNFSResourceRequest(parameters map[string]string) bool

func (*Driver) IsReadOnlyAccessMode

func (driver *Driver) IsReadOnlyAccessMode(capabilities []*csi.VolumeCapability) bool

IsReadOnlyAccessMode returns true if accessmode is ReadOnly for single and multi-node access

func (*Driver) IsSupportedControllerCapability

func (driver *Driver) IsSupportedControllerCapability(capType csi.ControllerServiceCapability_RPC_Type) bool

IsSupportedControllerCapability returns true if the given capability is supported else returns false

func (*Driver) IsSupportedMultiNodeAccessMode

func (driver *Driver) IsSupportedMultiNodeAccessMode(capabilities []*csi.VolumeCapability) bool

IsSupportedMultiNodeAccessMode returns true if given capabilities have accessmode of supported multi-node types

func (*Driver) IsSupportedNodeCapability

func (driver *Driver) IsSupportedNodeCapability(capType csi.NodeServiceCapability_RPC_Type) bool

IsSupportedNodeCapability returns true if the given node capability is supported else returns false

func (*Driver) IsSupportedPluginVolumeExpansionCapability

func (driver *Driver) IsSupportedPluginVolumeExpansionCapability(capType csi.PluginCapability_VolumeExpansion_Type) bool

IsSupportedPluginVolumeExpansionCapability returns true if the given volume expansion capability is supported else returns false nolint dupl

func (*Driver) IsValidVolumeCapability

func (driver *Driver) IsValidVolumeCapability(volCap *csi.VolumeCapability) (bool, error)

IsValidVolumeCapability checks if the given volume capability is supported by the driver nolint : gcyclo

func (*Driver) ListSnapshots

func (driver *Driver) ListSnapshots(ctx context.Context, request *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)

ListSnapshots ...

A Controller Plugin MUST implement this RPC call if it has LIST_SNAPSHOTS capability. The Plugin SHALL return the information about all snapshots on the storage system within the given parameters regardless of how they were created. ListSnapshots SHALL NOT list a snapshot that is being created but has not been cut successfully yet. If snapshots are created and/or deleted while the CO is concurrently paging through ListSnapshots results then it is possible that the CO MAY either witness duplicate snapshots in the list, not witness existing snapshots, or both. The CO SHALL NOT expect a consistent "view" of all snapshots when paging through the snapshot list via multiple calls to ListSnapshots. nolint: dupl

func (*Driver) ListVolumes

func (driver *Driver) ListVolumes(ctx context.Context, request *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)

ListVolumes ...

A Controller Plugin MUST implement this RPC call if it has LIST_VOLUMES capability. The Plugin SHALL return the information about all the volumes that it knows about. If volumes are created and/or deleted while the CO is concurrently paging through ListVolumes results then it is possible that the CO MAY either witness duplicate volumes in the list, not witness existing volumes, or both. The CO SHALL NOT expect a consistent "view" of all volumes when paging through the volume list via multiple calls to ListVolumes.

func (*Driver) NodeExpandVolume

func (driver *Driver) NodeExpandVolume(ctx context.Context, request *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)

NodeExpandVolume ...

A Node Plugin MUST implement this RPC call if it has EXPAND_VOLUME node capability. This RPC call allows CO to expand volume on a node.

NodeExpandVolume ONLY supports expansion of already node-published or node-staged volumes on the given volume_path.

If plugin has STAGE_UNSTAGE_VOLUME node capability then:

  • NodeExpandVolume MUST be called after successful NodeStageVolume.
  • NodeExpandVolume MAY be called before or after NodePublishVolume.

Otherwise NodeExpandVolume MUST be called after successful NodePublishVolume. Handles both filesystem type device and raw block device TODO assuming expand to underlying device size irrespective of provided capacity range. Need to add support of FS resize to fixed capacity eventhough underlying device is much bigger. nolint: dupl

func (*Driver) NodeGetCapabilities

func (driver *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)

NodeGetCapabilities ...

A Node Plugin MUST implement this RPC call. This RPC allows the CO to check the supported capabilities of node service provided by the Plugin. nolint: dupl

func (*Driver) NodeGetInfo

func (driver *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)

NodeGetInfo ...

A Node Plugin MUST implement this RPC call if the plugin has PUBLISH_UNPUBLISH_VOLUME controller capability. The Plugin SHALL assume that this RPC will be executed on the node where the volume will be used. The CO SHOULD call this RPC for the node at which it wants to place the workload. The CO MAY call this RPC more than once for a given node. The SP SHALL NOT expect the CO to call this RPC more than once. The result of this call will be used by CO in ControllerPublishVolume.

func (*Driver) NodeGetVolumeStats

func (driver *Driver) NodeGetVolumeStats(ctx context.Context, in *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)

NodeGetVolumeStats ...

A Node plugin MUST implement this RPC call if it has GET_VOLUME_STATS node capability. NodeGetVolumeStats RPC call returns the volume capacity statistics available for the volume.

If the volume is being used in BlockVolume mode then used and available MAY be omitted from usage field of NodeGetVolumeStatsResponse. Similarly, inode information MAY be omitted from NodeGetVolumeStatsResponse when unavailable. nolint: dupl

func (*Driver) NodePublishVolume

func (driver *Driver) NodePublishVolume(ctx context.Context, request *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)

NodePublishVolume ...

This RPC is called by the CO when a workload that wants to use the specified volume is placed (scheduled) on a node. The Plugin SHALL assume that this RPC will be executed on the node where the volume will be used.

If the corresponding Controller Plugin has PUBLISH_UNPUBLISH_VOLUME controller capability, the CO MUST guarantee that this RPC is called after ControllerPublishVolume is called for the given volume on the given node and returns a success.

This operation MUST be idempotent. If the volume corresponding to the volume_id has already been published at the specified target_path, and is compatible with the specified volume_capability and readonly flag, the Plugin MUST reply 0 OK.

If this RPC failed, or the CO does not know if it failed or not, it MAY choose to call NodePublishVolume again, or choose to call NodeUnpublishVolume.

This RPC MAY be called by the CO multiple times on the same node for the same volume with possibly different target_path and/or other arguments if the volume has MULTI_NODE capability (i.e., access_mode is either MULTI_NODE_READER_ONLY, MULTI_NODE_SINGLE_WRITER or MULTI_NODE_MULTI_WRITER). The following table shows what the Plugin SHOULD return when receiving a second NodePublishVolume on the same volume on the same node:

T1=T2, P1=P2		T1=T2, P1!=P2		T1!=T2, P1=P2			T1!=T2, P1!=P2

MULTI_NODE OK (idempotent) ALREADY_EXISTS OK OK Non MULTI_NODE OK (idempotent) ALREADY_EXISTS FAILED_PRECONDITION FAILED_PRECONDITION

func (*Driver) NodeStageVolume

func (driver *Driver) NodeStageVolume(ctx context.Context, request *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)

NodeStageVolume ...

A Node Plugin MUST implement this RPC call if it has STAGE_UNSTAGE_VOLUME node capability.

This RPC is called by the CO prior to the volume being consumed by any workloads on the node by NodePublishVolume. The Plugin SHALL assume that this RPC will be executed on the node where the volume will be used. This RPC SHOULD be called by the CO when a workload that wants to use the specified volume is placed (scheduled) on the specified node for the first time or for the first time since a NodeUnstageVolume call for the specified volume was called and returned success on that node.

If the corresponding Controller Plugin has PUBLISH_UNPUBLISH_VOLUME controller capability and the Node Plugin has STAGE_UNSTAGE_VOLUME capability, then the CO MUST guarantee that this RPC is called after ControllerPublishVolume is called for the given volume on the given node and returns a success. The CO MUST guarantee that this RPC is called and returns a success before any NodePublishVolume is called for the given volume on the given node.

This operation MUST be idempotent. If the volume corresponding to the volume_id is already staged to the staging_target_path, and is identical to the specified volume_capability the Plugin MUST reply 0 OK.

If this RPC failed, or the CO does not know if it failed or not, it MAY choose to call NodeStageVolume again, or choose to call NodeUnstageVolume. nolint: gocyclo

func (*Driver) NodeUnpublishVolume

func (driver *Driver) NodeUnpublishVolume(ctx context.Context, request *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)

NodeUnpublishVolume ...

A Node Plugin MUST implement this RPC call. This RPC is a reverse operation of NodePublishVolume. This RPC MUST undo the work by the corresponding NodePublishVolume. This RPC SHALL be called by the CO at least once for each target_path that was successfully setup via NodePublishVolume. If the corresponding Controller Plugin has PUBLISH_UNPUBLISH_VOLUME controller capability, the CO SHOULD issue all NodeUnpublishVolume (as specified above) before calling ControllerUnpublishVolume for the given node and the given volume. The Plugin SHALL assume that this RPC will be executed on the node where the volume is being used.

This RPC is typically called by the CO when the workload using the volume is being moved to a different node, or all the workload using the volume on a node has finished.

This operation MUST be idempotent. If this RPC failed, or the CO does not know if it failed or not, it can choose to call NodeUnpublishVolume again.

func (*Driver) NodeUnstageVolume

func (driver *Driver) NodeUnstageVolume(ctx context.Context, request *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)

NodeUnstageVolume ...

A Node Plugin MUST implement this RPC call if it has STAGE_UNSTAGE_VOLUME node capability.

This RPC is a reverse operation of NodeStageVolume. This RPC MUST undo the work by the corresponding NodeStageVolume. This RPC SHALL be called by the CO once for each staging_target_path that was successfully setup via NodeStageVolume.

If the corresponding Controller Plugin has PUBLISH_UNPUBLISH_VOLUME controller capability and the Node Plugin has STAGE_UNSTAGE_VOLUME capability, the CO MUST guarantee that this RPC is called and returns success before calling ControllerUnpublishVolume for the given node and the given volume. The CO MUST guarantee that this RPC is called after all NodeUnpublishVolume have been called and returned success for the given volume on the given node.

The Plugin SHALL assume that this RPC will be executed on the node where the volume is being used.

This RPC MAY be called by the CO when the workload using the volume is being moved to a different node, or all the workloads using the volume on a node have finished.

This operation MUST be idempotent. If the volume corresponding to the volume_id is not staged to the staging_target_path, the Plugin MUST reply 0 OK.

If this RPC failed, or the CO does not know if it failed or not, it MAY choose to call NodeUnstageVolume again. nolint: gocyclo

func (*Driver) Probe

func (driver *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)

Probe ...

A Plugin MUST implement this RPC call. The primary utility of the Probe RPC is to verify that the plugin is in a healthy and ready state. If an unhealthy state is reported, via a non-success response, a CO MAY take action with the intent to bring the plugin to a healthy state. Such actions MAY include, but SHALL NOT be limited to, the following: - Restarting the plugin container, or - Notifying the plugin supervisor.

The Plugin MAY verify that it has the right configurations, devices, dependencies and drivers in order to run and return a success if the validation succeeds. The CO MAY invoke this RPC at any time. A CO MAY invoke this call multiple times with the understanding that a plugin's implementation MAY NOT be trivial and there MAY be overhead incurred by such repeated calls. The SP SHALL document guidance and known limitations regarding a particular Plugin's implementation of this RPC. For example, the SP MAY document the maximum frequency at which its Probe implementation SHOULD be called.

func (*Driver) RemoveFromDB

func (driver *Driver) RemoveFromDB(key string) error

RemoveFromDB removes the entry from the DB for the given key

func (*Driver) RemoveFromDBIfPending

func (driver *Driver) RemoveFromDBIfPending(key string) error

RemoveFromDBIfPending checks if the entry has value as "PENDING" for the given key. If yes, then removes the entry from the DB, else do nothing.

func (*Driver) RemoveStorageProvider

func (driver *Driver) RemoveStorageProvider(credentials *storageprovider.Credentials)

RemoveStorageProvider removes a storage provider from the driver

func (*Driver) ScrubEphemeralPods added in v1.2.0

func (driver *Driver) ScrubEphemeralPods(podsDirPath string) error

ScrubEphemeralPods to cleanup the orphan/stale ephemeral volumes and its associated staged devices

func (*Driver) ScrubberTask added in v1.2.0

func (driver *Driver) ScrubberTask(t time.Time, podsDirPath string) error

ScrubberTask executes the scrubber function

func (*Driver) Start

func (driver *Driver) Start(nodeService bool) error

Start starts the gRPC server

func (*Driver) StartScrubber added in v1.2.0

func (driver *Driver) StartScrubber(nodeService bool) chan bool

StartScrubber starts the scrubber period task

func (*Driver) Stop

func (driver *Driver) Stop(nodeService bool) error

Stop stops the gRPC server

func (*Driver) StopScrubber added in v1.2.0

func (driver *Driver) StopScrubber(nodeService bool, chanDone chan<- bool) error

StopScrubber stops the scrubber period task

func (*Driver) UpdateDB

func (driver *Driver) UpdateDB(key string, value interface{}) error

UpdateDB overwrites the entry in the DB with the given key-value pair

func (*Driver) ValidateAndGetVolumeAccessType

func (driver *Driver) ValidateAndGetVolumeAccessType(volCaps []*csi.VolumeCapability) (model.VolumeAccessType, error)

ValidateAndGetVolumeAccessType from the list of requested volume capabilities.

func (*Driver) ValidateVolumeCapabilities

func (driver *Driver) ValidateVolumeCapabilities(ctx context.Context, request *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)

ValidateVolumeCapabilities ...

A Controller Plugin MUST implement this RPC call. This RPC will be called by the CO to check if a pre-provisioned volume has all the capabilities that the CO wants. This RPC call SHALL return confirmed only if all the volume capabilities specified in the request are supported (see caveat below). This operation MUST be idempotent.

NOTE: Older plugins will parse but likely not "process" newer fields that MAY be present in capability-validation messages (and sub-messages) sent by a CO that is communicating using a newer, backwards-compatible version of the CSI protobufs. Therefore, the CO SHALL reconcile successful capability-validation responses by comparing the validated capabilities with those that it had originally requested. nolint: gocyclo

type Ephemeral added in v1.2.0

type Ephemeral struct {
	VolumeID     string  `json:"volume_id"`            // Volume ID
	VolumeHandle string  `json:"volume_handle"`        // ephemeral volume handle
	PodData      *POD    `json:"pod_data,omitempty"`   // POD info of ephemeral volume
	SecretRef    *Secret `json:"secret_ref,omitempty"` // secret reference for ephemeral volume
}

Ephemeral represents the ephemeral inline volume and its associated pod details.

type Mount

type Mount struct {
	MountPoint        string                `json:"mount_point"` // Mounted directory
	MountOptions      []string              `json:"mount_options,omitempty"`
	FilesystemOptions *model.FilesystemOpts `json:"filesystem_options,omitempty"`
}

Mount :

type NonBlockingGRPCServer

type NonBlockingGRPCServer interface {
	// Start services at the endpoint
	Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer)
	// Stops the service gracefully
	GracefulStop()
	// Stops the service forcefully
	Stop()
}

NonBlockingGRPCServer defines the non-blocking gRPC server interfaces

func NewNonBlockingGRPCServer

func NewNonBlockingGRPCServer() NonBlockingGRPCServer

NewNonBlockingGRPCServer returns a non-blocking gRPC server

type POD

type POD struct {
	UID       string `json:"uid"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

POD represents the pod information of ephemeral inline volume that is stored in the publish area

type Secret

type Secret struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

Secret represents the secret information of ephemeral inline volumes (Provided via volume attributes)

type StagingDevice

type StagingDevice struct {
	VolumeID         string                 `json:"volume_id"`
	VolumeAccessMode model.VolumeAccessType `json:"volume_access_mode"` // block or mount
	Device           *model.Device          `json:"device"`
	MountInfo        *Mount                 `json:"mount_info,omitempty"`
}

StagingDevice represents the device information that is stored in the staging area.

type VolumeHandleTargetPath added in v1.2.0

type VolumeHandleTargetPath struct {
	VolumeHandle string `json:"volume_handle"` // ephemeral volume handle
	TargetPath   string `json:"target_path"`   // target path of ephemeral volume
}

VolumeHandleTargetPath represents ephemeral volume handle and its assocatiate node stage/publish target path

Jump to

Keyboard shortcuts

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