Skip to content

Commit

Permalink
Merge pull request #2122 from aojea/btrfs
Browse files Browse the repository at this point in the history
podman: mount dev mapper for btrfs and zfs storage
  • Loading branch information
k8s-ci-robot authored Mar 12, 2021
2 parents e0f99a3 + ab52382 commit 5b79090
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/cluster/internal/providers/podman/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ func commonArgs(cfg *config.Cluster, networkName string) ([]string, error) {
args = append(args, "-e", fmt.Sprintf("%s=%s", key, val))
}

// handle Podman on Btrfs or ZFS same as we do with Docker
// https://github.com/kubernetes-sigs/kind/issues/1416#issuecomment-606514724
if mountDevMapper() {
args = append(args, "--volume", "/dev/mapper:/dev/mapper")
}

return args, nil
}

Expand Down
16 changes: 16 additions & 0 deletions pkg/cluster/internal/providers/podman/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,19 @@ func deleteVolumes(names []string) error {
cmd := exec.Command("podman", args...)
return cmd.Run()
}

// mountDevMapper checks if the podman storage driver is Btrfs or ZFS
func mountDevMapper() bool {
storage := ""
cmd := exec.Command("podman", "info", "-f",
`{{ index .Store.GraphStatus "Backing Filesystem"}}`)
lines, err := exec.OutputLines(cmd)
if err != nil {
return false
}

if len(lines) > 0 {
storage = strings.ToLower(strings.TrimSpace(lines[0]))
}
return storage == "btrfs" || storage == "zfs"
}

0 comments on commit 5b79090

Please sign in to comment.