Skip to content

Commit

Permalink
Support BTRFS and ZFS docker storage
Browse files Browse the repository at this point in the history
It seems that mounting /dev/mapper from the host to the kind
nodes remove the limitation on Docker of using BTRFS or ZFS

https://kind.sigs.k8s.io/docs/user/known-issues/#docker-on-btrfs-or-zfs
  • Loading branch information
aojea committed Apr 6, 2020
1 parent 92cca75 commit c978ca0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/cluster/internal/providers/docker/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,32 @@ func commonArgs(cluster string, cfg *config.Cluster) ([]string, error) {
if usernsRemap() {
args = append(args, "--userns=host")
}

// handle Docker on Btrfs or ZFS
dockerStorage, err := getDockerStorage()
if err != nil {
return nil, errors.Wrap(err, "can't get Docker Storage")
}
if dockerStorage == "btrfs" || dockerStorage == "zfs" {
args = append(args, "--volume", "/dev/mapper", "/dev/mapper")
}

return args, nil
}

// get docker Storage Driver
func getDockerStorage() (string, error) {
cmd := exec.Command("docker", "info", "-f", "{{.Driver}}")
lines, err := exec.CombinedOutputLines(cmd)
if err != nil {
return "", errors.Wrap(err, "failed to get storage")
}
if len(lines) != 1 {
return "", errors.Errorf("docker info should return one line, got %d lines", len(lines))
}
return strings.ToLower(strings.TrimSpace(lines[0])), nil
}

func runArgsForNode(node *config.Node, clusterIPFamily config.ClusterIPFamily, name string, args []string) ([]string, error) {
args = append([]string{
"run",
Expand Down

0 comments on commit c978ca0

Please sign in to comment.