Skip to content

Commit

Permalink
Merge pull request #1464 from aojea/zfsbtrfs
Browse files Browse the repository at this point in the history
Support BTRFS and ZFS docker storage
  • Loading branch information
k8s-ci-robot committed Apr 7, 2020
2 parents 92cca75 + d198c7a commit 2357682
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/cluster/internal/providers/docker/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ func commonArgs(cluster string, cfg *config.Cluster) ([]string, error) {
if usernsRemap() {
args = append(args, "--userns=host")
}

// handle Docker on Btrfs or ZFS
// 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
14 changes: 14 additions & 0 deletions pkg/cluster/internal/providers/docker/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,17 @@ func usernsRemap() bool {
}
return false
}

// mountDevMapper checks if the Docker storage driver is Btrfs or ZFS
func mountDevMapper() bool {
storage := ""
cmd := exec.Command("docker", "info", "-f", "{{.Driver}}")
lines, err := exec.CombinedOutputLines(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 2357682

Please sign in to comment.