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

Support mounting with the --no-kubernetes flag #13144

Merged
merged 5 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion pkg/minikube/node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/cruntime"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/out"
Expand All @@ -55,7 +56,7 @@ func configureMounts(wg *sync.WaitGroup, cc config.ClusterConfig) {
wg.Add(1)
defer wg.Done()

if !cc.Mount {
if !cc.Mount || driver.IsKIC(cc.Driver) {
return
}

Expand Down
11 changes: 5 additions & 6 deletions pkg/minikube/node/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ type Starter struct {

// Start spins up a guest and starts the Kubernetes node.
func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
stop8ks, err := handleNoKubernetes(starter)
var wg sync.WaitGroup
stopk8s, err := handleNoKubernetes(starter)
if err != nil {
return nil, err
}
if stop8ks {
if stopk8s {
configureMounts(&wg, *starter.Cfg)
sharifelgamal marked this conversation as resolved.
Show resolved Hide resolved
return nil, config.Write(viper.GetString(config.ProfileName), starter.Cfg)
}

Expand Down Expand Up @@ -146,10 +148,7 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
}
}

var wg sync.WaitGroup
if !driver.IsKIC(starter.Cfg.Driver) {
go configureMounts(&wg, *starter.Cfg)
}
go configureMounts(&wg, *starter.Cfg)

wg.Add(1)
go func() {
Expand Down
5 changes: 4 additions & 1 deletion test/integration/mount_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"strconv"
"strings"
"testing"
"time"
)

const (
Expand Down Expand Up @@ -93,12 +94,14 @@ func validateStartWithMount(ctx context.Context, t *testing.T, profile string) {
// We have to increment this because if you have two mounts with the same port, when you kill one cluster the mount will break for the other
mountStartPort++

args := []string{"start", "-p", profile, "--memory=2048", "--mount", "--mount-gid", mountGID, "--mount-msize", mountMSize, "--mount-port", mountPort(), "--mount-uid", mountUID}
args := []string{"start", "-p", profile, "--memory=2048", "--mount", "--mount-gid", mountGID, "--mount-msize", mountMSize, "--mount-port", mountPort(), "--mount-uid", mountUID, "--no-kubernetes"}
args = append(args, StartArgs()...)
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...))
if err != nil {
t.Fatalf("failed to start minikube with args: %q : %v", rr.Command(), err)
}
// The mount takes a split second to come up, without this the validateMount test will fail
time.Sleep(1 * time.Second)
}

// validateMount checks if the cluster has a folder mounted
Expand Down