From e1cecc0fa0014b9c234e6b954941ef15112c43dc Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Fri, 19 Nov 2021 13:49:08 -0800 Subject: [PATCH 1/6] add advice if user using btrfs storage driver --- pkg/minikube/reason/known_issues.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/minikube/reason/known_issues.go b/pkg/minikube/reason/known_issues.go index 4c1d21b2a64c..599a64f46ce0 100644 --- a/pkg/minikube/reason/known_issues.go +++ b/pkg/minikube/reason/known_issues.go @@ -1053,6 +1053,15 @@ var guestIssues = []match{ }, Regexp: re(`'/var/lib/dpkg': No such file or directory`), }, + { + 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", From 592e2b01cad1edb604b0dd834563357d37140d07 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Tue, 30 Nov 2021 14:34:57 -0800 Subject: [PATCH 2/6] auto set LocalStorageCapacityIsolation for BTRFS --- cmd/minikube/cmd/start_flags.go | 11 +++++++++++ pkg/minikube/driver/driver.go | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/cmd/minikube/cmd/start_flags.go b/cmd/minikube/cmd/start_flags.go index 9f79c9861a4a..a7c1f5111385 100644 --- a/cmd/minikube/cmd/start_flags.go +++ b/cmd/minikube/cmd/start_flags.go @@ -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 } diff --git a/pkg/minikube/driver/driver.go b/pkg/minikube/driver/driver.go index 3a76001a00a6..5b0d6d50c2ee 100644 --- a/pkg/minikube/driver/driver.go +++ b/pkg/minikube/driver/driver.go @@ -19,6 +19,7 @@ package driver import ( "fmt" "os" + "os/exec" "runtime" "sort" "strconv" @@ -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}}") + 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 From 3f8e3dc3ed80d0d3f4f9c7590b1854d109e60029 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Wed, 1 Dec 2021 16:15:01 -0800 Subject: [PATCH 3/6] use oci cache to get storage driver --- cmd/minikube/cmd/start_flags.go | 16 ++++++---------- pkg/minikube/reason/.reason.go.swp | Bin 0 -> 16384 bytes 2 files changed, 6 insertions(+), 10 deletions(-) create mode 100644 pkg/minikube/reason/.reason.go.swp diff --git a/cmd/minikube/cmd/start_flags.go b/cmd/minikube/cmd/start_flags.go index a7c1f5111385..7f96ab0b9a05 100644 --- a/cmd/minikube/cmd/start_flags.go +++ b/cmd/minikube/cmd/start_flags.go @@ -516,16 +516,9 @@ func generateNewConfigFromFlags(cmd *cobra.Command, k8sVersion string, drvName s // See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-in-userns/ cc.KubernetesConfig.FeatureGates = addFeatureGate(cc.KubernetesConfig.FeatureGates, "KubeletInUserNamespace=true") } - } - - 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 + if si.StorageDriver == "btrfs" { + klog.Info("auto-setting LocalStorageCapacityIsolation to false because using btrfa storage driver") + cc.KubernetesConfig.FeatureGates = addFeatureGate(cc.KubernetesConfig.FeatureGates, "LocalStorageCapacityIsolation=false") } } @@ -533,6 +526,9 @@ func generateNewConfigFromFlags(cmd *cobra.Command, k8sVersion string, drvName s } func addFeatureGate(featureGates, s string) string { + if len(featureGates) == 0 { + return s + } split := strings.Split(featureGates, ",") m := make(map[string]struct{}, len(split)) for _, v := range split { diff --git a/pkg/minikube/reason/.reason.go.swp b/pkg/minikube/reason/.reason.go.swp new file mode 100644 index 0000000000000000000000000000000000000000..49bfedcbc7e045cff23e6f7bf929f9fc6f3abdb4 GIT binary patch literal 16384 zcmeHOO>87b6|O9SU?6~k1QCZ&J4rTnuxB<-4q;(|wr6(J?6}97A6rWlCNe#0d@oDH7ZfS3&@>7eG02fKB*bbb>v1S5@y-Z}0q;xxpVTuQGf-&e&f+{epO<ld+!z zuL3^qCtF3HT%M2Jj2uyTG>q2~>b(;4JVN;2z+{0{R4g0_*}`0si?x=nMQ3 zco}#Jh=CPg8F(E;ML-BV0{ra*jQtdN3b+^e{refa4y*zgC}sKR}=P^s|A%ND#ZTu(YYRy@(23ZJ{# zSlrfw@m=91a$bbiu>zcOc+%)3gO37F#;)=YtG}^XueHsFbsFUd(wCu#C69)9&jp%~ zM#6XKdoo;Kg)gW;>n-a+>p z!XCQ57Y4Ta9h^tiFp?>)*q{N>kXrN5*g@aoSc8y)GJKna4n4f>2P->1~Qr- z+l>ypXF9goI+b&J)Z;Njt|=8qaVUb|F!O7TM!VH+8k?J^4Z7;#wPa($( zP1C^+v^E?kjm&w*jcPRu%#$##-+#(co&*k!J{OP)92Ehu3}>{5TtqyEU1qqMMD9og zGcqc_=8K*uk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=&hc(01__1)rv8bc%qgO<3 z6Dfnt)ttyL=nNwLl&(D5>Q)=u*5#&Ats=J Date: Wed, 1 Dec 2021 16:16:00 -0800 Subject: [PATCH 4/6] remove unused func --- pkg/minikube/driver/driver.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/pkg/minikube/driver/driver.go b/pkg/minikube/driver/driver.go index 5b0d6d50c2ee..3a76001a00a6 100644 --- a/pkg/minikube/driver/driver.go +++ b/pkg/minikube/driver/driver.go @@ -19,7 +19,6 @@ package driver import ( "fmt" "os" - "os/exec" "runtime" "sort" "strconv" @@ -145,24 +144,6 @@ 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}}") - 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 From de8bef415cc84046520d780e160b8c88f8cd8540 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Wed, 1 Dec 2021 16:24:48 -0800 Subject: [PATCH 5/6] remove swap file --- pkg/minikube/reason/.reason.go.swp | Bin 16384 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 pkg/minikube/reason/.reason.go.swp diff --git a/pkg/minikube/reason/.reason.go.swp b/pkg/minikube/reason/.reason.go.swp deleted file mode 100644 index 49bfedcbc7e045cff23e6f7bf929f9fc6f3abdb4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHOO>87b6|O9SU?6~k1QCZ&J4rTnuxB<-4q;(|wr6(J?6}97A6rWlCNe#0d@oDH7ZfS3&@>7eG02fKB*bbb>v1S5@y-Z}0q;xxpVTuQGf-&e&f+{epO<ld+!z zuL3^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7PDA-j;?k5wD@1_aZEb8%jA=YE2qo^pRa~Es zLpO#}*et1jJVu-`#_=JW!DQp{xGccxP?l9VsGuXFEvnSb^&0Z1mDMudkfpU`B=)%K z#R5HIFQ@|i>dz1>Vz!sHqa6|4HuZB_Qb2|+19%PABT6V-K~XveQTZ;)EVEjk977Ao zvpdUtONL|^4#D^$1!pO{Ra*KyW9twsbO*zjuby8$&)c|vW$KCCNaCRiBW@tU(XEI` z#P%-Prt%=8{NF+@dj|O}<^SjKMW0uY=WhXTBDa4Y_$u%Ya`m@?*MSIF1>Qh@{s(|^ z_s4<1BOmVrXMx`!&wdu@0iOfz0)C4;`*q-lz>~mL;FG{zz-y3!a_yt8IB#{81E}T^Z^&T#_ z#lm3v$&(0&wzouECK7m?mM|QNTDZ)2lo2tlgFLjvn=&hc(01__1)rv8bc%qgO<3 z6Dfnt)ttyL=nNwLl&(D5>Q)=u*5#&Ats=J Date: Thu, 2 Dec 2021 09:39:42 -0800 Subject: [PATCH 6/6] typo --- cmd/minikube/cmd/start_flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/start_flags.go b/cmd/minikube/cmd/start_flags.go index 7f96ab0b9a05..3fd5a6706600 100644 --- a/cmd/minikube/cmd/start_flags.go +++ b/cmd/minikube/cmd/start_flags.go @@ -517,7 +517,7 @@ func generateNewConfigFromFlags(cmd *cobra.Command, k8sVersion string, drvName s cc.KubernetesConfig.FeatureGates = addFeatureGate(cc.KubernetesConfig.FeatureGates, "KubeletInUserNamespace=true") } if si.StorageDriver == "btrfs" { - klog.Info("auto-setting LocalStorageCapacityIsolation to false because using btrfa storage driver") + klog.Info("auto-setting LocalStorageCapacityIsolation to false because using btrfs storage driver") cc.KubernetesConfig.FeatureGates = addFeatureGate(cc.KubernetesConfig.FeatureGates, "LocalStorageCapacityIsolation=false") } }