Documentation ¶
Index ¶
- func CreateValidDiskName(volumeName string) string
- func GenerateCSISnapshot(sourceVolumeID string, snapshot *compute.Snapshot) (*csi.Snapshot, error)
- func GetAttachDiskInitialDelay(attributes map[string]string) int
- func GetCachingMode(attributes map[string]string) (compute.CachingTypes, error)
- func GetCloudProvider(ctx context.Context, kubeConfig, secretName, secretNamespace, userAgent string, ...) (*azure.Cloud, error)
- func GetCloudProviderFromClient(ctx context.Context, kubeClient *clientset.Clientset, ...) (*azure.Cloud, error)
- func GetDiskLUN(deviceInfo string) (int32, error)
- func GetDiskName(diskURI string) (string, error)
- func GetEntriesAndNextToken(req *csi.ListSnapshotsRequest, snapshots []compute.Snapshot) (*csi.ListSnapshotsResponse, error)
- func GetFStype(attributes map[string]string) string
- func GetKubeClient(kubeconfig string) (*clientset.Clientset, error)
- func GetKubeConfig(kubeconfig string) (config *rest.Config, err error)
- func GetMaxShares(attributes map[string]string) (int, error)
- func GetResourceGroupFromURI(diskURI string) (string, error)
- func GetSnapshotNameFromURI(snapshotURI string) (string, error)
- func GetSourceVolumeID(snapshot *compute.Snapshot) string
- func GetSubscriptionIDFromURI(diskURI string) string
- func GetValidCreationData(subscriptionID, resourceGroup, sourceResourceID, sourceType string) (compute.CreationData, error)
- func InsertDiskProperties(disk *compute.Disk, publishConext map[string]string)
- func IsARMResourceID(resourceID string) bool
- func IsAzureStackCloud(cloud string, disableAzureStackCloud bool) bool
- func IsCorruptedDir(dir string) bool
- func IsValidAccessModes(volCaps []*csi.VolumeCapability) bool
- func IsValidAvailabilityZone(zone, region string) bool
- func IsValidDiskURI(diskURI string) error
- func IsValidVolumeCapabilities(volCaps []*csi.VolumeCapability, maxShares int) bool
- func NormalizeCachingMode(cachingMode v1.AzureDataDiskCachingMode) (v1.AzureDataDiskCachingMode, error)
- func NormalizeNetworkAccessPolicy(networkAccessPolicy string) (compute.NetworkAccessPolicy, error)
- func NormalizeStorageAccountType(storageAccountType, cloud string, disableAzureStackCloud bool) (compute.DiskStorageAccountTypes, error)
- func PickAvailabilityZone(requirement *csi.TopologyRequirement, region, topologyKey string) string
- func SetKeyValueInMap(m map[string]string, key, value string)
- func SleepIfThrottled(err error, sleepSec int)
- func ValidateDataAccessAuthMode(dataAccessAuthMode string) error
- func ValidateDiskEncryptionType(encryptionType string) error
- type FakeHostUtil
- type IOHandler
- type ManagedDiskParameters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateValidDiskName ¶
Disk name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens. See https://docs.microsoft.com/en-us/rest/api/compute/disks/createorupdate#uri-parameters
Snapshot name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens. See https://docs.microsoft.com/en-us/rest/api/compute/snapshots/createorupdate#uri-parameters
Since the naming rule of disk is same with snapshot's, here we use the same function to handle disks and snapshots.
func GenerateCSISnapshot ¶
func GetAttachDiskInitialDelay ¶ added in v1.26.5
GetAttachDiskInitialDelay gttachDiskInitialDelay from attributes return -1 if not found
func GetCachingMode ¶
func GetCachingMode(attributes map[string]string) (compute.CachingTypes, error)
func GetCloudProvider ¶
func GetCloudProvider(ctx context.Context, kubeConfig, secretName, secretNamespace, userAgent string, allowEmptyCloudConfig bool) (*azure.Cloud, error)
GetCloudProviderFromConfig get Azure Cloud Provider
func GetCloudProviderFromClient ¶ added in v1.9.0
func GetCloudProviderFromClient(ctx context.Context, kubeClient *clientset.Clientset, secretName, secretNamespace, userAgent string, allowEmptyCloudConfig bool) (*azure.Cloud, error)
GetCloudProviderFromClient get Azure Cloud Provider
func GetDiskLUN ¶
GetDiskLUN : deviceInfo could be a LUN number or a device path, e.g. /dev/disk/azure/scsi1/lun2
func GetDiskName ¶
func GetEntriesAndNextToken ¶
func GetEntriesAndNextToken(req *csi.ListSnapshotsRequest, snapshots []compute.Snapshot) (*csi.ListSnapshotsResponse, error)
There are 4 scenarios for listing snapshots. 1. StartingToken is null, and MaxEntries is null. Return all snapshots from zero. 2. StartingToken is null, and MaxEntries is not null. Return `MaxEntries` snapshots from zero. 3. StartingToken is not null, and MaxEntries is null. Return all snapshots from `StartingToken`. 4. StartingToken is not null, and MaxEntries is not null. Return `MaxEntries` snapshots from `StartingToken`.
func GetKubeClient ¶ added in v1.9.0
func GetKubeConfig ¶ added in v1.9.0
GetKubeConfig gets config object from config file
func GetResourceGroupFromURI ¶
func GetSnapshotNameFromURI ¶
func GetSourceVolumeID ¶
func GetSubscriptionIDFromURI ¶ added in v1.11.0
func GetValidCreationData ¶
func GetValidCreationData(subscriptionID, resourceGroup, sourceResourceID, sourceType string) (compute.CreationData, error)
func InsertDiskProperties ¶
InsertDiskProperties: insert disk properties to map
func IsARMResourceID ¶
IsARMResourceID check whether resourceID is an ARM ResourceID
func IsAzureStackCloud ¶
IsAzureStackCloud decides whether the driver is running on Azure Stack Cloud.
func IsCorruptedDir ¶
func IsValidAccessModes ¶ added in v1.11.0
func IsValidAccessModes(volCaps []*csi.VolumeCapability) bool
func IsValidAvailabilityZone ¶
IsValidAvailabilityZone returns true if the zone is in format of <region>-<zone-id>.
func IsValidDiskURI ¶
func IsValidVolumeCapabilities ¶
func IsValidVolumeCapabilities(volCaps []*csi.VolumeCapability, maxShares int) bool
func NormalizeCachingMode ¶
func NormalizeCachingMode(cachingMode v1.AzureDataDiskCachingMode) (v1.AzureDataDiskCachingMode, error)
func NormalizeNetworkAccessPolicy ¶
func NormalizeNetworkAccessPolicy(networkAccessPolicy string) (compute.NetworkAccessPolicy, error)
func NormalizeStorageAccountType ¶
func NormalizeStorageAccountType(storageAccountType, cloud string, disableAzureStackCloud bool) (compute.DiskStorageAccountTypes, error)
func PickAvailabilityZone ¶
func PickAvailabilityZone(requirement *csi.TopologyRequirement, region, topologyKey string) string
PickAvailabilityZone selects 1 zone given topology requirement. if not found or topology requirement is not zone format, empty string is returned.
func SetKeyValueInMap ¶ added in v1.26.3
SetKeyValueInMap set key/value pair in map key in the map is case insensitive, if key already exists, overwrite existing value
func SleepIfThrottled ¶ added in v1.9.0
func ValidateDataAccessAuthMode ¶ added in v1.26.3
func ValidateDiskEncryptionType ¶ added in v1.18.0
Types ¶
type FakeHostUtil ¶
type FakeHostUtil struct {
// contains filtered or unexported fields
}
func NewFakeHostUtil ¶
func NewFakeHostUtil() *FakeHostUtil
NewFakeHostUtil returns a FakeHostUtil object suitable for use in unit tests.
func (*FakeHostUtil) PathIsDevice ¶
func (f *FakeHostUtil) PathIsDevice(path string) (bool, error)
PathIsDevice return whether the path references a block device.
func (*FakeHostUtil) SetPathIsDeviceResult ¶
func (f *FakeHostUtil) SetPathIsDeviceResult(path string, isDevice bool, err error)
SetPathIsDeviceResult set the result of calling IsBlockDevicePath for the specified path.
type IOHandler ¶
type IOHandler interface { ReadDir(dirname string) ([]os.FileInfo, error) WriteFile(filename string, data []byte, perm os.FileMode) error Readlink(name string) (string, error) ReadFile(filename string) ([]byte, error) }
func NewFakeIOHandler ¶
func NewFakeIOHandler() IOHandler
func NewOSIOHandler ¶
func NewOSIOHandler() IOHandler
type ManagedDiskParameters ¶ added in v1.11.0
type ManagedDiskParameters struct { AccountType string CachingMode v1.AzureDataDiskCachingMode DeviceSettings map[string]string DiskAccessID string DiskEncryptionSetID string DiskEncryptionType string DiskIOPSReadWrite string DiskMBPSReadWrite string DiskName string EnableAsyncAttach *bool EnableBursting *bool FsType string Location string LogicalSectorSize int NetworkAccessPolicy string PerfProfile string SubscriptionID string ResourceGroup string Tags map[string]string UserAgent string VolumeContext map[string]string WriteAcceleratorEnabled string Zoned string }
func ParseDiskParameters ¶ added in v1.11.0
func ParseDiskParameters(parameters map[string]string) (ManagedDiskParameters, error)