Skip to content

Commit

Permalink
Use mountpoint.Args in aws-s3-csi-mounter
Browse files Browse the repository at this point in the history
Signed-off-by: Burak Varlı <[email protected]>
  • Loading branch information
unexge committed Jan 20, 2025
1 parent c08000a commit c5af302
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cmd/aws-s3-csi-mounter/csimounter/csimounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"fmt"
"os"
"os/exec"
"slices"

"k8s.io/klog/v2"

"github.com/awslabs/aws-s3-csi-driver/pkg/mountpoint"
"github.com/awslabs/aws-s3-csi-driver/pkg/podmounter/mountoptions"
)

Expand Down Expand Up @@ -44,20 +44,17 @@ func Run(options Options) (int, error) {
return 0, fmt.Errorf("passed file descriptor %d is invalid", mountOptions.Fd)
}

args := mountOptions.Args
mountpointArgs := mountpoint.ParseArgs(mountOptions.Args)

// By default Mountpoint runs in a detached mode. Here we want to monitor it by relaying its output,
// and also we want to wait until it terminates. We're passing `--foreground` to achieve this.
const foreground, foregroundShort = "--foreground", "-f"
if !(slices.Contains(args, foreground) || slices.Contains(args, foregroundShort)) {
args = append(args, foreground)
}
mountpointArgs.Set(mountpoint.ArgForeground, mountpoint.ArgNoValue)

args = append([]string{
args := append([]string{
mountOptions.BucketName,
// We pass FUSE fd using `ExtraFiles`, and each entry becomes as file descriptor 3+i.
"/dev/fd/3",
}, args...)
}, mountpointArgs.SortedList()...)

cmd := exec.Command(options.MountpointPath, args...)
cmd.ExtraFiles = []*os.File{fuseDev}
Expand Down

0 comments on commit c5af302

Please sign in to comment.