Skip to content

Commit 731177e

Browse files
authored
Document upgrade-tester (#266)
Signed-off-by: Dean Roehrich <dean.roehrich@hpe.com>
1 parent 2201802 commit 731177e

3 files changed

Lines changed: 97 additions & 0 deletions

File tree

docs/repo-guides/readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@
99

1010
* [CRD Version Bumper](crd-bumper/readme.md)
1111
* [Editing APIs](crd-bumper/editing-apis.md)
12+
13+
## Testing
14+
15+
* [Upgrade Tester](testing/upgrade-tester.md)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Upgrade Tester
2+
3+
The `upgrade-gitops-maker.sh` and `upgrade-tester.sh` tools are used together to execute upgrades across a series of releases. The former populates a gitops repo with the NNF releases, and the latter installs those releases.
4+
5+
## Basic flow
6+
7+
- Create the gitops repo. Use `upgrade-gitops-maker.sh` to create a gitops repo containing the release manifests.
8+
- Create a KIND environment for use with NNF.
9+
- Create a token for the gitops repo. This token is used to give ArgoCD access to the repo.
10+
- Run `upgrade-tester.sh` to deploy a specified series of releases, performing release-to-release upgrades.
11+
12+
## Create a gitops repository
13+
14+
Use `upgrade-gitops-maker.sh` to create a gitops repository that is populated with the NNF releases. The [argocd-boilerplate](https://github.com/NearNodeFlash/argocd-boilerplate) is used to create the gitops repo.
15+
16+
This tool uses the [GitHub CLI tool](https://cli.github.com), and it must have a token with permission to create and write to the user's private repositories. It begins by creating the private repository on the user's GitHub account and then pushing to it as it builds up the releases.
17+
18+
```console
19+
git clone git@github.com:NearNodeFlash/nnf-integration-test.git
20+
cd nnf-integration-test/upgrade-tester
21+
REPO_NAME=penguin
22+
./upgrade-gitops-maker.sh -n $REPO_NAME
23+
```
24+
25+
The new repo is named `gitops-$REPO_NAME`. The `upgrade-tester.sh` tool is in the `test-tools/` directory.
26+
27+
When complete, each release is placed in its own branch. *Note: This is an [anti-pattern for gitops repos](https://developers.redhat.com/articles/2022/07/20/git-workflows-best-practices-gitops-deployments), but it works well for this tool's purposes.*
28+
29+
The [CRD Upgrade Helpers](../release-nnf-sw/crd-upgrade-helpers.md) are added to some of the releases that did not originally have them, where their help has been necessary to allow upgrades to succeed. These branches have the `-svm` or `-nsvm` suffix.
30+
31+
Release branches `rel-v0.1.13-svm` and `rel-v0.1.14-svm` include the `storage-version-migrator` CRD upgrade helper. Release **v0.1.15** shipped with `storage-version-migrator` by default, so release branch `rel-v0.1.15-nsvm` includes the `nnf-storedversions-maint` CRD upgrade helper. All releases after **v0.1.15** ship with both CRD upgrade helpers and do not require `-svm` or `-nsvm` branches.
32+
33+
The `boilerplate-main` branch is pointing at [argocd-boilerplate](https://github.com/NearNodeFlash/argocd-boilerplate) and is described in [Tracking the ArgoCD Boilerplate Repo](https://github.com/NearNodeFlash/argocd-boilerplate/blob/main/Boilerplate-tracking.md). The `main` branch, in this case, contains only a few initial steps common to all releases and is not meant to be used.
34+
35+
```console
36+
$ git branch
37+
boilerplate-main
38+
* main
39+
rel-v0.1.11
40+
rel-v0.1.12
41+
rel-v0.1.13
42+
rel-v0.1.13-svm
43+
rel-v0.1.14
44+
rel-v0.1.14-svm
45+
rel-v0.1.15
46+
rel-v0.1.15-nsvm
47+
```
48+
49+
## Create a KIND cluster
50+
51+
Use the [nnf-deploy](https://github.com/NearNodeFlash/nnf-deploy) tools to create the KIND cluster and configure ArgoCD.
52+
53+
```console
54+
git clone git@github.com:NearNodeFlash/nnf-deploy.git
55+
cd nnf-deploy
56+
./tools/kind.sh create
57+
```
58+
59+
### Configure ArgoCD
60+
61+
Configure ArgoCD by giving it access to the gitops repo created earlier, using the token you created for that repo. At a minimum, the token must grant read-only access to the repo's contents. See [Using with KIND or a private repo](https://github.com/NearNodeFlash/argocd-boilerplate?tab=readme-ov-file#using-with-kind-or-a-private-repo) for details about creating the token.
62+
63+
```console
64+
REPO_NAME=penguin
65+
export ARGOCD_OPTS='--port-forward --port-forward-namespace argocd'
66+
./tools/kind.sh argocd_attach $NEW_ARGO_PASSWORD
67+
argocd repo add "$HTTPS_REPO_CLONE_URL" --username "$GH_USER" --password "$REPO_TOKEN" --name "gitops-$REPO_NAME"
68+
```
69+
70+
## Run the upgrade test
71+
72+
The `upgrade-tester.sh` tool deploys specific releases and waits for each one to succeed. The user must specify the releases to be tested, identifying them by branch name. The tool uses `git checkout` to select a release and `./tools/deploy-env.sh` to deploy the bootstraps for that release. ArgoCD is monitored to determine when each upgrade has completed.
73+
74+
```console
75+
git clone "$HTTPS_REPO_CLONE_URL" "$REPO_NAME"
76+
cd $REPO_NAME
77+
./test-tools/upgrade-tester.sh rel-v0.1.11 rel-v0.1.12 rel-v0.1.13-svm
78+
```
79+
80+
## References
81+
82+
[NNF Releases](https://github.com/NearNodeFlash/nnf-deploy/releases)
83+
84+
[argocd-boilerplate](https://github.com/NearNodeFlash/argocd-boilerplate)
85+
86+
[nnf-deploy](https://github.com/NearNodeFlash/nnf-deploy)
87+
88+
[CRD Upgrade Helpers](../release-nnf-sw/crd-upgrade-helpers.md)
89+
90+
[GitHub CLI tool](https://cli.github.com)
91+
92+
[Kubernetes-in-Docker (KIND)](https://kind.sigs.k8s.io)

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ nav:
3232
- 'CRD Version Bumper': 'repo-guides/crd-bumper/readme.md'
3333
- 'Editing APIs': 'repo-guides/crd-bumper/editing-apis.md'
3434
- 'CRD Upgrade Helpers': 'repo-guides/release-nnf-sw/crd-upgrade-helpers.md'
35+
- 'Upgrade Tester': 'repo-guides/release-nnf-sw/upgrade-tester.md'
3536
theme:
3637
name: 'material'
3738
custom_dir: overrides

0 commit comments

Comments
 (0)