Documentation ¶
Index ¶
- Constants
- func BytesToGbRoundDown(bytes int64) int64
- func BytesToGbRoundUp(bytes int64) int64
- func ConvertLabelsStringToMap(labels string) (map[string]string, error)
- func CreateNodeID(project, zone, name string) string
- func CreateZonalVolumeID(project, zone, name string) string
- func GbToBytes(Gb int64) int64
- func GenerateUnderspecifiedVolumeID(diskName string, isZonal bool) string
- func GetDeviceName(volKey *meta.Key) (string, error)
- func GetRegionFromZones(zones []string) (string, error)
- func KeyToVolumeID(volKey *meta.Key, project string) (string, error)
- func NodeIDToZoneAndName(id string) (string, string, error)
- func ProcessStorageLocations(storageLocations string) ([]string, error)
- func SnapshotIDToProjectKey(id string) (string, string, string, error)
- func ValidateSnapshotType(snapshotType string) error
- func VolumeIDToKey(id string) (string, *meta.Key, error)
- type DiskParameters
- type SnapshotParameters
- type VolumeLocks
Constants ¶
const ( // Keys for Topology. This key will be shared amongst drivers from GCP TopologyKeyZone = "topology.gke.io/zone" // VolumeAttributes for Partition VolumeAttributePartition = "partition" UnspecifiedValue = "UNSPECIFIED" )
const ( // Parameters for StorageClass ParameterKeyType = "type" ParameterKeyReplicationType = "replication-type" ParameterKeyDiskEncryptionKmsKey = "disk-encryption-kms-key" ParameterKeyLabels = "labels" // Parameters for VolumeSnapshotClass ParameterKeyStorageLocations = "storage-locations" ParameterKeySnapshotType = "snapshot-type" ParameterKeyImageFamily = "image-family" DiskSnapshotType = "snapshots" DiskImageType = "images" // Keys for PV and PVC parameters as reported by external-provisioner ParameterKeyPVCName = "csi.storage.k8s.io/pvc/name" ParameterKeyPVCNamespace = "csi.storage.k8s.io/pvc/namespace" ParameterKeyPVName = "csi.storage.k8s.io/pv/name" // Keys for Snapshot and SnapshotContent parameters as reported by external-snapshotter ParameterKeyVolumeSnapshotName = "csi.storage.k8s.io/volumesnapshot/name" ParameterKeyVolumeSnapshotNamespace = "csi.storage.k8s.io/volumesnapshot/namespace" ParameterKeyVolumeSnapshotContentName = "csi.storage.k8s.io/volumesnapshotcontent/name" )
const (
VolumeOperationAlreadyExistsFmt = "An operation with the given Volume ID %s already exists"
)
Variables ¶
This section is empty.
Functions ¶
func BytesToGbRoundDown ¶ added in v1.0.3
func BytesToGbRoundUp ¶ added in v1.0.3
func ConvertLabelsStringToMap ¶ added in v1.0.3
ConvertLabelsStringToMap converts the labels from string to map example: "key1=value1,key2=value2" gets converted into {"key1": "value1", "key2": "value2"} See https://cloud.google.com/compute/docs/labeling-resources#label_format for details.
func CreateNodeID ¶
func CreateZonalVolumeID ¶ added in v0.6.0
func GetRegionFromZones ¶
func KeyToVolumeID ¶ added in v0.6.0
func ProcessStorageLocations ¶ added in v1.0.3
ProcessStorageLocations trims and normalizes storage location to lower letters.
func SnapshotIDToProjectKey ¶ added in v1.0.3
func ValidateSnapshotType ¶ added in v1.5.0
ValidateSnapshotType validates the type
Types ¶
type DiskParameters ¶ added in v0.7.0
type DiskParameters struct { // Values: pd-standard, pd-balanced, pd-ssd, or any other PD disk type. Not validated. // Default: pd-standard DiskType string // Values: "none", regional-pd // Default: "none" ReplicationType string // Values: {string} // Default: "" DiskEncryptionKMSKey string // Values: {map[string]string} // Default: "" Tags map[string]string // Values: {map[string]string} // Default: "" Labels map[string]string }
DiskParameters contains normalized and defaulted disk parameters
func ExtractAndDefaultParameters ¶ added in v0.7.0
func ExtractAndDefaultParameters(parameters map[string]string, driverName string, extraVolumeLabels map[string]string) (DiskParameters, error)
ExtractAndDefaultParameters will take the relevant parameters from a map and put them into a well defined struct making sure to default unspecified fields. extraVolumeLabels are added as labels; if there are also labels specified in parameters, any matching extraVolumeLabels will be overridden.
type SnapshotParameters ¶ added in v1.0.3
type SnapshotParameters struct { StorageLocations []string SnapshotType string ImageFamily string Tags map[string]string }
SnapshotParameters contains normalized and defaulted parameters for snapshots
func ExtractAndDefaultSnapshotParameters ¶ added in v1.0.3
func ExtractAndDefaultSnapshotParameters(parameters map[string]string, driverName string) (SnapshotParameters, error)
type VolumeLocks ¶ added in v0.6.0
type VolumeLocks struct {
// contains filtered or unexported fields
}
VolumeLocks implements a map with atomic operations. It stores a set of all volume IDs with an ongoing operation.
func NewVolumeLocks ¶ added in v0.6.0
func NewVolumeLocks() *VolumeLocks
func (*VolumeLocks) Release ¶ added in v0.6.0
func (vl *VolumeLocks) Release(volumeID string)
func (*VolumeLocks) TryAcquire ¶ added in v0.6.0
func (vl *VolumeLocks) TryAcquire(volumeID string) bool
TryAcquire tries to acquire the lock for operating on volumeID and returns true if successful. If another operation is already using volumeID, returns false.