Skip to content

Commit

Permalink
Address comments, avoid launch stability test if config not explicitl…
Browse files Browse the repository at this point in the history
…y provided

Signed-off-by: Aylei <rayingecho@gmail.com>
  • Loading branch information
aylei committed Apr 16, 2019
1 parent 1c2fc04 commit 47fb559
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
7 changes: 3 additions & 4 deletions docs/local-stability-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Deploy & witness flow can be tedious when developing stability-test, this docume
```shell
$ telepresence --new-deployment ${POD_NAME}
$ go build -o stability ./tests/cmd/stability/main.go
$ ./stability --operator-repo-dir=${ABITRARY_EMPTY_DIR_TO_CLONE_OPERATOR_REPO}
$ ./stability --operator-repo-dir=${ABITRARY_EMPTY_DIR_TO_CLONE_OPERATOR_REPO} --kubeconfig=${YOUR_KUBE_CONFIG_PATH}
```

### Explained
Expand All @@ -17,8 +17,7 @@ Generally we have three problems to solve:
* if `kubeconfig` command line option provided, use it
* if `KUBECONFIG` env variable set, use it
* try loading `InClusterConfig()`
* if no `InClusterConfig()` provided, try loading kubeconfig file from default location (`~/.kube/config`)
so typically you will get right client configs if you have proper `~/.kube/config` in your local environment.
so you have to specify the `kubeconfig` path by either command line option or env variable if you want to test locally.
2. **Privilege issue**: If you don't want to or cannot run stability test with root privilege, change the working dir or create it in advance:
* git repo dir can be overridden by option `--git-repo-dir=xxxx`, but helm dir must be created manually.
```shell
Expand All @@ -36,4 +35,4 @@ $ brew install datawire/blackbird/telepresence
$ telepresence --new-deployment ${POD_NAME}
```
**PS**: If you cannot resolve cluster dns names after set up, try clear DNS cache.
**PSS**: Typically you can't use telepresence VPN mode with other VPNs (of course SSR is ok).
**PSS**: Typically you can't use telepresence VPN mode with other VPNs (of course SSR is ok).
9 changes: 0 additions & 9 deletions tests/pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"flag"
"fmt"
"os"
"os/user"
"path/filepath"
"time"

"github.com/juju/errors"
Expand Down Expand Up @@ -51,13 +49,6 @@ func GetConfig() (*rest.Config, error) {
if c, err := rest.InClusterConfig(); err == nil {
return c, nil
}
// If no in-cluster config, try the default location in the user's home directory
if usr, err := user.Current(); err == nil {
if c, err := clientcmd.BuildConfigFromFlags(
"", filepath.Join(usr.HomeDir, ".kube", "config")); err == nil {
return c, nil
}
}

return nil, fmt.Errorf("could not locate a kubeconfig")
}
Expand Down

0 comments on commit 47fb559

Please sign in to comment.