From c52bc0d85ebd7f681cd4724969253a76995b38dd Mon Sep 17 00:00:00 2001 From: Cannon Palms Date: Sun, 26 Mar 2023 10:32:23 -0400 Subject: [PATCH] fix(capd): remove hack for btrfs/zfs support Support for btrfs/zfs was upstreamed to kind in https://github.com/kubernetes-sigs/kind/pull/1464, removing the need for us to hack support in ourselves. Helps https://github.com/kubernetes-sigs/cluster-api/issues/8317 chore: PR feedback Removes the now-unused function mountDevMapper(...) chore: fix ci lint fix: restore missing storage consts chore: fix bad rebase mountDevMapper() is unused --- test/infrastructure/container/docker.go | 32 ------------------------- 1 file changed, 32 deletions(-) diff --git a/test/infrastructure/container/docker.go b/test/infrastructure/container/docker.go index f2de71416eae..fbf9887623c4 100644 --- a/test/infrastructure/container/docker.go +++ b/test/infrastructure/container/docker.go @@ -51,7 +51,6 @@ const ( btrfsStorage = "btrfs" zfsStorage = "zfs" - xfsStorage = "xfs" ) type dockerRuntime struct { @@ -445,15 +444,6 @@ func (d *dockerRuntime) RunContainer(ctx context.Context, runConfig *RunContaine } containerConfig.Env = envVars - // handle Docker on Btrfs or ZFS - // https://github.com/kubernetes-sigs/kind/issues/1416#issuecomment-606514724 - if d.mountDevMapper(info) { - runConfig.Mounts = append(runConfig.Mounts, Mount{ - Source: "/dev/mapper", - Target: "/dev/mapper", - }) - } - configureVolumes(runConfig, &containerConfig, &hostConfig) configurePortMappings(runConfig.PortMappings, &containerConfig, &hostConfig) @@ -692,28 +682,6 @@ func (d *dockerRuntime) usernsRemap(info types.Info) bool { return false } -// mountDevMapper checks if the Docker storage driver is Btrfs or ZFS -// or if the backing filesystem is Btrfs. -func (d *dockerRuntime) mountDevMapper(info types.Info) bool { - storage := "" - storage = strings.ToLower(strings.TrimSpace(info.Driver)) - if storage == btrfsStorage || storage == zfsStorage || storage == "devicemapper" { - return true - } - - // check the backing file system - // docker info -f '{{json .DriverStatus }}' - // [["Backing Filesystem","extfs"],["Supports d_type","true"],["Native Overlay Diff","true"]] - for _, item := range info.DriverStatus { - if item[0] == "Backing Filesystem" { - storage = strings.ToLower(item[1]) - break - } - } - - return storage == btrfsStorage || storage == zfsStorage || storage == xfsStorage -} - // rootless: use fuse-overlayfs by default // https://github.com/kubernetes-sigs/kind/issues/2275 func (d *dockerRuntime) mountFuse(info types.Info) bool {