提交 ed8d55c6 编写于 作者: M Medya Gh

Fixing TestProxy Setup

making sure minikube is deleted before setup to avoid https://github.com/kubernetes/minikube/issues/4132
上级 16af8b40
......@@ -209,6 +209,7 @@ checksum:
clean:
rm -rf $(BUILD_DIR)
rm -f pkg/minikube/assets/assets.go
rm -rf ./vendor
.PHONY: gendocs
gendocs: out/docs/minikube.md
......
......@@ -21,13 +21,15 @@ minikube's [primary goals](https://github.com/kubernetes/minikube/blob/master/do
## News
:mega: **Please fill out our [fast 5-question survey](https://forms.gle/Gg3hG5ZySw8c1C24A)** so that we can learn how & why you use minikube, and what improvements we should make. Thank you! :dancers:
* 2019-05-21 - v1.1.0 released! [[download](https://github.com/kubernetes/minikube/releases/tag/v1.1.0)] [[release notes](https://github.com/kubernetes/minikube/blob/master/CHANGELOG.md#version-110---2019-05-21)]
* 2019-04-29 - v1.0.1 released! [[download](https://github.com/kubernetes/minikube/releases/tag/v1.0.1)] [[release notes](https://github.com/kubernetes/minikube/blob/master/CHANGELOG.md#version-101---2019-04-29)]
* 2019-03-27 - v1.0.0 released! [[download](https://github.com/kubernetes/minikube/releases/tag/v1.0.0)] [[release notes](https://github.com/kubernetes/minikube/blob/master/CHANGELOG.md#version-1000---2019-03-27)]
## Features
minikube runs the official stable release of Kubernetes, with support for standard Kubernetes features like:
minikube runs the latest stable release of Kubernetes, with support for standard Kubernetes features like:
* [LoadBalancer](https://github.com/kubernetes/minikube/blob/master/docs/tunnel.md) - using `minikube tunnel`
* Multi-cluster - using `minikube start -p <name>`
......
......@@ -26,13 +26,13 @@ import (
"regexp"
"time"
"github.com/docker/machine/libmachine/mcnerror"
"github.com/golang/glog"
"github.com/pkg/browser"
"github.com/pkg/errors"
"github.com/spf13/cobra"
configcmd "k8s.io/minikube/cmd/minikube/cmd/config"
"k8s.io/minikube/pkg/minikube/cluster"
"k8s.io/minikube/pkg/minikube/config"
pkg_config "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/console"
"k8s.io/minikube/pkg/minikube/exit"
......@@ -59,15 +59,7 @@ var dashboardCmd = &cobra.Command{
if err != nil && !os.IsNotExist(err) {
console.ErrLn("Error loading profile config: %v", err)
}
err = proxy.ExcludeIP(cc.KubernetesConfig.NodeIP) // to be used for http get calls
if err != nil {
glog.Errorf("Error excluding IP from proxy: %s", err)
}
kubectl, err := exec.LookPath("kubectl")
if err != nil {
exit.WithCode(exit.NoInput, "kubectl not found in PATH, but is required for the dashboard. Installation guide: https://kubernetes.io/docs/tasks/tools/install-kubectl/")
}
api, err := machine.NewAPIClient()
defer func() {
err := api.Close()
......@@ -79,6 +71,27 @@ var dashboardCmd = &cobra.Command{
if err != nil {
exit.WithError("Error getting client", err)
}
if _, err = api.Load(pkg_config.GetMachineName()); err != nil {
switch err := errors.Cause(err).(type) {
case mcnerror.ErrHostDoesNotExist:
console.OutStyle(console.Meh, "%q cluster does not exist", pkg_config.GetMachineName())
os.Exit(exit.Unavailable)
default:
exit.WithError("Error getting cluster", err)
}
}
err = proxy.ExcludeIP(cc.KubernetesConfig.NodeIP) // to be used for http get calls
if err != nil {
glog.Errorf("Error excluding IP from proxy: %s", err)
}
kubectl, err := exec.LookPath("kubectl")
if err != nil {
exit.WithCode(exit.NoInput, "kubectl not found in PATH, but is required for the dashboard. Installation guide: https://kubernetes.io/docs/tasks/tools/install-kubectl/")
}
cluster.EnsureMinikubeRunningOrExit(api, 1)
// Send status messages to stderr for folks re-using this output.
......@@ -127,9 +140,9 @@ var dashboardCmd = &cobra.Command{
// kubectlProxy runs "kubectl proxy", returning host:port
func kubectlProxy(path string) (*exec.Cmd, string, error) {
// port=0 picks a random system port
// config.GetMachineName() respects the -p (profile) flag
// pkg_config.GetMachineName() respects the -p (profile) flag
cmd := exec.Command(path, "--context", config.GetMachineName(), "proxy", "--port=0")
cmd := exec.Command(path, "--context", pkg_config.GetMachineName(), "proxy", "--port=0")
stdoutPipe, err := cmd.StdoutPipe()
if err != nil {
......
......@@ -6,41 +6,41 @@ Please send a PR to suggest any improvements to it.
## (#1) User-friendly and accessible
- [ ] Creation of a user-centric minikube website for installation & documentation
- [ ] Localized output to 5+ written languages
- [ ] Creation of a user-centric minikube website for installation & documentation [#4388](https://github.com/kubernetes/minikube/issues/4388)
- [ ] Localized output to 5+ written languages [#4186](https://github.com/kubernetes/minikube/issues/4186) [#4185](https://github.com/kubernetes/minikube/issues/4185)
- [x] Make minikube usable in environments with challenging connectivity requirements
- [ ] Support lightweight deployment methods for environments where VM's are impractical
- [ ] Support lightweight deployment methods for environments where VM's are impractical [#4389](https://github.com/kubernetes/minikube/issues/4389) [#4390](https://github.com/kubernetes/minikube/issues/4390)
- [x] Add offline support
## (#2) Inclusive and community-driven
- [x] Increase community involvement in planning and decision making
- [ ] Make the continuous integration and release infrastructure publicly available
- [ ] Make the continuous integration and release infrastructure publicly available [#3256](https://github.com/kubernetes/minikube/issues/4390)
- [x] Double the number of active maintainers
## (#3) Cross-platform
- [ ] Simplified installation process across all supported platforms
- [ ] Users should never need to separately install supporting binaries
- [ ] Users should never need to separately install supporting binaries [#3975](https://github.com/kubernetes/minikube/issues/3975) [#4391](https://github.com/kubernetes/minikube/issues/4391)
- [ ] Simplified installation process across all supported platforms
## (#4) Support all Kubernetes features
- [ ] Add multi-node support
- [ ] Add multi-node support [#94](https://github.com/kubernetes/minikube/issues/94)
## (#5) High-fidelity
- [ ] Reduce guest VM overhead by 50%
- [ ] Reduce guest VM overhead by 50% [#3207](https://github.com/kubernetes/minikube/issues/3207)
- [x] Disable swap in the guest VM
## (#6) Compatible with all supported Kubernetes releases
- [x] Continuous Integration testing across all supported Kubernetes releases
- [ ] Automatic PR generation for updating the default Kubernetes release minikube uses
- [ ] Automatic PR generation for updating the default Kubernetes release minikube uses [#4392](https://github.com/kubernetes/minikube/issues/4392)
## (#7) Support for all Kubernetes-friendly container runtimes
- [x] Run all integration tests across all supported container runtimes
- [ ] Support for Kata Containers (help wanted!)
- [ ] Support for Kata Containers [#4347](https://github.com/kubernetes/minikube/issues/4347)
## (#8) Stable and easy to debug
......
......@@ -92,6 +92,7 @@ In case the default network doesn't exist you can define it.
```shell
curl https://raw.githubusercontent.com/libvirt/libvirt/master/src/network/default.xml > kvm-default.xml
virsh net-define kvm-default.xml
virsh net-start default
```
## Hyperkit driver
......
......@@ -174,7 +174,7 @@ func isIsolated(device string) bool {
iommuGroupPath := filepath.Join(sysFsPCIDevicesPath, device, "iommu_group", "devices")
otherDevices, err := ioutil.ReadDir(iommuGroupPath)
if err != nil {
log.Infof("Error reading %q: %v", iommuGroupPath)
log.Infof("Error reading %q: %v", iommuGroupPath, err)
return false
}
......
......@@ -17,6 +17,7 @@ limitations under the License.
package bootstrapper
import (
"fmt"
"net"
"path"
"path/filepath"
......@@ -66,7 +67,7 @@ func SetupCerts(cmd CommandRunner, k8s config.KubernetesConfig) error {
kubeCfgSetup := &util.KubeConfigSetup{
ClusterName: k8s.NodeName,
ClusterServerAddress: "https://localhost:8443",
ClusterServerAddress: fmt.Sprintf("https://localhost:%d", k8s.NodePort),
ClientCertificate: path.Join(util.DefaultCertPath, "apiserver.crt"),
ClientKey: path.Join(util.DefaultCertPath, "apiserver.key"),
CertificateAuthority: path.Join(util.DefaultCertPath, "ca.crt"),
......
......@@ -68,7 +68,17 @@ func TestProxy(t *testing.T) {
t.Fatalf("Failed to set up the test proxy: %s", err)
}
defer func(t *testing.T) { // Clean up after setting up proxy
// making sure there is no running miniukube to avoid https://github.com/kubernetes/minikube/issues/4132
r := NewMinikubeRunner(t)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
_, _, err = r.RunWithContext(ctx, "delete")
if err != nil {
t.Logf("Error deleting minikube before test setup %s : ", err)
}
// Clean up after setting up proxy
defer func(t *testing.T) {
err = os.Setenv("HTTP_PROXY", origHP)
if err != nil {
t.Errorf("Error reverting the HTTP_PROXY env")
......@@ -82,28 +92,29 @@ func TestProxy(t *testing.T) {
if err != nil {
t.Errorf("Error shutting down the http proxy")
}
_, _, err = r.RunWithContext(ctx, "delete")
if err != nil {
t.Logf("Error deleting minikube when cleaning up proxy setup: %s", err)
}
}(t)
t.Run("ConsoleWarnning", testProxyWarning)
t.Run("DashboardProxy", testDashboard)
t.Run("Proxy Console Warnning", testProxyWarning)
t.Run("Proxy Dashboard", testProxyDashboard)
}
// testProxyWarning checks user is warned correctly about the proxy related env vars
func testProxyWarning(t *testing.T) {
mk := NewMinikubeRunner(t)
// Start a timer for all remaining commands, to display failure output before a panic.
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
r := NewMinikubeRunner(t)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
startCmd := fmt.Sprintf("start %s %s %s", mk.StartArgs, mk.Args, "--alsologtostderr --v=5")
stdout, stderr, err := mk.RunWithContext(ctx, startCmd)
startCmd := fmt.Sprintf("start %s %s %s", r.StartArgs, r.Args, "--alsologtostderr --v=5")
stdout, stderr, err := r.RunWithContext(ctx, startCmd)
if err != nil {
t.Fatalf("start: %v\nstdout: %s\nstderr: %s", err, stdout, stderr)
}
mk.EnsureRunning()
// Pre-cleanup: this usually fails, because no instance is running.
// mk.RunWithContext(ctx, "delete")
msg := "Found network options:"
if !strings.Contains(stdout, msg) {
t.Errorf("Proxy wranning (%s) is missing from the output: %s", msg, stderr)
......@@ -113,5 +124,4 @@ func testProxyWarning(t *testing.T) {
if !strings.Contains(stderr, msg) {
t.Errorf("Proxy wranning (%s) is missing from the output: %s", msg, stderr)
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册