-
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: docker/podman: make soft start 20 seconds faster #7435
Changes from all commits
b71035d
5fad42f
382dddf
98cf66c
ef5403b
b694370
1d01be1
e912175
d28defd
70adc95
fb908bc
7ec6cf8
2c435c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -443,15 +443,15 @@ func (k *Bootstrapper) needsReset(conf string, hostname string, port int, client | |
} | ||
|
||
if err := kverify.ExpectAppsRunning(client, kverify.AppsRunningList); err != nil { | ||
glog.Infof("needs reset: %v", err) | ||
glog.Infof("needs reset because expected components to be running : %v", err) | ||
return true | ||
} | ||
|
||
if err := kverify.APIServerVersionMatch(client, version); err != nil { | ||
glog.Infof("needs reset: %v", err) | ||
glog.Infof("needs reset because API server version match : %v", err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this can be reverted. The error made sense already. If not:
|
||
return true | ||
} | ||
|
||
glog.Infof("the cluster does not need a reset. hostname: %s", hostname) | ||
return false | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,6 +213,10 @@ func configureRuntimes(runner cruntime.CommandRunner, cc config.ClusterConfig, k | |
if driver.BareMetal(cc.Driver) { | ||
disableOthers = false | ||
} | ||
if driver.IsKIC(cc.Driver) && cc.KubernetesConfig.ContainerRuntime == "docker" { | ||
// in kic driver, the docker service binds to containerd service https://github.com/kubernetes/minikube/issues/7433 | ||
disableOthers = false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but what about crio? I think this fix should be done in cruntime. |
||
} | ||
|
||
// Preload is overly invasive for bare metal, and caching is not meaningful. KIC handled elsewhere. | ||
if driver.IsVM(cc.Driver) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// +build integration | ||
|
||
/* | ||
Copyright 2020 The Kubernetes Authors All rights reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package integration | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os/exec" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
// TestPreload tests that images are not over-written by preload | ||
func TestPreload(t *testing.T) { | ||
if NoneDriver() { | ||
t.Skipf("skipping %s - incompatible with none driver", t.Name()) | ||
} | ||
|
||
profile := UniqueProfileName("test-preload") | ||
ctx, cancel := context.WithTimeout(context.Background(), Minutes(40)) | ||
defer CleanupWithLogs(t, profile, cancel) | ||
|
||
startArgs := []string{"start", "-p", profile, "--memory=2200", "--alsologtostderr", "-v=3", "--wait=true", "--preload=false"} | ||
startArgs = append(startArgs, StartArgs()...) | ||
k8sVersion := "v1.17.0" | ||
startArgs = append(startArgs, fmt.Sprintf("--kubernetes-version=%s", k8sVersion)) | ||
|
||
rr, err := Run(t, exec.CommandContext(ctx, Target(), startArgs...)) | ||
if err != nil { | ||
t.Fatalf("%s failed: %v", rr.Command(), err) | ||
} | ||
|
||
// Now, pull the busybox image into the VMs docker daemon | ||
image := "busybox" | ||
rr, err = Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "pull", image)) | ||
if err != nil { | ||
t.Fatalf("%s failed: %v", rr.Command(), err) | ||
} | ||
|
||
// Restart minikube with v1.17.3, which has a preloaded tarball | ||
startArgs = []string{"start", "-p", profile, "--memory=2200", "--alsologtostderr", "-v=3", "--wait=true"} | ||
startArgs = append(startArgs, StartArgs()...) | ||
k8sVersion = "v1.17.3" | ||
startArgs = append(startArgs, fmt.Sprintf("--kubernetes-version=%s", k8sVersion)) | ||
rr, err = Run(t, exec.CommandContext(ctx, Target(), startArgs...)) | ||
if err != nil { | ||
t.Fatalf("%s failed: %v", rr.Command(), err) | ||
} | ||
rr, err = Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "images")) | ||
if err != nil { | ||
t.Fatalf("%s failed: %v", rr.Command(), err) | ||
} | ||
if !strings.Contains(rr.Output(), image) { | ||
t.Fatalf("Expected to find %s in output of `docker images`, instead got %s", image, rr.Output()) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,13 +103,30 @@ func TestStartStop(t *testing.T) { | |
t.Fatalf("failed starting minikube -first start-. args %q: %v", rr.Command(), err) | ||
} | ||
|
||
// Soft Start this should not take longer than 10 seconds | ||
softStartArgs := []string{"start", "-p", profile, "--alsologtostderr", "-v=3"} | ||
rr, err = Run(t, exec.CommandContext(ctx, Target(), softStartArgs...)) | ||
if err != nil { | ||
t.Fatalf("failed to soft start minikube. args %q: %v", rr.Command(), err) | ||
} | ||
|
||
// none driver does not invoke needs reset | ||
// CNI ones will invoke a reset because the expected component coredns would not be running. | ||
if !NoneDriver() && !strings.Contains(tc.name, "cni") { | ||
// if this fails means, our soft start was a hard start. | ||
softLog := "cluster does not need a reset" | ||
if !strings.Contains(rr.Output(), softLog) { | ||
t.Errorf("expected the soft start log outputs to include %q but got: %s", softLog, rr.Output()) | ||
} | ||
} | ||
|
||
if !strings.Contains(tc.name, "cni") { | ||
testPodScheduling(ctx, t, profile) | ||
} | ||
|
||
rr, err = Run(t, exec.CommandContext(ctx, Target(), "stop", "-p", profile, "--alsologtostderr", "-v=3")) | ||
if err != nil { | ||
t.Errorf("failed stopping minikube - first stop-. args %q : %v", rr.Command(), err) | ||
t.Errorf("failed stopping minikube - post soft start -. args %q : %v", rr.Command(), err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This text does not make sense to me. How about:
|
||
} | ||
|
||
// The none driver never really stops | ||
|
@@ -174,50 +191,6 @@ func TestStartStop(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestStartStopWithPreload(t *testing.T) { | ||
if NoneDriver() { | ||
t.Skipf("skipping %s - incompatible with none driver", t.Name()) | ||
} | ||
|
||
profile := UniqueProfileName("test-preload") | ||
ctx, cancel := context.WithTimeout(context.Background(), Minutes(40)) | ||
defer CleanupWithLogs(t, profile, cancel) | ||
|
||
startArgs := []string{"start", "-p", profile, "--memory=2200", "--alsologtostderr", "-v=3", "--wait=true", "--preload=false"} | ||
startArgs = append(startArgs, StartArgs()...) | ||
k8sVersion := "v1.17.0" | ||
startArgs = append(startArgs, fmt.Sprintf("--kubernetes-version=%s", k8sVersion)) | ||
|
||
rr, err := Run(t, exec.CommandContext(ctx, Target(), startArgs...)) | ||
if err != nil { | ||
t.Fatalf("%s failed: %v", rr.Command(), err) | ||
} | ||
|
||
// Now, pull the busybox image into the VMs docker daemon | ||
image := "busybox" | ||
rr, err = Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "pull", image)) | ||
if err != nil { | ||
t.Fatalf("%s failed: %v", rr.Command(), err) | ||
} | ||
|
||
// Restart minikube with v1.17.3, which has a preloaded tarball | ||
startArgs = []string{"start", "-p", profile, "--memory=2200", "--alsologtostderr", "-v=3", "--wait=true"} | ||
startArgs = append(startArgs, StartArgs()...) | ||
k8sVersion = "v1.17.3" | ||
startArgs = append(startArgs, fmt.Sprintf("--kubernetes-version=%s", k8sVersion)) | ||
rr, err = Run(t, exec.CommandContext(ctx, Target(), startArgs...)) | ||
if err != nil { | ||
t.Fatalf("%s failed: %v", rr.Command(), err) | ||
} | ||
rr, err = Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "images")) | ||
if err != nil { | ||
t.Fatalf("%s failed: %v", rr.Command(), err) | ||
} | ||
if !strings.Contains(rr.Output(), image) { | ||
t.Fatalf("Expected to find %s in output of `docker images`, instead got %s", image, rr.Output()) | ||
} | ||
} | ||
|
||
// testPodScheduling asserts that this configuration can schedule new pods | ||
func testPodScheduling(ctx context.Context, t *testing.T, profile string) { | ||
t.Helper() | ||
|
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.
This seems too difficult to read. Is the error retutrned by ExpectAppsRunning not meaningful already?
If not, just use:
needs reset: expected apps: %v
.