diff --git a/pkg/azurefile/azurefile.go b/pkg/azurefile/azurefile.go index eee1a79dcd..b888287019 100644 --- a/pkg/azurefile/azurefile.go +++ b/pkg/azurefile/azurefile.go @@ -192,6 +192,7 @@ type DriverOptions struct { AllowInlineVolumeKeyAccessWithIdentity bool EnableVHDDiskFeature bool EnableGetVolumeStats bool + AppendMountErrorHelpLink bool MountPermissions uint64 FSGroupChangePolicy string KubeAPIQPS float64 @@ -211,6 +212,7 @@ type Driver struct { allowInlineVolumeKeyAccessWithIdentity bool enableVHDDiskFeature bool enableGetVolumeStats bool + appendMountErrorHelpLink bool mountPermissions uint64 kubeAPIQPS float64 kubeAPIBurst int @@ -254,6 +256,7 @@ func NewDriver(options *DriverOptions) *Driver { driver.allowInlineVolumeKeyAccessWithIdentity = options.AllowInlineVolumeKeyAccessWithIdentity driver.enableVHDDiskFeature = options.EnableVHDDiskFeature driver.enableGetVolumeStats = options.EnableGetVolumeStats + driver.appendMountErrorHelpLink = options.AppendMountErrorHelpLink driver.mountPermissions = options.MountPermissions driver.fsGroupChangePolicy = options.FSGroupChangePolicy driver.kubeAPIQPS = options.KubeAPIQPS diff --git a/pkg/azurefile/nodeserver.go b/pkg/azurefile/nodeserver.go index 8633efa323..28a20c3779 100644 --- a/pkg/azurefile/nodeserver.go +++ b/pkg/azurefile/nodeserver.go @@ -318,7 +318,11 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe if err := wait.PollImmediate(1*time.Second, 2*time.Minute, func() (bool, error) { return true, SMBMount(d.mounter, source, cifsMountPath, mountFsType, mountOptions, sensitiveMountOptions) }); err != nil { - return nil, status.Error(codes.Internal, fmt.Sprintf("volume(%s) mount %s on %s failed with %v", volumeID, source, cifsMountPath, err)) + var helpLinkMsg string + if d.appendMountErrorHelpLink { + helpLinkMsg = fmt.Sprintf("\nPlease refer to http://aka.ms/filemounterror for possible causes and solutions for mount errors.") + } + return nil, status.Error(codes.Internal, fmt.Sprintf("volume(%s) mount %s on %s failed with %v%s", volumeID, source, cifsMountPath, err, helpLinkMsg)) } if protocol == nfs { if performChmodOp { diff --git a/pkg/azurefileplugin/main.go b/pkg/azurefileplugin/main.go index 19ae1e2ad7..146ee02a40 100644 --- a/pkg/azurefileplugin/main.go +++ b/pkg/azurefileplugin/main.go @@ -54,6 +54,7 @@ var ( enableVHDDiskFeature = flag.Bool("enable-vhd", true, "enable VHD disk feature (experimental)") kubeAPIQPS = flag.Float64("kube-api-qps", 25.0, "QPS to use while communicating with the kubernetes apiserver.") kubeAPIBurst = flag.Int("kube-api-burst", 50, "Burst to use while communicating with the kubernetes apiserver.") + appendMountErrorHelpLink = flag.Bool("append-mount-error-help-link", true, "Whether to include a link for help with mount errors when a mount error occurs.") ) func main() { @@ -91,6 +92,7 @@ func handle() { AllowInlineVolumeKeyAccessWithIdentity: *allowInlineVolumeKeyAccessWithIdentity, FSGroupChangePolicy: *fsGroupChangePolicy, EnableVHDDiskFeature: *enableVHDDiskFeature, + AppendMountErrorHelpLink: *appendMountErrorHelpLink, KubeAPIQPS: *kubeAPIQPS, KubeAPIBurst: *kubeAPIBurst, }