Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: append help link when there is mount error #822

Merged
merged 1 commit into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/blob/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ type DriverOptions struct {
AllowInlineVolumeKeyAccessWithIdentity bool
EnableGetVolumeStats bool
AppendTimeStampInCacheDir bool
AppendMountErrorHelpLink bool
MountPermissions uint64
KubeAPIQPS float64
KubeAPIBurst int
Expand All @@ -173,6 +174,7 @@ type Driver struct {
enableGetVolumeStats bool
allowInlineVolumeKeyAccessWithIdentity bool
appendTimeStampInCacheDir bool
appendMountErrorHelpLink bool
blobfuseProxyConnTimout int
mountPermissions uint64
kubeAPIQPS float64
Expand Down Expand Up @@ -210,6 +212,7 @@ func NewDriver(options *DriverOptions) *Driver {
enableBlobMockMount: options.EnableBlobMockMount,
allowEmptyCloudConfig: options.AllowEmptyCloudConfig,
enableGetVolumeStats: options.EnableGetVolumeStats,
appendMountErrorHelpLink: options.AppendMountErrorHelpLink,
mountPermissions: options.MountPermissions,
kubeAPIQPS: options.KubeAPIQPS,
kubeAPIBurst: options.KubeAPIBurst,
Expand Down
12 changes: 10 additions & 2 deletions pkg/blob/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,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, d.mounter.MountSensitive(source, targetPath, NFS, mountOptions, []string{})
}); err != nil {
return nil, status.Error(codes.Internal, fmt.Sprintf("volume(%s) mount %q on %q failed with %v", volumeID, source, targetPath, err))
var helpLinkMsg string
if d.appendMountErrorHelpLink {
helpLinkMsg = fmt.Sprintf("\nPlease refer to http://aka.ms/blobmounterror for possible causes and solutions for mount errors.")
}
return nil, status.Error(codes.Internal, fmt.Sprintf("volume(%s) mount %q on %q failed with %v%s", volumeID, source, targetPath, err, helpLinkMsg))
}

if performChmodOp {
Expand Down Expand Up @@ -367,7 +371,11 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
}

if err != nil {
err = status.Errorf(codes.Internal, "Mount failed with error: %v, output: %v", err, output)
var helpLinkMsg string
if d.appendMountErrorHelpLink {
helpLinkMsg = fmt.Sprintf("\nPlease refer to http://aka.ms/blobmounterror for possible causes and solutions for mount errors.")
}
err = status.Errorf(codes.Internal, "Mount failed with error: %v, output: %v%s", err, output, helpLinkMsg)
klog.Errorf("%v", err)
notMnt, mntErr := d.mounter.IsLikelyNotMountPoint(targetPath)
if mntErr != nil {
Expand Down
2 changes: 2 additions & 0 deletions pkg/blobplugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var (
allowInlineVolumeKeyAccessWithIdentity = flag.Bool("allow-inline-volume-key-access-with-idenitity", false, "allow accessing storage account key using cluster identity for inline volume")
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() {
Expand Down Expand Up @@ -93,6 +94,7 @@ func handle() {
AppendTimeStampInCacheDir: *appendTimeStampInCacheDir,
MountPermissions: *mountPermissions,
AllowInlineVolumeKeyAccessWithIdentity: *allowInlineVolumeKeyAccessWithIdentity,
AppendMountErrorHelpLink: *appendMountErrorHelpLink,
KubeAPIQPS: *kubeAPIQPS,
KubeAPIBurst: *kubeAPIBurst,
}
Expand Down