Documentation
¶
Index ¶
- Constants
- Variables
- func GetCloudProvider(ctx context.Context, kubeClient kubernetes.Interface, ...) (*storage.AccountRepo, error)
- func GetContainerInfo(id string) (string, string, string, string, string, error)
- func GetUserAgent(driverName, customUserAgent, userAgentSuffix string) string
- func GetVersionYAML(driverName string) (string, error)
- func IsAzureStackCloud(cloud *storage.AccountRepo) bool
- func IsCorruptedDir(dir string) bool
- type Driver
- func (d *Driver) ControllerExpandVolume(_ context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)
- func (d *Driver) ControllerGetCapabilities(_ context.Context, _ *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)
- func (d *Driver) ControllerGetVolume(context.Context, *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error)
- func (d *Driver) ControllerModifyVolume(_ context.Context, _ *csi.ControllerModifyVolumeRequest) (*csi.ControllerModifyVolumeResponse, error)
- func (d *Driver) ControllerPublishVolume(_ context.Context, _ *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error)
- func (d *Driver) ControllerUnpublishVolume(_ context.Context, _ *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error)
- func (d *Driver) CreateBlobContainer(ctx context.Context, ...) error
- func (d *Driver) CreateSnapshot(_ context.Context, _ *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error)
- func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)
- func (d *Driver) DeleteBlobContainer(ctx context.Context, ...) error
- func (d *Driver) DeleteSnapshot(_ context.Context, _ *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error)
- func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)
- func (d *Driver) GetAuthEnv(ctx context.Context, volumeID, protocol string, ...) (string, string, string, string, []string, error)
- func (d *Driver) GetCapacity(_ context.Context, _ *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)
- func (d *Driver) GetInfoFromSecret(ctx context.Context, secretName, secretNamespace string) (string, string, string, string, string, string, string, error)
- func (f *Driver) GetPluginCapabilities(_ context.Context, _ *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
- func (f *Driver) GetPluginInfo(_ context.Context, _ *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
- func (d *Driver) GetStorageAccesskey(ctx context.Context, accountOptions *storage.AccountOptions, ...) (string, string, error)
- func (d *Driver) GetStorageAccesskeyWithSubsID(ctx context.Context, subsID, account, resourceGroup string, ...) (string, error)
- func (d *Driver) GetStorageAccountAndContainer(ctx context.Context, volumeID string, attrib, secrets map[string]string) (string, string, string, string, error)
- func (d *Driver) ListSnapshots(_ context.Context, _ *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)
- func (d *Driver) ListVolumes(_ context.Context, _ *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)
- func (d *Driver) NodeExpandVolume(_ context.Context, _ *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
- func (d *Driver) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
- func (d *Driver) NodeGetInfo(_ context.Context, _ *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
- func (d *Driver) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
- func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
- func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)
- func (d *Driver) NodeUnpublishVolume(_ context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
- func (d *Driver) NodeUnstageVolume(_ context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)
- func (f *Driver) Probe(_ context.Context, _ *csi.ProbeRequest) (*csi.ProbeResponse, error)
- func (d *Driver) Run(ctx context.Context, endpoint string) error
- func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)
- type DriverOptions
- type MountClient
- type VersionInfo
Constants ¶
const ( // DefaultDriverName holds the name of the csi-driver DefaultDriverName = "blob.csi.azure.com" Fuse = "fuse" Fuse2 = "fuse2" NFS = "nfs" AZNFS = "aznfs" NFSv3 = "nfsv3" VolumeID = "volumeid" FSGroupChangeNone = "None" DefaultTokenAudience = "api://AzureADTokenExchange" //nolint:gosec // G101 ignore this! )
const ( MSI = "MSI" SPN = "SPN" )
Variables ¶
var ( DefaultAzureCredentialFileEnv = "AZURE_CREDENTIAL_FILE" DefaultCredFilePath = "/etc/kubernetes/azure.json" )
Functions ¶
func GetCloudProvider ¶
func GetCloudProvider(ctx context.Context, kubeClient kubernetes.Interface, nodeID, secretName, secretNamespace, userAgent string, allowEmptyCloudConfig bool) (*storage.AccountRepo, error)
getCloudProvider get Azure Cloud Provider
func GetContainerInfo ¶
GetContainerInfo get container info according to volume id the format of VolumeId is: rg#accountName#containerName#uuid#secretNamespace#subsID
e.g. input: "rg#f5713de20cde511e8ba4900#containerName#uuid#" output: rg, f5713de20cde511e8ba4900, containerName, "" , "" input: "rg#f5713de20cde511e8ba4900#containerName#uuid#namespace#" output: rg, f5713de20cde511e8ba4900, containerName, namespace, "" input: "rg#f5713de20cde511e8ba4900#containerName#uuid#namespace#subsID" output: rg, f5713de20cde511e8ba4900, containerName, namespace, subsID
func GetUserAgent ¶ added in v1.5.0
GetUserAgent returns user agent of the driver
func GetVersionYAML ¶
GetVersionYAML returns the version information of the driver in YAML format
func IsAzureStackCloud ¶ added in v0.11.0
func IsAzureStackCloud(cloud *storage.AccountRepo) bool
IsAzureStackCloud decides whether the driver is running on Azure Stack Cloud.
func IsCorruptedDir ¶
Types ¶
type Driver ¶
type Driver struct {
csicommon.CSIDriver
// Embed UnimplementedXXXServer to ensure the driver returns Unimplemented for any
// new RPC methods that might be introduced in future versions of the spec.
csi.UnimplementedControllerServer
csi.UnimplementedIdentityServer
csi.UnimplementedNodeServer
KubeClient kubernetes.Interface
// contains filtered or unexported fields
}
Driver implements all interfaces of CSI drivers
func NewDriver ¶
func NewDriver(options *DriverOptions, kubeClient kubernetes.Interface, cloud *storage.AccountRepo) *Driver
NewDriver Creates a NewCSIDriver object. Assumes vendor version is equal to driver version & does not support optional driver plugin info manifest field. Refer to CSI spec for more details.
func (*Driver) ControllerExpandVolume ¶
func (d *Driver) ControllerExpandVolume(_ context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)
ControllerExpandVolume controller expand volume
func (*Driver) ControllerGetCapabilities ¶
func (d *Driver) ControllerGetCapabilities(_ context.Context, _ *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)
ControllerGetCapabilities returns the capabilities of the Controller plugin
func (*Driver) ControllerGetVolume ¶ added in v0.11.0
func (d *Driver) ControllerGetVolume(context.Context, *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error)
ControllerGetVolume get volume
func (*Driver) ControllerModifyVolume ¶ added in v1.25.0
func (d *Driver) ControllerModifyVolume(_ context.Context, _ *csi.ControllerModifyVolumeRequest) (*csi.ControllerModifyVolumeResponse, error)
ControllerModifyVolume modify volume
func (*Driver) ControllerPublishVolume ¶
func (d *Driver) ControllerPublishVolume(_ context.Context, _ *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error)
func (*Driver) ControllerUnpublishVolume ¶
func (d *Driver) ControllerUnpublishVolume(_ context.Context, _ *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error)
func (*Driver) CreateBlobContainer ¶ added in v1.13.0
func (d *Driver) CreateBlobContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName, storageEndpointSuffix string, secrets map[string]string) error
CreateBlobContainer creates a blob container
func (*Driver) CreateSnapshot ¶
func (d *Driver) CreateSnapshot(_ context.Context, _ *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error)
CreateSnapshot create snapshot
func (*Driver) CreateVolume ¶
func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)
CreateVolume provisions a volume
func (*Driver) DeleteBlobContainer ¶ added in v1.13.0
func (d *Driver) DeleteBlobContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string, secrets map[string]string) error
DeleteBlobContainer deletes a blob container
func (*Driver) DeleteSnapshot ¶
func (d *Driver) DeleteSnapshot(_ context.Context, _ *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error)
DeleteSnapshot delete snapshot
func (*Driver) DeleteVolume ¶
func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)
DeleteVolume delete a volume
func (*Driver) GetAuthEnv ¶
func (d *Driver) GetAuthEnv(ctx context.Context, volumeID, protocol string, attrib, secrets map[string]string) (string, string, string, string, []string, error)
GetAuthEnv return <accountName, containerName, authEnv, error>
func (*Driver) GetCapacity ¶
func (d *Driver) GetCapacity(_ context.Context, _ *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)
GetCapacity returns the capacity of the total available storage pool
func (*Driver) GetInfoFromSecret ¶ added in v1.20.2
func (d *Driver) GetInfoFromSecret(ctx context.Context, secretName, secretNamespace string) (string, string, string, string, string, string, string, error)
GetInfoFromSecret get info from k8s secret return <accountName, accountKey, accountSasToken, msiSecret, spnClientSecret, spnClientID, spnTenantID, error>
func (*Driver) GetPluginCapabilities ¶
func (f *Driver) GetPluginCapabilities(_ context.Context, _ *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
GetPluginCapabilities returns the capabilities of the plugin
func (*Driver) GetPluginInfo ¶
func (f *Driver) GetPluginInfo(_ context.Context, _ *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
GetPluginInfo return the version and name of the plugin
func (*Driver) GetStorageAccesskey ¶ added in v0.9.0
func (d *Driver) GetStorageAccesskey(ctx context.Context, accountOptions *storage.AccountOptions, secrets map[string]string, secretName, secretNamespace string) (string, string, error)
GetStorageAccesskey get Azure storage account key from
- secrets (if not empty)
- use k8s client identity to read from k8s secret
- use cluster identity to get from storage account directly
func (*Driver) GetStorageAccesskeyWithSubsID ¶ added in v1.26.0
func (d *Driver) GetStorageAccesskeyWithSubsID(ctx context.Context, subsID, account, resourceGroup string, getLatestAccountKey bool) (string, error)
GetStorageAccesskeyWithSubsID get Azure storage account key from storage account directly
func (*Driver) GetStorageAccountAndContainer ¶
func (d *Driver) GetStorageAccountAndContainer(ctx context.Context, volumeID string, attrib, secrets map[string]string) (string, string, string, string, error)
GetStorageAccountAndContainer get storage account and container info returns <accountName, accountKey, accountSasToken, containerName> only for e2e testing
func (*Driver) ListSnapshots ¶
func (d *Driver) ListSnapshots(_ context.Context, _ *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)
ListSnapshots list snapshots
func (*Driver) ListVolumes ¶
func (d *Driver) ListVolumes(_ context.Context, _ *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)
ListVolumes return all available volumes
func (*Driver) NodeExpandVolume ¶
func (d *Driver) NodeExpandVolume(_ context.Context, _ *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
NodeExpandVolume node expand volume
func (*Driver) NodeGetCapabilities ¶
func (d *Driver) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
NodeGetCapabilities return the capabilities of the Node plugin
func (*Driver) NodeGetInfo ¶
func (d *Driver) NodeGetInfo(_ context.Context, _ *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
NodeGetInfo return info of the node on which this plugin is running
func (*Driver) NodeGetVolumeStats ¶
func (d *Driver) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
NodeGetVolumeStats get volume stats
func (*Driver) NodePublishVolume ¶
func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
NodePublishVolume mount the volume from staging to target path
func (*Driver) NodeStageVolume ¶
func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)
NodeStageVolume mount the volume to a staging path
func (*Driver) NodeUnpublishVolume ¶
func (d *Driver) NodeUnpublishVolume(_ context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
NodeUnpublishVolume unmount the volume from the target path
func (*Driver) NodeUnstageVolume ¶
func (d *Driver) NodeUnstageVolume(_ context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)
NodeUnstageVolume unmount the volume from the staging path
func (*Driver) Probe ¶
func (f *Driver) Probe(_ context.Context, _ *csi.ProbeRequest) (*csi.ProbeResponse, error)
Probe check whether the plugin is running or not. This method does not need to return anything. Currently the spec does not dictate what you should return either. Hence, return an empty response
func (*Driver) ValidateVolumeCapabilities ¶
func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)
ValidateVolumeCapabilities return the capabilities of the volume
type DriverOptions ¶ added in v1.4.0
type DriverOptions struct {
NodeID string
DriverName string
BlobfuseProxyEndpoint string
EnableBlobfuseProxy bool
BlobfuseProxyConnTimout int
EnableBlobMockMount bool
AllowInlineVolumeKeyAccessWithIdentity bool
EnableGetVolumeStats bool
AppendTimeStampInCacheDir bool
AppendMountErrorHelpLink bool
MountPermissions uint64
EnableAznfsMount bool
VolStatsCacheExpireInMinutes int
SasTokenExpirationMinutes int
WaitForAzCopyTimeoutMinutes int
EnableVolumeMountGroup bool
FSGroupChangePolicy string
}
DriverOptions defines driver parameters specified in driver deployment
func (*DriverOptions) AddFlags ¶ added in v1.23.3
func (option *DriverOptions) AddFlags()
type MountClient ¶ added in v1.1.0
type MountClient struct {
// contains filtered or unexported fields
}
func NewMountClient ¶ added in v1.1.0
func NewMountClient(cc *grpc.ClientConn) *MountClient
NewMountClient returns a new mount client
type VersionInfo ¶
type VersionInfo struct {
DriverName string `json:"Driver Name"`
DriverVersion string `json:"Driver Version"`
GitCommit string `json:"Git Commit"`
BuildDate string `json:"Build Date"`
GoVersion string `json:"Go Version"`
Compiler string `json:"Compiler"`
Platform string `json:"Platform"`
}
VersionInfo holds the version information of the driver
func GetVersion ¶
func GetVersion(driverName string) VersionInfo
GetVersion returns the version information of the driver