-
Notifications
You must be signed in to change notification settings - Fork 500
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 running stability test out of cluster #397
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
01aeea3
Support running stability test out of cluster
aylei 3524ce1
Gofmt
aylei 074e033
Merge branch 'master' into aylei/local-stability
aylei 539475c
Address comments
aylei bd63d80
Address review comments
aylei 2233cee
Add local statbility test doc
aylei 1c2fc04
Refine documents
aylei 47fb559
Address comments, avoid launch stability test if config not explicitl…
aylei 1f699dd
Update and rename local-stability-test.md to stability-test-cookbook.md
aylei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Stability Test Cookbook | ||
|
||
> Important notes: this guide is under heavy development and have complicated enviroment pre-requesites, things are ought to change in the future. | ||
The following commands assumes you are in the `tidb-operator` working directory: | ||
```shell | ||
# image will be tagged as YOUR_DOCKER_REGISTRY/pingcap/tidb-operator-stability-test:latest | ||
$ export DOCKER_REGISTRY=${YOUR_DOCKER_REGISTRY} | ||
$ make stability-test-push | ||
$ kubectl apply -f ./tests/manifests/stability/stability-configmap.yaml | ||
# edit the stability.yaml and change .spec.template.spec.containers[].image to the pushed image | ||
$ vi ./tests/manifests/stability/stability.yaml | ||
# apply the stability test pod | ||
$ kubectl apply -f ./tests/manifests/stability/stability.yaml | ||
``` | ||
|
||
## Alternative: run stability test in your local environment | ||
|
||
Deploy & witness flow can be tedious when developing stability-test, this document introduce that how to run stability-test out of the cluster(your local machine, usually) while still operating the remote cluster. | ||
|
||
### TL;DR: | ||
```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} --kubeconfig=${YOUR_KUBE_CONFIG_PATH} | ||
``` | ||
|
||
### Explained | ||
|
||
Generally we have three problems to solve: | ||
|
||
1. **Out of cluster client**: Now we try to load configs in the following order: | ||
* if `kubeconfig` command line option provided, use it | ||
* if `KUBECONFIG` env variable set, use it | ||
* try loading `InClusterConfig()` | ||
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 | ||
# helm dir | ||
$ mkdir /charts | ||
$ chmod 777 /charts | ||
# git repo dir if you don't set command line option | ||
$ mkdir /tidb-operator | ||
$ chmod 777 /tidb-operator | ||
``` | ||
3. **DNS and network issue**: Two-way proxy using Telepresence. We cannot resolve cluster dns name and access cluster ip easily, `telepresence` helps with that, it creates a proxy pod in the cluster and open a vpn connection to kubernetes cluster via this pod. Just run ([full documentations](https://www.telepresence.io/reference/install)): | ||
```shell | ||
$ brew cask install osxfuse | ||
$ 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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
(do not block this PR) Is it possible to copy them to temporary directories which are always writable in the future? I guess the path does not matter here. Then we can simplify the workflow (do not need to prepare
/charts
).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.
Agreed for future work, I've tried but found that
/charts
is hard coded in many places😅