-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
WIP: Add minikube support for the "generic" VM driver #6873
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afbjorklund The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Just rebased the old branch, for now. Probably need to update the driver functions. These don't make much sense anymore: The generic driver supports both remote physical servers and remote virtual servers... Also to be considered is if we should fork the "generic" driver, like the "none" ? Basically this mostly affects commands: // Remove a host
Remove() error
// Restart a host. This may just call Stop(); Start() if the provider does not
// have any special restart behaviour.
Restart() error
// Start a host
Start() error
// Stop a host gracefully
Stop() error For none, these are remapped to kubelet. |
Codecov Report
@@ Coverage Diff @@
## master #6873 +/- ##
==========================================
- Coverage 35.50% 35.47% -0.04%
==========================================
Files 148 148
Lines 9330 9345 +15
==========================================
+ Hits 3313 3315 +2
- Misses 5620 5633 +13
Partials 397 397
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any chance we could have integration tests for it ? even if we dont run it regulary, any script that we could run to see how many tests pass?
Sure, not sure what would be the best way to spin up the VMs, though. For local testing I used Vagrant and VirtualBox (with Ubuntu and CentOS), but I’m not sure it would fit? |
Vagrant , terraform anything is good, anything that we could run to see if be broke it. could also add it is own jenkins job, |
I will not have any time to work on it until later, and it probably is not for the pending release. But I still think it (“generic” driver) would be a good feature to have for the long term... If you could help to get it tested, I could help to fix the code if needed |
5c44eca
to
ea5edf5
Compare
This driver connects to an already existing virtual machine, using the provided IP address and SSH user/key/port parameters. On this machine, libmachine will provision the docker daemon and minikube will bootstrap the kubernetes cluster (as usual).
It is not supported anyway, and just throws errors. There is no use to restart or to retry, just give up. This should never be a problem with "none", though. That always return running, while generic tests ssh.
Can this PR be cleaned up so that it's ready for review? |
* master: (378 commits)
It should be rather clean now. The main question is whether we want to fork the "generic" driver, like we did for the "none" driver earlier. To make it shutdown kubernetes, instead of the actual host. https://github.com/docker/machine/blob/master/drivers/none/driver.go https://github.com/kubernetes/minikube/blob/master/pkg/drivers/none/none.go Also there is no cute function yet for the // IsVM checks if the driver is a VM
func IsVM(name string) bool {
if IsKIC(name) || IsMock(name) || BareMetal(name) {
return false
}
return true
}
// BareMetal returns if this driver is unisolated
func BareMetal(name string) bool {
return name == None || name == Mock
} |
In general, I prefer to start fork-less, and fork only as incompatible features are added, but what do you think? I would also prefer that this driver should be called
I think
|
The main reason for forking would be to make it similar to the other "bare-metal" driver. But it is a confusing situation, and only makes long-term sense if libmachine is to be dropped entirelly...
We could make internal aliases for drivers, which is somewhat confusing implementation-wise but could maybe be nicer for end-users. Like call |
Basically the name "generic" originates from being the driver for any existing Cloud Provider... https://docs.docker.com/machine/get-started-cloud/#3rd-party-driver-plugins So if your cloud didn't have a built-in driver, you could provision your VM and give it to machine. https://docs.docker.com/machine/get-started-cloud/#drivers-for-cloud-providers
And as we discussed earlier, "none" comes for Docker hosts that didn't have any driver. https://docs.docker.com/machine/get-started-cloud/#add-a-host-without-a-driver
The terms from docker-machine can be confusing when it comes to minikube... Since minikube assumes a local docker, and doesn't support any cloud providers. |
Will start on making a minikube fork of it... If it is not ready for next week, we can drop it from v1.10
The main "incompatible feature" is the need for if statements, when using the original drivers. // Start a host
Start() error
// Stop a host gracefully
Stop() error none func (d *Driver) Start() error {
return fmt.Errorf("hosts without a driver cannot be started")
}
func (d *Driver) Stop() error {
return fmt.Errorf("hosts without a driver cannot be stopped")
} generic func (d *Driver) Start() error {
return errors.New("generic driver does not support start")
}
func (d *Driver) Stop() error {
return errors.New("generic driver does not support stop")
} That is the reason for d3e273c, which is basically why this PR is shown as so many lines (partly also because of the indent, much smaller with diff --git a/pkg/minikube/machine/fix.go b/pkg/minikube/machine/fix.go
index 8aa7472..a6732dc 100644
--- a/pkg/minikube/machine/fix.go
+++ b/pkg/minikube/machine/fix.go
@@ -126,6 +133,7 @@ func recreateIfNeeded(api libmachine.API, cc config.ClusterConfig, n config.Node
}
}
+ if h.Driver.DriverName() != driver.Generic {
if serr != constants.ErrMachineMissing {
glog.Warningf("unexpected machine state, will restart: %v", serr)
}
@@ -146,6 +154,13 @@ func recreateIfNeeded(api libmachine.API, cc config.ClusterConfig, n config.Node
if err := api.Save(h); err != nil {
return h, errors.Wrap(err, "save")
}
+ } else {
+ if s == state.Running {
+ out.T(out.Running, `Using the {{.driver_name}} "{{.cluster}}" {{.machine_type}} ...`, out.V{"driver_name": cc.Driver, "cluster": cc.Name, "machine_type": machineType})
+ } else {
+ exit.WithCodeT(exit.Unavailable, `Unable to reach {{.driver_name}} {{.machine_type}} for "{{.cluster}}"`, out.V{"driver_name": cc.Driver, "cluster": cc.Name, "machine_type": machineType})
+ }
+ }
return h, nil
}
diff --git a/pkg/minikube/machine/stop.go b/pkg/minikube/machine/stop.go
index fafe09e..717e3fa 100644
--- a/pkg/minikube/machine/stop.go
+++ b/pkg/minikube/machine/stop.go
@@ -52,6 +52,7 @@ func stop(h *host.Host) error {
}
}
+ if h.DriverName != driver.Generic {
if err := h.Stop(); err != nil {
glog.Infof("stop err: %v", err)
st, ok := err.(mcnerror.ErrHostAlreadyInState)
@@ -61,6 +62,7 @@ func stop(h *host.Host) error {
}
return &retry.RetriableError{Err: errors.Wrap(err, "stop")}
}
+ }
glog.Infof("stop complete within %s", time.Since(start))
return nil
} So it will be much smaller, if we implement the minikube "variant" of those ? |
Since this is unlikely to see any proper tests set up in that time, let's move it to after v1.10 |
* master: (330 commits)
Will drop from 1.11 as well, maybe open a new PR for 1.12 if the rewrite is ready in time |
Codecov Report
@@ Coverage Diff @@
## master #6873 +/- ##
==========================================
- Coverage 34.46% 34.42% -0.04%
==========================================
Files 147 147
Lines 9428 9443 +15
==========================================
+ Hits 3249 3251 +2
- Misses 5780 5793 +13
Partials 399 399
|
(rebase of stale
#4734)This driver connects to an already existing virtual machine,
using the provided IP address and SSH user/key/port parameters.
On this machine, libmachine will provision the docker daemon
and minikube will bootstrap the kubernetes cluster (as usual).
Implements #4733