未验证 提交 6ecc1055 编写于 作者: M Medya Ghazizadeh 提交者: GitHub

Automatically add extra options for none driver on ubuntu

Automatically add extra options for none driver on ubuntu
上级 eb967567
......@@ -29,6 +29,8 @@ import (
"strings"
"time"
"k8s.io/minikube/pkg/minikube/drivers/none"
"github.com/blang/semver"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
......@@ -350,6 +352,11 @@ func validateConfig() {
exit.Usage("Sorry, the --hidden feature is currently only supported with --vm-driver=kvm2")
}
err := autoSetOptions(viper.GetString(vmDriver))
if err != nil {
glog.Errorf("Error autoSetOptions : %v", err)
}
// check that kubeadm extra args contain only whitelisted parameters
for param := range extraOptions.AsMap().Get(kubeadm.Kubeadm) {
if !pkgutil.ContainsString(kubeadm.KubeadmExtraArgsWhitelist[kubeadm.KubeadmCmdParam], param) &&
......@@ -486,6 +493,17 @@ func generateConfig(cmd *cobra.Command, k8sVersion string) (cfg.Config, error) {
return cfg, nil
}
// autoSetOptions sets the options needed for specific configuration automatically.
func autoSetOptions(vmDriver string) error {
// options for none driver
if vmDriver == constants.DriverNone {
if o := none.AutoOptions(); o != "" {
return extraOptions.Set(o)
}
}
return nil
}
// prepareNone prepares the user and host for the joy of the "none" driver
func prepareNone() {
if viper.GetBool(cfg.WantNoneDriverWarning) {
......
......@@ -18,6 +18,7 @@ package none
import (
"fmt"
"os"
"github.com/docker/machine/libmachine/drivers"
"k8s.io/minikube/pkg/drivers/none"
......@@ -47,3 +48,13 @@ func createNoneHost(config cfg.MachineConfig) interface{} {
ContainerRuntime: config.ContainerRuntime,
})
}
// AutoOptions returns suggested extra options based on the current config
func AutoOptions() string {
// for more info see: https://github.com/kubernetes/minikube/issues/3511
f := "/run/systemd/resolve/resolv.conf"
if _, err := os.Stat(f); err != nil {
return ""
}
return fmt.Sprintf("kubelet.resolv-conf=%s", f)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册