Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically set kubernetes config for btrfs storage driver #12990

Merged
merged 6 commits into from
Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cmd/minikube/cmd/start_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,17 @@ func generateNewConfigFromFlags(cmd *cobra.Command, k8sVersion string, drvName s
}
}

if driver.IsDockerBTRFS(drvName) {
fg := "LocalStorageCapacityIsolation=false"
if !strings.Contains(cc.KubernetesConfig.FeatureGates, fg) {
klog.Info("auto-setting LocalStorageCapacityIsolation to false")
if len(cc.KubernetesConfig.FeatureGates) != 0 {
fg = "," + fg
}
cc.KubernetesConfig.FeatureGates += fg
}
}

return cc
}

Expand Down
19 changes: 19 additions & 0 deletions pkg/minikube/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package driver
import (
"fmt"
"os"
"os/exec"
"runtime"
"sort"
"strconv"
Expand Down Expand Up @@ -144,6 +145,24 @@ func IsDockerDesktop(name string) bool {
return false
}

// IsDockerBTRFS checks if Docker is using btrfs storage driver
func IsDockerBTRFS(name string) bool {
if !IsDocker(name) {
return false
}
cmd := exec.Command("docker", "info", "-f", "{{.Driver}}")
spowelljr marked this conversation as resolved.
Show resolved Hide resolved
if err := cmd.Run(); err != nil {
klog.Warning("failed to get Docker storage driver: %v", err)
return false
}
output, err := cmd.Output()
if err != nil {
klog.Warning("failed to get command output: %v", err)
return false
}
return strings.Contains(string(output), "btrfs")
}

// IsMock checks if the driver is a mock
func IsMock(name string) bool {
return name == Mock
Expand Down
9 changes: 9 additions & 0 deletions pkg/minikube/reason/known_issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,15 @@ var guestIssues = []match{
},
Regexp: re(`'/var/lib/dpkg': No such file or directory`),
},
{
spowelljr marked this conversation as resolved.
Show resolved Hide resolved
Kind: Kind{
ID: "GUEST_STORAGE_DRIVER_BTRFS",
ExitCode: ExGuestUnsupported,
Advice: "minikube does not support the BTRFS storage driver yet, there is a workaround, add the following flag to your start command `--feature-gates=\"LocalStorageCapacityIsolation=false\"`",
Issues: []int{7923},
},
Regexp: re(`unsupported graph driver: btrfs`),
},
{
Kind: Kind{
ID: "GUEST_INCORRECT_ARCH",
Expand Down