From 0e83dd4b4e048d5c1c1b255476ccadd34ba8e3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 12 Jan 2020 19:29:07 +0100 Subject: [PATCH] Use the cgroup-driver from runtime for kubelet --- pkg/minikube/bootstrapper/bsutil/kubelet.go | 5 +++++ pkg/minikube/bootstrapper/bsutil/kubelet_test.go | 4 +++- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/minikube/bootstrapper/bsutil/kubelet.go b/pkg/minikube/bootstrapper/bsutil/kubelet.go index 5c21698deb..5046b67bb1 100644 --- a/pkg/minikube/bootstrapper/bsutil/kubelet.go +++ b/pkg/minikube/bootstrapper/bsutil/kubelet.go @@ -41,6 +41,11 @@ func NewKubeletConfig(k8s config.KubernetesConfig, r cruntime.Manager) ([]byte, return nil, errors.Wrap(err, "generating extra configuration for kubelet") } + cgroupDriver, err := r.CGroupDriver() + if err == nil { + extraOpts["cgroup-driver"] = cgroupDriver + } + for k, v := range r.KubeletOptions() { extraOpts[k] = v } diff --git a/pkg/minikube/bootstrapper/bsutil/kubelet_test.go b/pkg/minikube/bootstrapper/bsutil/kubelet_test.go index 3c93aa97c2..226f486996 100644 --- a/pkg/minikube/bootstrapper/bsutil/kubelet_test.go +++ b/pkg/minikube/bootstrapper/bsutil/kubelet_test.go @@ -21,6 +21,7 @@ import ( "testing" "github.com/pmezard/go-difflib/difflib" + "k8s.io/minikube/pkg/minikube/command" "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/cruntime" @@ -135,7 +136,8 @@ ExecStart=/var/lib/minikube/binaries/v1.17.0/kubelet --authorization-mode=Webhoo for _, tc := range tests { t.Run(tc.description, func(t *testing.T) { - runtime, err := cruntime.New(cruntime.Config{Type: tc.cfg.ContainerRuntime}) + runtime, err := cruntime.New(cruntime.Config{Type: tc.cfg.ContainerRuntime, + Runner: command.NewFakeCommandRunner()}) if err != nil { t.Fatalf("runtime: %v", err) } diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index f5cfe92dc3..cc8a1f83c3 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -157,12 +157,13 @@ func (k *Bootstrapper) StartCluster(k8s config.KubernetesConfig) error { return errors.Wrap(err, "parsing kubernetes version") } - extraFlags := bsutil.CreateFlagsFromExtraArgs(k8s.ExtraOptions) r, err := cruntime.New(cruntime.Config{Type: k8s.ContainerRuntime}) if err != nil { return err } + extraFlags := bsutil.CreateFlagsFromExtraArgs(k8s.ExtraOptions) + ignore := []string{ fmt.Sprintf("DirAvailable-%s", strings.Replace(vmpath.GuestManifestsDir, "/", "-", -1)), fmt.Sprintf("DirAvailable-%s", strings.Replace(vmpath.GuestPersistentDir, "/", "-", -1)),