Additional none driver changes
parent
88613090a9
commit
f4a8ece0ae
|
@ -21,7 +21,6 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -150,7 +149,7 @@ func runStart(cmd *cobra.Command, args []string) {
|
|||
}
|
||||
|
||||
fmt.Println("Moving files into cluster...")
|
||||
if err := cluster.UpdateCluster(host, host.Driver, kubernetesConfig); err != nil {
|
||||
if err := cluster.UpdateCluster(host.Driver, kubernetesConfig); err != nil {
|
||||
glog.Errorln("Error updating cluster: ", err)
|
||||
cmdUtil.MaybeReportErrorAndExit(err)
|
||||
}
|
||||
|
@ -162,16 +161,10 @@ func runStart(cmd *cobra.Command, args []string) {
|
|||
}
|
||||
|
||||
fmt.Println("Starting cluster components...")
|
||||
if host.DriverName == "none" {
|
||||
if err := cluster.StartClusterLocal(host, kubernetesConfig); err != nil {
|
||||
glog.Errorln("Error starting cluster: ", err)
|
||||
cmdUtil.MaybeReportErrorAndExit(err)
|
||||
}
|
||||
} else {
|
||||
if err := cluster.StartClusterSSH(host, kubernetesConfig); err != nil {
|
||||
glog.Errorln("Error starting cluster: ", err)
|
||||
cmdUtil.MaybeReportErrorAndExit(err)
|
||||
}
|
||||
|
||||
if err := cluster.StartCluster(api, kubernetesConfig); err != nil {
|
||||
glog.Errorln("Error starting cluster: ", err)
|
||||
cmdUtil.MaybeReportErrorAndExit(err)
|
||||
}
|
||||
|
||||
fmt.Println("Connecting to cluster...")
|
||||
|
@ -189,9 +182,6 @@ func runStart(cmd *cobra.Command, args []string) {
|
|||
var kubeConfigFile string
|
||||
if kubeConfigEnv == "" {
|
||||
kubeConfigFile = constants.KubeconfigPath
|
||||
if config.VMDriver == "none" {
|
||||
kubeConfigFile = path.Join(os.Getenv(constants.MinikubeHome), ".kube", "config")
|
||||
}
|
||||
} else {
|
||||
kubeConfigFile = filepath.SplitList(kubeConfigEnv)[0]
|
||||
}
|
||||
|
@ -246,15 +236,20 @@ func runStart(cmd *cobra.Command, args []string) {
|
|||
}
|
||||
|
||||
if config.VMDriver == "none" {
|
||||
username := os.Getenv("SUDO_USER")
|
||||
fmt.Println("username: ", username)
|
||||
command := fmt.Sprintf("/bin/chown -R %s %s; /bin/chown -R %s %s", username, constants.GetMinipath(),
|
||||
username, path.Join(os.Getenv(constants.MinikubeHome), ".kube"))
|
||||
_, err := exec.Command("bash", "-c", command).Output()
|
||||
if err != nil {
|
||||
glog.Errorln("Error modifying priveleges for none driver: ", err)
|
||||
cmdUtil.MaybeReportErrorAndExit(err)
|
||||
}
|
||||
fmt.Println(`===================
|
||||
WARNING: IT IS RECOMMENDED NOT TO RUN THE NONE DRIVER ON PERSONAL WORKSTATIONS
|
||||
The 'none' driver will run an insecure kubernetes apiserver as root that may leave the host vulnerable to CSRF attacks
|
||||
|
||||
When using the none driver, the kubectl config and credentials generated will be root owned and will appear in the root home directory.
|
||||
You will need to move the files to the appropriate location and then set the correct permissions. An example of this is below:
|
||||
sudo mv /root/.kube $HOME/.kube # this will overwrite any config you have. You may have to append the file contents manually
|
||||
sudo chown -R $USER $HOME/.kube
|
||||
sudo chgrp -R $USER $HOME/.kube
|
||||
|
||||
sudo mv /root/.minikube $HOME/.minikube # this will overwrite any config you have. You may have to append the file contents manually
|
||||
sudo chown -R $USER $HOME/.minikube
|
||||
sudo chgrp -R $USER $HOME/.minikube
|
||||
This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true`)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,13 +40,14 @@ MINIKUBE_WANTREPORTERRORPROMPT=False sudo ./out/minikube-${OS_ARCH} delete \
|
|||
|| MINIKUBE_WANTREPORTERRORPROMPT=False ./out/minikube-${OS_ARCH} delete \
|
||||
|| true
|
||||
sudo rm -rf $HOME/.minikube || true
|
||||
sudo rm -rf $HOME/.kube || true
|
||||
|
||||
# See the default image
|
||||
./out/minikube-${OS_ARCH} start -h | grep iso
|
||||
|
||||
# Allow this to fail, we'll switch on the return code below.
|
||||
set +e
|
||||
out/e2e-${OS_ARCH} -minikube-args="--vm-driver=${VM_DRIVER} --v=10" -test.v -test.timeout=30m -binary=out/minikube-${OS_ARCH}
|
||||
${SUDO_PREFIX}out/e2e-${OS_ARCH} -minikube-args="--vm-driver=${VM_DRIVER} --v=10" -test.v -test.timeout=30m -binary=out/minikube-${OS_ARCH}
|
||||
result=$?
|
||||
set -e
|
||||
|
||||
|
@ -54,6 +55,7 @@ MINIKUBE_WANTREPORTERRORPROMPT=False sudo ./out/minikube-${OS_ARCH} delete \
|
|||
|| MINIKUBE_WANTREPORTERRORPROMPT=False ./out/minikube-${OS_ARCH} delete \
|
||||
|| true
|
||||
sudo rm -rf $HOME/.minikube || true
|
||||
sudo rm -rf $HOME/.kube || true
|
||||
|
||||
if [[ $result -eq 0 ]]; then
|
||||
status="success"
|
||||
|
|
|
@ -15,13 +15,14 @@
|
|||
# limitations under the License.
|
||||
|
||||
|
||||
# This script downloads the test files from the build bucket and makes some executable.
|
||||
# This script runs the integration tests on a Linux machine for the Virtualbox Driver
|
||||
|
||||
# The script expects the following env variables:
|
||||
# OS_ARCH: The operating system and the architecture separated by a hyphen '-' (e.g. darwin-amd64, linux-amd64, windows-amd64)
|
||||
# VM_DRIVER: the vm-driver to use for the test
|
||||
# EXTRA_BUILD_ARGS: additional flags to pass into minikube start
|
||||
# JOB_NAME: the name of the logfile and check name to update on github
|
||||
# MINIKUBE_LOCATION: GIT_COMMIT from upstream build.
|
||||
# COMMIT: Actual commit ID from upstream build
|
||||
# EXTRA_BUILD_ARGS (optional): Extra args to be passed into the minikube integrations tests
|
||||
# access_token: The Github API access token. Injected by the Jenkins credential provider.
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
|
@ -29,46 +30,7 @@ OS_ARCH="linux-amd64"
|
|||
VM_DRIVER="none"
|
||||
JOB_NAME="Linux-None"
|
||||
EXTRA_BUILD_ARGS="$EXTRA_BUILD_ARGS --use-vendored-driver"
|
||||
MINIKUBE_HOME="$HOME"
|
||||
SUDO_PREFIX="sudo "
|
||||
|
||||
# Copy only the files we need to this workspace
|
||||
mkdir -p out/ testdata/
|
||||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/minikube-${OS_ARCH} out/
|
||||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/e2e-${OS_ARCH} out/
|
||||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/busybox.yaml testdata/
|
||||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/pvc.yaml testdata/
|
||||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/busybox-mount-test.yaml testdata/
|
||||
|
||||
# Set the executable bit on the e2e binary and out binary
|
||||
chmod +x out/e2e-${OS_ARCH}
|
||||
chmod +x out/minikube-${OS_ARCH}
|
||||
|
||||
MINIKUBE_WANTREPORTERRORPROMPT=False \
|
||||
./out/minikube-${OS_ARCH} delete || true
|
||||
|
||||
rm -rf $HOME/.minikube || true
|
||||
|
||||
# See the default image
|
||||
./out/minikube-${OS_ARCH} start -h | grep iso
|
||||
|
||||
# Allow this to fail, we'll switch on the return code below.
|
||||
set +e
|
||||
sudo -E out/e2e-${OS_ARCH} -minikube-args="--vm-driver=${VM_DRIVER} --v=100 ${EXTRA_BUILD_ARGS}" -test.v -test.timeout=30m -binary=out/minikube-${OS_ARCH}
|
||||
result=$?
|
||||
set -e
|
||||
|
||||
if [[ $result -eq 0 ]]; then
|
||||
status="success"
|
||||
else
|
||||
status="failure"
|
||||
fi
|
||||
|
||||
set +x
|
||||
target_url="https://storage.googleapis.com/minikube-builds/logs/${MINIKUBE_LOCATION}/${JOB_NAME}.txt"
|
||||
curl "https://api.github.com/repos/kubernetes/minikube/statuses/${COMMIT}?access_token=$access_token" \
|
||||
-H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"state\": \"$status\", \"description\": \"Jenkins\", \"target_url\": \"$target_url\", \"context\": \"${JOB_NAME}\"}"
|
||||
set -x
|
||||
|
||||
exit $result
|
||||
# Download files and set permissions
|
||||
source common.sh
|
||||
|
|
|
@ -18,13 +18,11 @@ package assets
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -157,31 +155,30 @@ func CopyFileLocal(f CopyableFile) error {
|
|||
return errors.Wrap(err, "Error changing file permissions")
|
||||
}
|
||||
|
||||
if os.Getenv("KEEP_SUDO_FOR_MINIKUBE_NONE") == "" {
|
||||
username := os.Getenv("SUDO_USER")
|
||||
fmt.Println(username)
|
||||
command := fmt.Sprintf("/bin/chown %s %s", username, targetPath)
|
||||
fmt.Println(command)
|
||||
args := strings.Split(command, " ")
|
||||
binary := args[0]
|
||||
args = append(args[:0], args[1:]...)
|
||||
cmd := exec.Command(binary, args...)
|
||||
if err := cmd.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
command = fmt.Sprintf("/bin/chgrp %s %s", username, targetPath)
|
||||
fmt.Println(command)
|
||||
args = strings.Split(command, " ")
|
||||
binary = args[0]
|
||||
args = append(args[:0], args[1:]...)
|
||||
cmd = exec.Command(binary, args...)
|
||||
if err := cmd.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = io.Copy(target, f)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Error copying file to target location")
|
||||
}
|
||||
|
||||
_, err = io.Copy(target, f)
|
||||
if os.Getenv("CHANGE_MINIKUBE_NONE_USER") != "" {
|
||||
username := os.Getenv("SUDO_USER")
|
||||
if username == "" {
|
||||
return nil
|
||||
}
|
||||
usr, err := user.Lookup(username)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Error copying file to target location")
|
||||
return errors.Wrap(err, "Error looking up user")
|
||||
}
|
||||
uid, err := strconv.Atoi(usr.Uid)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Error parsing uid for user: %s", username)
|
||||
}
|
||||
gid, err := strconv.Atoi(usr.Gid)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Error parsing gid for user: %s", username)
|
||||
}
|
||||
if err := os.Chown(targetPath, uid, gid); err != nil {
|
||||
return errors.Wrapf(err, "Error changing ownership for: %s", targetPath)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -165,12 +165,13 @@ func GetLocalkubeStatus(api libmachine.API) (string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
type sshAble interface {
|
||||
RunSSHCommand(string) (string, error)
|
||||
}
|
||||
|
||||
// StartCluster starts a k8s cluster on the specified Host.
|
||||
func StartClusterLocal(h *host.Host, kubernetesConfig KubernetesConfig) error {
|
||||
func StartCluster(api libmachine.API, kubernetesConfig KubernetesConfig) error {
|
||||
h, err := CheckIfApiExistsAndLoad(api)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Error checking that api exists and loading it")
|
||||
}
|
||||
|
||||
startCommand, err := GetStartCommand(kubernetesConfig)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Error generating start command: %s", err)
|
||||
|
@ -181,42 +182,10 @@ func StartClusterLocal(h *host.Host, kubernetesConfig KubernetesConfig) error {
|
|||
if err != nil {
|
||||
return errors.Wrapf(err, "Error running ssh command: %s", startCommand)
|
||||
}
|
||||
|
||||
checkRunning := func() error {
|
||||
s, err := h.Driver.GetState()
|
||||
glog.Infoln("Machine state: ", s)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Error getting state for host")
|
||||
}
|
||||
if s != state.Running {
|
||||
return fmt.Errorf("Machine is in the wrong state: %s, expected %s", s, state.Running)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := util.RetryAfter(6, checkRunning, 5*time.Second); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// StartCluster starts a k8s cluster on the specified Host.
|
||||
func StartClusterSSH(h sshAble, kubernetesConfig KubernetesConfig) error {
|
||||
startCommand, err := GetStartCommand(kubernetesConfig)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Error generating start command: %s", err)
|
||||
}
|
||||
glog.Infoln(startCommand)
|
||||
output, err := h.RunSSHCommand(startCommand)
|
||||
glog.Infoln(output)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Error running ssh command: %s", startCommand)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func UpdateCluster(h sshAble, d drivers.Driver, config KubernetesConfig) error {
|
||||
func UpdateCluster(d drivers.Driver, config KubernetesConfig) error {
|
||||
copyableFiles := []assets.CopyableFile{}
|
||||
var localkubeFile assets.CopyableFile
|
||||
var err error
|
||||
|
|
|
@ -86,14 +86,30 @@ func TestCreateHost(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestStartClusterSSH(t *testing.T) {
|
||||
h := tests.NewMockHost()
|
||||
ip, _ := h.Driver.GetIP()
|
||||
kubernetesConfig := KubernetesConfig{
|
||||
NodeIP: ip,
|
||||
func TestStartCluster(t *testing.T) {
|
||||
api := tests.NewMockAPI()
|
||||
|
||||
s, _ := tests.NewSSHServer()
|
||||
port, err := s.Start()
|
||||
if err != nil {
|
||||
t.Fatalf("Error starting ssh server: %s", err)
|
||||
}
|
||||
|
||||
err := StartClusterSSH(h, kubernetesConfig)
|
||||
d := &tests.MockDriver{
|
||||
Port: port,
|
||||
BaseDriver: drivers.BaseDriver{
|
||||
IPAddress: "127.0.0.1",
|
||||
SSHKeyPath: "",
|
||||
},
|
||||
CurrentState: state.Running,
|
||||
}
|
||||
api.Hosts[config.GetMachineName()] = &host.Host{Driver: d}
|
||||
|
||||
kubernetesConfig := KubernetesConfig{
|
||||
NodeIP: "",
|
||||
}
|
||||
|
||||
err = StartCluster(api, kubernetesConfig)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Error starting cluster: %s", err)
|
||||
|
@ -104,21 +120,37 @@ func TestStartClusterSSH(t *testing.T) {
|
|||
t.Fatalf("Error getting start command: %s", err)
|
||||
}
|
||||
for _, cmd := range []string{startCommand} {
|
||||
if _, ok := h.Commands[cmd]; !ok {
|
||||
t.Fatalf("Expected command not run: %s. Commands run: %v", cmd, h.Commands)
|
||||
if _, ok := s.Commands[cmd]; !ok {
|
||||
t.Fatalf("Expected command not run: %s. Commands run: %v", cmd, s.Commands)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStartClusterError(t *testing.T) {
|
||||
h := tests.NewMockHost()
|
||||
h.Error = "error"
|
||||
ip, _ := h.Driver.GetIP()
|
||||
kubernetesConfig := KubernetesConfig{
|
||||
NodeIP: ip,
|
||||
api := tests.NewMockAPI()
|
||||
|
||||
s, _ := tests.NewSSHServer()
|
||||
port, err := s.Start()
|
||||
if err != nil {
|
||||
t.Fatalf("Error starting ssh server: %s", err)
|
||||
}
|
||||
|
||||
err := StartClusterSSH(h, kubernetesConfig)
|
||||
d := &tests.MockDriver{
|
||||
Port: port,
|
||||
BaseDriver: drivers.BaseDriver{
|
||||
IPAddress: "127.0.0.1",
|
||||
SSHKeyPath: "",
|
||||
},
|
||||
CurrentState: state.Running,
|
||||
HostError: true,
|
||||
}
|
||||
api.Hosts[config.GetMachineName()] = &host.Host{Driver: d}
|
||||
|
||||
kubernetesConfig := KubernetesConfig{
|
||||
NodeIP: "192",
|
||||
}
|
||||
|
||||
err = StartCluster(api, kubernetesConfig)
|
||||
|
||||
if err == nil {
|
||||
t.Fatal("Error not thrown starting cluster.")
|
||||
|
@ -562,7 +594,6 @@ func TestUpdateDefault(t *testing.T) {
|
|||
t.Fatalf("Error starting ssh server: %s", err)
|
||||
}
|
||||
|
||||
h := tests.NewMockHost()
|
||||
d := &tests.MockDriver{
|
||||
Port: port,
|
||||
BaseDriver: drivers.BaseDriver{
|
||||
|
@ -575,7 +606,7 @@ func TestUpdateDefault(t *testing.T) {
|
|||
KubernetesVersion: constants.DefaultKubernetesVersion,
|
||||
}
|
||||
|
||||
if err := UpdateCluster(h, d, kubernetesConfig); err != nil {
|
||||
if err := UpdateCluster(d, kubernetesConfig); err != nil {
|
||||
t.Fatalf("Error updating cluster: %s", err)
|
||||
}
|
||||
transferred := s.Transfers.Bytes()
|
||||
|
@ -618,7 +649,6 @@ func TestUpdateKubernetesVersion(t *testing.T) {
|
|||
t.Fatalf("Error starting ssh server: %s", err)
|
||||
}
|
||||
|
||||
h := tests.NewMockHost()
|
||||
d := &tests.MockDriver{
|
||||
Port: port,
|
||||
BaseDriver: drivers.BaseDriver{
|
||||
|
@ -632,7 +662,7 @@ func TestUpdateKubernetesVersion(t *testing.T) {
|
|||
kubernetesConfig := KubernetesConfig{
|
||||
KubernetesVersion: server.URL,
|
||||
}
|
||||
if err := UpdateCluster(h, d, kubernetesConfig); err != nil {
|
||||
if err := UpdateCluster(d, kubernetesConfig); err != nil {
|
||||
t.Fatalf("Error updating cluster: %s", err)
|
||||
}
|
||||
transferred := s.Transfers.Bytes()
|
||||
|
@ -698,7 +728,6 @@ func TestUpdateCustomAddons(t *testing.T) {
|
|||
t.Fatalf("Error starting ssh server: %s", err)
|
||||
}
|
||||
|
||||
h := tests.NewMockHost()
|
||||
d := &tests.MockDriver{
|
||||
Port: port,
|
||||
BaseDriver: drivers.BaseDriver{
|
||||
|
@ -726,7 +755,7 @@ func TestUpdateCustomAddons(t *testing.T) {
|
|||
kubernetesConfig := KubernetesConfig{
|
||||
KubernetesVersion: constants.DefaultKubernetesVersion,
|
||||
}
|
||||
if err := UpdateCluster(h, d, kubernetesConfig); err != nil {
|
||||
if err := UpdateCluster(d, kubernetesConfig); err != nil {
|
||||
t.Fatalf("Error updating cluster: %s", err)
|
||||
}
|
||||
transferred := s.Transfers.Bytes()
|
||||
|
|
|
@ -130,8 +130,7 @@ func GenLocalkubeStartCmd(kubernetesConfig KubernetesConfig) (string, error) {
|
|||
flagVals = append(flagVals, fmt.Sprintf("--extra-config=%s", e.String()))
|
||||
}
|
||||
flags := strings.Join(flagVals, " ")
|
||||
localkubeTemplate := localkubeStartCmdTemplate
|
||||
t := template.Must(template.New("localkubeStartCmd").Parse(localkubeTemplate))
|
||||
t := template.Must(template.New("localkubeStartCmd").Parse(localkubeStartCmdTemplate))
|
||||
buf := bytes.Buffer{}
|
||||
data := struct {
|
||||
Flags string
|
||||
|
|
|
@ -204,12 +204,18 @@ func (api *LocalClient) Create(h *host.Host) error {
|
|||
{
|
||||
"Waiting for VM to start.",
|
||||
func() error {
|
||||
if h.Driver.DriverName() == "none" {
|
||||
return nil
|
||||
}
|
||||
return mcnutils.WaitFor(drivers.MachineInState(h.Driver, state.Running))
|
||||
},
|
||||
},
|
||||
{
|
||||
"Provisioning VM.",
|
||||
func() error {==
|
||||
func() error {
|
||||
if h.Driver.DriverName() == "none" {
|
||||
return nil
|
||||
}
|
||||
pv := provision.NewBuildrootProvisioner(h.Driver)
|
||||
return pv.Provision(*h.HostOptions.SwarmOptions, *h.HostOptions.AuthOptions, *h.HostOptions.EngineOptions)
|
||||
},
|
||||
|
|
|
@ -17,19 +17,18 @@ limitations under the License.
|
|||
package drivers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/docker/machine/libmachine/mcnflag"
|
||||
"github.com/docker/machine/libmachine/state"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
)
|
||||
|
||||
const driverName = "none"
|
||||
|
@ -49,12 +48,21 @@ func NewDriver(hostName, storePath string) *Driver {
|
|||
}
|
||||
}
|
||||
|
||||
// PreCreateCheck checks that VBoxManage exists and works
|
||||
func (d *Driver) PreCreateCheck() error {
|
||||
// check that systemd is installed as it is a requirement
|
||||
if _, err := exec.LookPath("systemctl"); err != nil {
|
||||
return errors.New("systemd is a requirement in order to use the none driver")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *Driver) GetCreateFlags() []mcnflag.Flag {
|
||||
return []mcnflag.Flag{}
|
||||
}
|
||||
|
||||
func (d *Driver) Create() error {
|
||||
// creation is handled by commands.go
|
||||
// creation for the none driver is handled by commands.go
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -68,7 +76,7 @@ func (d *Driver) GetIP() (string, error) {
|
|||
}
|
||||
|
||||
func (d *Driver) GetSSHHostname() (string, error) {
|
||||
return "", nil
|
||||
return "", fmt.Errorf("driver does not support ssh commands")
|
||||
}
|
||||
|
||||
func (d *Driver) GetSSHKeyPath() string {
|
||||
|
@ -76,12 +84,11 @@ func (d *Driver) GetSSHKeyPath() string {
|
|||
}
|
||||
|
||||
func (d *Driver) GetSSHPort() (int, error) {
|
||||
return 22, nil
|
||||
return 0, fmt.Errorf("driver does not support ssh commands")
|
||||
}
|
||||
|
||||
func (d *Driver) GetSSHUsername() string {
|
||||
usr, _ := user.Current()
|
||||
return usr.Username
|
||||
return ""
|
||||
}
|
||||
|
||||
func (d *Driver) GetURL() (string, error) {
|
||||
|
|
|
@ -20,7 +20,6 @@ package integration
|
|||
|
||||
import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -30,9 +29,6 @@ import (
|
|||
|
||||
func testClusterEnv(t *testing.T) {
|
||||
t.Parallel()
|
||||
if strings.Contains(*args, "--vm-driver=none") {
|
||||
t.Skip("skipping test for none driver as it does not support ssh")
|
||||
}
|
||||
|
||||
minikubeRunner := util.MinikubeRunner{
|
||||
Args: *args,
|
||||
|
|
|
@ -27,9 +27,6 @@ import (
|
|||
|
||||
func testClusterSSH(t *testing.T) {
|
||||
t.Parallel()
|
||||
if strings.Contains(*args, "--vm-driver=none") {
|
||||
t.Skip("skipping test for none driver as it does not support ssh")
|
||||
}
|
||||
minikubeRunner := util.MinikubeRunner{
|
||||
Args: *args,
|
||||
BinaryPath: *binaryPath,
|
||||
|
|
|
@ -33,7 +33,7 @@ func TestDocker(t *testing.T) {
|
|||
T: t}
|
||||
|
||||
if strings.Contains(*args, "--vm-driver=none") {
|
||||
t.Skip("skipping test for none driver as it does not bundle docker")
|
||||
t.Skip("skipping test as none driver does not bundle docker")
|
||||
}
|
||||
|
||||
minikubeRunner.RunCommand("delete", false)
|
||||
|
|
|
@ -19,6 +19,8 @@ limitations under the License.
|
|||
package integration
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"k8s.io/minikube/test/integration/util"
|
||||
|
@ -34,15 +36,20 @@ func TestFunctional(t *testing.T) {
|
|||
// This one is not parallel, and ensures the cluster comes up
|
||||
// before we run any other tests.
|
||||
t.Run("Status", testClusterStatus)
|
||||
|
||||
t.Run("DNS", testClusterDNS)
|
||||
t.Run("EnvVars", testClusterEnv)
|
||||
t.Run("Logs", testClusterLogs)
|
||||
t.Run("SSH", testClusterSSH)
|
||||
t.Run("Systemd", testVMSystemd)
|
||||
t.Run("Addons", testAddons)
|
||||
t.Run("Dashboard", testDashboard)
|
||||
t.Run("ServicesList", testServicesList)
|
||||
t.Run("Provisioning", testProvisioning)
|
||||
// t.Run("Mounting", testMounting)
|
||||
|
||||
if !strings.Contains(*args, "--vm-driver=none") {
|
||||
t.Run("EnvVars", testClusterEnv)
|
||||
t.Run("SSH", testClusterSSH)
|
||||
if runtime.GOOS != "windows" {
|
||||
t.Run("Systemd", testVMSystemd)
|
||||
|
||||
}
|
||||
// t.Run("Mounting", testMounting)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,6 @@ func testVMSystemd(t *testing.T) {
|
|||
if runtime.GOOS == "windows" {
|
||||
t.Skip("skipping test in windows as it doesn't exit properly")
|
||||
}
|
||||
if strings.Contains(*args, "--vm-driver=none") {
|
||||
t.Skip("skipping test for none driver as it does not boot systemd")
|
||||
}
|
||||
|
||||
minikubeRunner := util.MinikubeRunner{
|
||||
Args: *args,
|
||||
|
|
Loading…
Reference in New Issue