awslabs / mountpoint-s3-csi-driver

Built on Mountpoint for Amazon S3, the Mountpoint CSI driver presents an Amazon S3 bucket as a storage volume accessible by containers in your Kubernetes cluster.
Apache License 2.0
193 stars 23 forks source link

Add retry to reading `/proc/mounts` out of ListMounts() function #246

Open Shellmode opened 1 month ago

Shellmode commented 1 month ago

Issue #, if available: https://github.com/awslabs/mountpoint-s3-csi-driver/issues/174

Description of changes: Since it's unclear why the driver cannot read /host/proc/mounts (with Karpenter) at the first time, retry to read /host/proc/mounts will success. We've discussed in https://github.com/awslabs/mountpoint-s3-csi-driver/pull/229

Recently released v1.8 added retry in the ListMounts() function, however I tried the new release and got the same error message still cannot mount S3. I found that if ListMounts() function ever return a nil, error it won't work.

Just leave error handling in parseProcMounts() function and retry reading /proc/mounts by calling ListMounts() function from other function, which will work.

It may be somehow confusing about "retry", it may because other function/module refresh/restart which fix the issue (just like restart the pod).

Passed locally test image

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.