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

Use profile name as cluster/node name #6200

Merged
merged 12 commits into from
Feb 5, 2020
13 changes: 12 additions & 1 deletion cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,17 @@ func generateCfgFromFlags(cmd *cobra.Command, k8sVersion string, drvName string)
out.T(out.SuccessType, "Using image repository {{.name}}", out.V{"name": repository})
}

var kubeNodeName string
if drvName == driver.None {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason that the none driver should not have the same node name as Profile name ?
I would rather we treat all drivers same way as much as possible.

so lets have the profile name for none driver unless there is a good reason for it that I dont know ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the none driver the host is created by the user not minikube. If we're not setting the default host name, it will result a different node name with the host.
This issue would not exist for other drivers as those drivers create the VM and set the host name.
We may need to ask user to set the profile name to keep the same behavior as other drivers which may be confusing.

// set the node name the same as host name for none driver
hostname, _ := os.Hostname()
kubeNodeName = hostname
}

if kubeNodeName == "" {
kubeNodeName = viper.GetString(cfg.MachineProfile)
}

cfg := cfg.MachineConfig{
Name: viper.GetString(cfg.MachineProfile),
KeepContext: viper.GetBool(keepContext),
Expand Down Expand Up @@ -942,7 +953,7 @@ func generateCfgFromFlags(cmd *cobra.Command, k8sVersion string, drvName string)
KubernetesConfig: cfg.KubernetesConfig{
KubernetesVersion: k8sVersion,
NodePort: viper.GetInt(apiServerPort),
NodeName: constants.DefaultNodeName,
NodeName: kubeNodeName,
APIServerName: viper.GetString(apiServerName),
APIServerNames: apiServerNames,
APIServerIPs: apiServerIPs,
Expand Down
3 changes: 3 additions & 0 deletions pkg/minikube/bootstrapper/bsutil/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func NewKubeletConfig(k8s config.KubernetesConfig, r cruntime.Manager) ([]byte,
if _, ok := extraOpts["node-ip"]; !ok {
extraOpts["node-ip"] = k8s.NodeIP
}
if k8s.NodeName != "" {
extraOpts["hostname-override"] = k8s.NodeName
}

pauseImage := images.Pause(k8s.ImageRepository)
if _, ok := extraOpts["pod-infra-container-image"]; !ok && k8s.ImageRepository != "" && pauseImage != "" && k8s.ContainerRuntime != remoteContainerRuntime {
Expand Down