Documentation ¶
Index ¶
- Constants
- func CreateValidDiskName(volumeName string) string
- func GenerateCSISnapshot(sourceVolumeID string, snapshot *armcompute.Snapshot) (*csi.Snapshot, error)
- func GetAttachDiskInitialDelay(attributes map[string]string) int
- func GetCachingMode(attributes map[string]string) (armcompute.CachingTypes, error)
- func GetCloudProviderFromClient(ctx context.Context, kubeClient clientset.Interface, ...) (*azure.Cloud, error)
- func GetDiskLUN(deviceInfo string) (int32, error)
- func GetDiskName(diskURI string) (string, error)
- func GetEntriesAndNextToken(req *csi.ListSnapshotsRequest, snapshots []*armcompute.Snapshot) (*csi.ListSnapshotsResponse, error)
- func GetFStype(attributes map[string]string) string
- func GetKubeClient(kubeconfig string) (clientset.Interface, error)
- func GetMaxShares(attributes map[string]string) (int, error)
- func GetResourceGroupFromURI(diskURI string) (string, error)
- func GetSnapshotNameFromURI(snapshotURI string) (string, error)
- func GetSourceVolumeID(snapshot *armcompute.Snapshot) string
- func GetSubscriptionIDFromURI(diskURI string) string
- func GetValidCreationData(subscriptionID, resourceGroup, sourceResourceID, sourceType string) (armcompute.CreationData, error)
- func InsertDiskProperties(disk *armcompute.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) error
- func NormalizeCachingMode(cachingMode v1.AzureDataDiskCachingMode) (v1.AzureDataDiskCachingMode, error)
- func NormalizeNetworkAccessPolicy(networkAccessPolicy string) (armcompute.NetworkAccessPolicy, error)
- func NormalizePublicNetworkAccess(publicNetworkAccess string) (armcompute.PublicNetworkAccess, error)
- func NormalizeStorageAccountType(storageAccountType, cloud string, disableAzureStackCloud bool) (armcompute.DiskStorageAccountTypes, error)
- func PickAvailabilityZone(requirement *csi.TopologyRequirement, region, topologyKey string) string
- func RunPowershellCmd(command string, envs ...string) ([]byte, error)
- func SetKeyValueInMap(m map[string]string, key, value string)
- func SleepIfThrottled(err error, defaultSleepSec int)
- func ValidateDataAccessAuthMode(dataAccessAuthMode string) error
- func ValidateDiskEncryptionType(encryptionType string) error
- type FakeHostUtil
- type IOHandler
- type ManagedDiskParameters
Constants ¶
const (
MaxPathLengthWindows = 260
)
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 GetCloudProviderFromClient ¶ added in v1.9.0
func GetCloudProviderFromClient(ctx context.Context, kubeClient clientset.Interface, secretName, secretNamespace, userAgent string, allowEmptyCloudConfig bool, enableTrafficMgr bool, trafficMgrPort int64) (*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 []*armcompute.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 GetResourceGroupFromURI ¶
func GetSnapshotNameFromURI ¶
func GetSourceVolumeID ¶
func GetSourceVolumeID(snapshot *armcompute.Snapshot) string
func GetSubscriptionIDFromURI ¶ added in v1.11.0
func GetValidCreationData ¶
func InsertDiskProperties ¶
InsertProperties: 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) error
IsValidVolumeCapabilities checks whether the volume capabilities are valid
func NormalizeCachingMode ¶
func NormalizeCachingMode(cachingMode v1.AzureDataDiskCachingMode) (v1.AzureDataDiskCachingMode, error)
func NormalizePublicNetworkAccess ¶ added in v1.28.0
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 RunPowershellCmd ¶ added in v1.28.0
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.DirEntry, 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 EnableBursting *bool PerformancePlus *bool FsType string Location string LogicalSectorSize int NetworkAccessPolicy string PublicNetworkAccess 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)