common

package
v1.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	ParameterKeyType                 = "type"
	ParameterKeyReplicationType      = "replication-type"
	ParameterKeyDiskEncryptionKmsKey = "disk-encryption-kms-key"

	// 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"
)
View Source
const (
	VolumeOperationAlreadyExistsFmt = "An operation with the given Volume ID %s already exists"
)

Variables

This section is empty.

Functions

func BytesToGb

func BytesToGb(bytes int64) int64

func CreateNodeID

func CreateNodeID(project, zone, name string) string

func CreateZonalVolumeID added in v0.6.0

func CreateZonalVolumeID(project, zone, name string) string

func GbToBytes

func GbToBytes(Gb int64) int64

func GenerateUnderspecifiedVolumeID

func GenerateUnderspecifiedVolumeID(diskName string, isZonal bool) string

func GetDeviceName

func GetDeviceName(volKey *meta.Key) (string, error)

func GetRegionFromZones

func GetRegionFromZones(zones []string) (string, error)

func KeyToVolumeID added in v0.6.0

func KeyToVolumeID(volKey *meta.Key, project string) (string, error)

func NodeIDToZoneAndName

func NodeIDToZoneAndName(id string) (string, string, error)

func SnapshotIDToKey

func SnapshotIDToKey(id string) (string, error)

func VolumeIDToKey

func VolumeIDToKey(id string) (*meta.Key, error)

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
}

DiskParameters contains normalized and defaulted disk parameters

func ExtractAndDefaultParameters added in v0.7.0

func ExtractAndDefaultParameters(parameters map[string]string, driverName 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

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.

Jump to

Keyboard shortcuts

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