Skip to content

Commit

Permalink
only mount /dev/fuse for rootless
Browse files Browse the repository at this point in the history
  • Loading branch information
aojea committed Feb 17, 2022
1 parent c117f59 commit e5c1712
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
9 changes: 3 additions & 6 deletions pkg/cluster/internal/providers/docker/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,9 @@ func commonArgs(cluster string, cfg *config.Cluster, networkName string, nodeNam
args = append(args, "--volume", "/dev/mapper:/dev/mapper")
}

// rootless: use fuse-overlayfs by default
// https://github.com/kubernetes-sigs/kind/issues/2275
i, _ := info()
if i != nil && i.Rootless {
// enable /dev/fuse explicitly for fuse-overlayfs
// (Rootless Docker does not automatically mount /dev/fuse with --privileged)
// enable /dev/fuse explicitly for fuse-overlayfs
// (Rootless Docker does not automatically mount /dev/fuse with --privileged)
if mountFuse() {
args = append(args, "--device", "/dev/fuse")
}
return args, nil
Expand Down
13 changes: 13 additions & 0 deletions pkg/cluster/internal/providers/docker/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,16 @@ func mountDevMapper() bool {

return storage == "btrfs" || storage == "zfs" || storage == "xfs"
}

// rootless: use fuse-overlayfs by default
// https://github.com/kubernetes-sigs/kind/issues/2275
func mountFuse() bool {
i, err := info()
if err != nil {
return false
}
if i != nil && i.Rootless {
return true
}
return false
}
5 changes: 1 addition & 4 deletions pkg/cluster/internal/providers/podman/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ func commonArgs(cfg *config.Cluster, networkName string) ([]string, error) {

// rootless: use fuse-overlayfs by default
// https://github.com/kubernetes-sigs/kind/issues/2275
i, _ := info(nil)
if i != nil && i.Rootless {
// enable /dev/fuse explicitly for fuse-overlayfs
// (Rootless Podman does not automatically mount /dev/fuse with --privileged)
if mountFuse() {
args = append(args, "--device", "/dev/fuse")
}

Expand Down
13 changes: 13 additions & 0 deletions pkg/cluster/internal/providers/podman/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,16 @@ type podmanStorageInfo struct {
} `json:"graphStatus"`
} `json:"store"`
}

// rootless: use fuse-overlayfs by default
// https://github.com/kubernetes-sigs/kind/issues/2275
func mountFuse() bool {
i, err := info(nil)
if err != nil {
return false
}
if i != nil && i.Rootless {
return true
}
return false
}

0 comments on commit e5c1712

Please sign in to comment.