Documentation
¶
Index ¶
- Constants
- Variables
- func AwaitOperation(ctx context.Context, op *crusoeapi.Operation, projectID string, ...) (*crusoeapi.Operation, error)
- func CancellableSleep(ctx context.Context, duration time.Duration) error
- func GetAsyncOperationResult[T any](ctx context.Context, op *crusoeapi.Operation, projectID string, ...) (*T, *crusoeapi.Operation, error)
- func GetTopologyKey(pluginName, key string) string
- func OpResultToError(res interface{}) (expectedErr, unexpectedErr error)
- func RequestSizeToBytes(capacityRange *csi.CapacityRange) (int64, error)
- func RequestSizeToGiB(capacityRange *csi.CapacityRange) (int, error)
- func TrimPVCPrefix(pvcName string) string
- func UnpackSwaggerErr(original error) error
- type DiskType
- type OpResultErr
- type OpStatus
Constants ¶
View Source
const ( NumBytesInGiB = 1024 * 1024 * 1024 NumGiBInTiB = 1024 BlockSizeSSD = 4096 MinSSDSizeGiB = 1 MaxSSDSizeGiB = NumGiBInTiB * 10 SSDSizeIncrementGiB = 1 MinFSSizeGiB = NumGiBInTiB MaxFSSizeGiB = NumGiBInTiB * 1000 FSSizeIncrementGiB = NumGiBInTiB )
Numeric constants.
View Source
const ( TopologyLocationKey = "location" VolumeContextDiskSerialNumberKey = "csi.crusoe.ai/serial-number" VolumeContextDiskNameKey = "csi.crusoe.ai/disk-name" )
Map keys.
View Source
const ( SSDPluginName = "ssd.csi.crusoe.ai" SSDPluginVersion = "0.1.0" FSPluginName = "fs.csi.crusoe.ai" FSPluginVersion = "0.1.0" )
Plugin metadata.
View Source
const ( // OperationTimeout is the maximum time the Crusoe CSI driver will wait for an asynchronous operation to complete. OperationTimeout = 5 * time.Minute // MaxVolumesPerNode refers to the maximum number of disks that can be attached to a VM // ref: https://docs.crusoecloud.com/storage/disks/overview#persistent-disks MaxVolumesPerNode = 15 // MaxDiskNameLength refers to the maximum permissible length of a Crusoe disk name // ref: https://docs.crusoecloud.com/storage/disks/overview#persistent-disks MaxDiskNameLength = 63 )
Runtime options.
Variables ¶
View Source
var ( ErrNotImplemented = errors.New("not implemented") ErrTimeout = errors.New("timeout") )
View Source
var ( ErrUnableToGetOpRes = errors.New("failed to get result of operation") ErrUnexpectedOperationState = errors.New("unexpected operation state") ErrNoSizeRequested = errors.New("no disk size requested") )
View Source
var BaseControllerCapabilities = []*csi.ControllerServiceCapability{ { Type: &csi.ControllerServiceCapability_Rpc{ Rpc: &csi.ControllerServiceCapability_RPC{ Type: csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME, }, }, }, { Type: &csi.ControllerServiceCapability_Rpc{ Rpc: &csi.ControllerServiceCapability_RPC{ Type: csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME, }, }, }, { Type: &csi.ControllerServiceCapability_Rpc{ Rpc: &csi.ControllerServiceCapability_RPC{ Type: csi.ControllerServiceCapability_RPC_EXPAND_VOLUME, }, }, }, { Type: &csi.ControllerServiceCapability_Rpc{ Rpc: &csi.ControllerServiceCapability_RPC{ Type: csi.ControllerServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER, }, }, }, }
View Source
var BaseIdentityCapabilities = []*csi.PluginCapability{ { Type: &csi.PluginCapability_Service_{ Service: &csi.PluginCapability_Service{ Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS, }, }, }, }
View Source
var BaseNodeCapabilities = []*csi.NodeServiceCapability{ { Type: &csi.NodeServiceCapability_Rpc{ Rpc: &csi.NodeServiceCapability_RPC{ Type: csi.NodeServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER, }, }, }, }
View Source
var NodeCapabilityExpandVolume = csi.NodeServiceCapability{ Type: &csi.NodeServiceCapability_Rpc{ Rpc: &csi.NodeServiceCapability_RPC{ Type: csi.NodeServiceCapability_RPC_EXPAND_VOLUME, }, }, }
View Source
var PluginCapabilityControllerService = csi.PluginCapability{ Type: &csi.PluginCapability_Service_{ Service: &csi.PluginCapability_Service{ Type: csi.PluginCapability_Service_CONTROLLER_SERVICE, }, }, }
View Source
var PluginCapabilityVolumeExpansionOffline = csi.PluginCapability{ Type: &csi.PluginCapability_VolumeExpansion_{ VolumeExpansion: &csi.PluginCapability_VolumeExpansion{ Type: csi.PluginCapability_VolumeExpansion_OFFLINE, }, }, }
View Source
var PluginCapabilityVolumeExpansionOnline = csi.PluginCapability{ Type: &csi.PluginCapability_VolumeExpansion_{ VolumeExpansion: &csi.PluginCapability_VolumeExpansion{ Type: csi.PluginCapability_VolumeExpansion_ONLINE, }, }, }
Functions ¶
func AwaitOperation ¶
func AwaitOperation(ctx context.Context, op *crusoeapi.Operation, projectID string, getOp func(ctx context.Context, projectID string, operationID string) (crusoeapi.Operation, *http.Response, error), ) ( *crusoeapi.Operation, error, )
AwaitOperation polls an async API operation until it resolves into a success or failure state.
func GetAsyncOperationResult ¶
func GetTopologyKey ¶
func OpResultToError ¶
func OpResultToError(res interface{}) (expectedErr, unexpectedErr error)
func RequestSizeToBytes ¶
func RequestSizeToBytes(capacityRange *csi.CapacityRange) (int64, error)
func RequestSizeToGiB ¶
func RequestSizeToGiB(capacityRange *csi.CapacityRange) (int, error)
func TrimPVCPrefix ¶
func UnpackSwaggerErr ¶
UnpackSwaggerErr takes a swagger error and safely attempts to extract the additional information which is present in the response. The error is returned unchanged if it cannot be unpacked.
Types ¶
type OpResultErr ¶
Click to show internal directories.
Click to hide internal directories.