未验证 提交 79ccf7ae 编写于 作者: S Sharif Elgamal

Merge branch 'master' of github.com:kubernetes/minikube into error-messages

......@@ -176,11 +176,17 @@ func runStart(cmd *cobra.Command, args []string) {
exit.WithError("Failed to generate config", err)
}
if viper.GetString(vmDriver) == constants.DriverNone {
// Optimization: images will be persistently loaded into the host's container runtime, so no need to duplicate work.
// For non-"none", the ISO is required to boot, so block until it is downloaded
if viper.GetString(vmDriver) != constants.DriverNone {
if err := cluster.CacheISO(config.MachineConfig); err != nil {
exit.WithError("Failed to cache ISO", err)
}
} else {
// With "none", images are persistently stored in Docker, so internal caching isn't necessary.
viper.Set(cacheImages, false)
}
// Now that the ISO is downloaded, pull images in the background while the VM boots.
var cacheGroup errgroup.Group
beginCacheImages(&cacheGroup, k8sVersion)
......@@ -195,10 +201,8 @@ func runStart(cmd *cobra.Command, args []string) {
exit.WithError("Failed to get machine client", err)
}
// If --download-only, complete the remaining downloads and exit.
if viper.GetBool(downloadOnly) {
if err := cluster.CacheISO(config.MachineConfig); err != nil {
exit.WithError("Failed to cache ISO", err)
}
if err := doCacheBinaries(k8sVersion); err != nil {
exit.WithError("Failed to cache binaries", err)
}
......
......@@ -301,13 +301,7 @@ func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error
exit.WithError("error getting driver", err)
}
err = CacheISO(config)
if err != nil {
return nil, errors.Wrap(err, "unable to cache ISO")
}
driver := def.ConfigCreator(config)
data, err := json.Marshal(driver)
if err != nil {
return nil, errors.Wrap(err, "marshal")
......
......@@ -27,6 +27,8 @@ import (
"testing"
"time"
"k8s.io/apimachinery/pkg/util/wait"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/minikube/pkg/minikube/tunnel"
......@@ -76,7 +78,7 @@ func testTunnel(t *testing.T) {
t.Fatal(errors.Wrap(err, "waiting for nginx pods"))
}
if err := commonutil.WaitForService(client, "default", "nginx-svc", true, time.Millisecond*500, time.Minute*10); err != nil {
if err := commonutil.WaitForService(client, "default", "nginx-svc", true, 1*time.Second, 2*time.Minute); err != nil {
t.Fatal(errors.Wrap(err, "Error waiting for nginx service to be up"))
}
......@@ -84,18 +86,34 @@ func testTunnel(t *testing.T) {
nginxIP := ""
for i := 1; i < 3 && len(nginxIP) == 0; i++ {
stdout, err := kubectlRunner.RunCommand([]string{"get", "svc", "nginx-svc", "-o", "jsonpath={.status.loadBalancer.ingress[0].ip}"})
if err != nil {
t.Fatalf("error listing nginx service: %s", err)
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
cmd := []string{"get", "svc", "nginx-svc", "-o", "jsonpath={.status.loadBalancer.ingress[0].ip}"}
stdout, err := kubectlRunner.RunCommand(cmd)
switch {
case err == nil:
nginxIP = string(stdout)
return len(stdout) != 0, nil
case !commonutil.IsRetryableAPIError(err):
t.Errorf("`%s` failed with non retriable error: %v", cmd, err)
return false, err
default:
t.Errorf("`%s` failed: %v", cmd, err)
return false, nil
}
nginxIP = string(stdout)
time.Sleep(1 * time.Second)
})
if err != nil {
t.Errorf("error getting ingress IP for nginx: %s", err)
}
if len(nginxIP) == 0 {
t.Fatal("svc should have ingress after tunnel is created, but it was empty!")
stdout, err := kubectlRunner.RunCommand([]string{"get", "svc", "nginx-svc", "-o", "jsonpath={.status}"})
if err != nil {
t.Errorf("error debugging nginx service: %s", err)
}
t.Fatalf("svc should have ingress after tunnel is created, but it was empty! Result of `kubectl describe svc nginx-svc`:\n %s", string(stdout))
}
responseBody, err := getResponseBody(nginxIP)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册