Skip to content

Commit 4f629e5

Browse files
authored
docs: local test (#247)
* docs: new file explaining local test
1 parent 259921d commit 4f629e5

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

docs/contributing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ For this you need to export the `KUBEBUILDER_ASSETS` environment variable:
2525
```shell
2626
KUBEBUILDER_ASSETS=$(pwd)/bin/k8s/$DIR_WITH_ASSETS
2727
# where $DIR_WITH_ASSETS is the directory that contains binaries for your OS.
28+
o
2829
```
30+
31+
### Live Local Test
32+
33+
See [Local Test](local_test.md).
34+
2935
### See Test Coverage
3036

3137
You can check the coverage as HTML report:

docs/local_test.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Test Locally
2+
3+
**Warning!** This test is for those who have access to `helm-charts-priv`.
4+
5+
## Run and check cluster
6+
7+
1. Create and run a cluster if it is not running yet.
8+
9+
```shell
10+
git clone https://github.com/openmfp/helm-charts-priv.git
11+
cd helm-charts-priv
12+
task local-setup
13+
```
14+
15+
2. Verify that the cluster is running.
16+
17+
Run k9s, go to `:pods`. All pods must have a status of "Running".
18+
It may take some time before they are all ready. The possible issues may be insufficient RAM and/or CPU cores. In this case, increase the limits in Docker settings.
19+
20+
3. In k9s, go to `:pods`, then open pod `kubernetes-graphql-gateway-...`.
21+
22+
Open container `kubernetes-graphql-gateway-gateway` to see the logs.
23+
The logs must contain more than a single line (with "Starting server...").
24+
If you see only this single line, the problem might be in the container called "kubernetes-graphql-gateway-listener".
25+
26+
Note the `IMAGE` column, corresponding to the two `kubernetes-...` container. It contains the name and the currently used version of the build, i.e.
27+
```
28+
ghcr.io/openmfp/kubernetes-graphql-gateway:v0.75.1
29+
```
30+
31+
4. Build the Docker image:
32+
```shell
33+
task docker
34+
```
35+
36+
5. Tag the newly built image with the version used in local-setup -- that image is going to be replaced with the one built on step 4.
37+
```shell
38+
docker tag ghcr.io/openmfp/kubernetes-graphql-gateway:latest ghcr.io/openmfp/kubernetes-graphql-gateway:v0.75.1
39+
```
40+
Use the name you and version got from the `IMAGE` column on step 3. Leave the version number unchanged.
41+
42+
6. Check your cluster name:
43+
```shell
44+
kind get clusters
45+
```
46+
In this example, the cluster name is `openmfp`.
47+
48+
7. Load the new image into your kind cluster:
49+
***Docker-based kind:***
50+
```shell
51+
kind load docker-image ghcr.io/openmfp/kubernetes-graphql-gateway:v0.75.1 -n openmfp
52+
```
53+
The argument `-n openmfp` is to change the default value of the cluster name, which is `kind`.
54+
55+
***Podman-based kind:***
56+
- Pull (or build) the image locally with Podman:
57+
```shell
58+
podman pull ghcr.io/openmfp/kubernetes-graphql-gateway:v0.75.1
59+
```
60+
61+
- Save it to a tarball in OCI-archive format:
62+
```shell
63+
podman save --format oci-archive ghcr.io/openmfp/kubernetes-graphql-gateway:v0.75.1 -o kubernetes-graphql-gateway_v0.75.1.tar
64+
```
65+
66+
- Load the tarball into your Podman-backed kind cluster:
67+
```shell
68+
kind load image-archive kubernetes-graphql-gateway_v0.75.1.tar -n openmfp
69+
```
70+
71+
8. In k9s, go to `:pods` and delete the pod (not the container) called `kubernetes-graphql-gateway-...`.
72+
73+
Kubernetes will immediately recreate the pod -- but this time it will use the new version of the build.
74+
75+
9. Once the pod is recreated, go to [https://portal.dev.local:8443](https://portal.dev.local:8443)
76+
and check if everything works fine.

0 commit comments

Comments
 (0)