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 add extra options for none driver on ubuntu #4465

Merged
merged 5 commits into from
Jun 13, 2019
Merged
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
21 changes: 21 additions & 0 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,17 @@ func validateConfig() {
exit.Usage("Sorry, the --hidden feature is currently only supported with --vm-driver=kvm2")
}

// Adding extra option (resolv-conf) for none driver on ubutnu to address /issues/3511
if viper.GetString(vmDriver) == constants.DriverNone && noneNeedsResolveConf() {
o := "kubelet.resolv-conf=/run/systemd/resolve/resolv.conf"
err := extraOptions.Set(o)
if err == nil {
glog.Infof("Sucsessfully set extra option (%s) for none driver on ubuntu-like OS.", o)
medyagh marked this conversation as resolved.
Show resolved Hide resolved
} else {
glog.Errorf("Error setting extra options (%s) for none driver on ubuntu-like OS: %s", o, err)
medyagh marked this conversation as resolved.
Show resolved Hide resolved
}
}

// 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) &&
Expand Down Expand Up @@ -486,6 +497,16 @@ func generateConfig(cmd *cobra.Command, k8sVersion string) (cfg.Config, error) {
return cfg, nil
}

// noneNeedsResolveConf checks extra config option for resolv.conf is needed
// for none driver. more info https://github.com/kubernetes/minikube/issues/3511
func noneNeedsResolveConf() bool {
filename := "/run/systemd/resolve/resolv.conf"
medyagh marked this conversation as resolved.
Show resolved Hide resolved
if _, err := os.Stat(filename); os.IsNotExist(err) {
medyagh marked this conversation as resolved.
Show resolved Hide resolved
return false
}
return true
}

// prepareNone prepares the user and host for the joy of the "none" driver
func prepareNone() {
if viper.GetBool(cfg.WantNoneDriverWarning) {
Expand Down