Skip to content

Commit bfdd118

Browse files
author
Nikolas De Giorgis
authored
Fix onboarding docs (#213)
1 parent 8bc4d07 commit bfdd118

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

docs/build_operator_locally.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Quick start for building and deploy the operator locally
2+
3+
This document contains a quickstart guide to build and deploy the operator locally.
4+
5+
6+
## Prerequisites
7+
This guide assumes that you have already installed the following tools:
8+
9+
* [Kind](https://kind.sigs.k8s.io/)
10+
* [Docker](https://www.docker.com/)
11+
* [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
12+
13+
14+
## Steps
15+
16+
1. Create a local kubernetes cluster and start a local registry by running
17+
18+
```sh
19+
./scripts/dev/setup_kind_cluster.sh
20+
```
21+
22+
2. Build and deploy the operator:
23+
24+
```sh
25+
python ./scripts/dev/build_and_deploy_operator
26+
```
27+
28+
Note: this will build and push the operator at `repo_url/mongodb-kubernetes-operator`, where `repo_url` is extracted from the [dev config file](./contributing.md#developing-locally)
29+
30+
3. Change the [operator yaml file](../deploy/operator.yaml) `image` field to have the image you just built
31+
32+
4. You can now deploy your resources following the [docs](../docs/README.md)
33+
34+
35+
## Troubleshooting
36+
If you run into an issue in step 1, you can try the following steps as workaround:
37+
1. Manually build the operator Dockerfile
38+
```sh
39+
python ./scripts/dev/dockerfile_generator.py > Dockerfile
40+
```
41+
42+
2. Build the image
43+
```sh
44+
docker build . -t localhost:5000/mongodb-kubernetes-operator
45+
```
46+
47+
3. Push the image
48+
```sh
49+
docker push localhost:5000/mongodb-kubernetes-operator
50+
```

docs/contributing.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ your tests. The `repo_url` sets the Docker registry. In my case I have a
6262
this file, set the `MONGODB_COMMUNITY_CONFIG` env variable to the absolute path
6363
of this file.
6464

65+
Please see [here](./build_operator_locally.md) to see how to build and deploy the operator locally.
66+
6567
## Configure Docker registry
6668

6769
The build process consist in multiple Docker images being built, you need to specify
@@ -117,14 +119,27 @@ replica_set_scale
117119
The tests should run individually using the runner like this:
118120

119121
```sh
120-
# python scripts/dev/e2e.py <test-name>
122+
# python scripts/dev/e2e.py --test <test-name>
121123
# for example
122124
python scripts/dev/e2e.py --test replica_set
123125
```
124126

125127
This will run the `replica_set` E2E test which is a simple test that installs a
126128
MongoDB Replica Set and asserts that the deployed server can be connected to.
127129

130+
131+
The python script has several flags to control its behaviour, please run
132+
133+
```sh
134+
python scripts/dev/e2e.py --help
135+
```
136+
137+
to get a list.
138+
139+
## Troubleshooting
140+
When you run a test locally, if the `operator-sdk-test` pod is present, you will have to
141+
first manually delete it; failing to do so will cause the `test-runner` pod to fail.
142+
128143
# Writing new E2E tests
129144

130145
You can start with `replica_set` test as an starting point to write a new test.

0 commit comments

Comments
 (0)