Skip to content

Commit

Permalink
fix(capd): remove hack for btrfs/zfs support
Browse files Browse the repository at this point in the history
Support for btrfs/zfs was upstreamed to kind in kubernetes-sigs/kind#1464, removing the need
for us to hack support in ourselves.

Helps kubernetes-sigs#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
  • Loading branch information
cannonpalms authored and Dhairya-Arora01 committed May 25, 2024
1 parent 09e6ceb commit 7edc004
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions test/infrastructure/container/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const (

btrfsStorage = "btrfs"
zfsStorage = "zfs"
xfsStorage = "xfs"
)

type dockerRuntime struct {
Expand Down Expand Up @@ -446,15 +445,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)

Expand Down Expand Up @@ -693,28 +683,6 @@ func (d *dockerRuntime) usernsRemap(info dockersystem.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 dockersystem.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 dockersystem.Info) bool {
Expand Down

0 comments on commit 7edc004

Please sign in to comment.