Skip to content

Commit 209c108

Browse files
committed
docs: update and extend instructions
The instructions could use a little refactor to include some of the missing steps which are required to successfully run the E2E tests for Developer Sandbox.
1 parent 5f7c54b commit 209c108

2 files changed

Lines changed: 122 additions & 42 deletions

File tree

CRC.adoc

Lines changed: 122 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,160 @@
11
:imagesdir: doc/images
22

3-
==== Step by Step Guide - CRC (CodeReady Containers)
3+
== Step-by-step guide — CRC (CodeReady Containers)
44

5-
IMPORTANT: CodeReady Containers includes an embedded system bundle that contains certificates which expire 30 days after the release. Because of this it is very important to always run the latest release of CRC.
5+
IMPORTANT: CodeReady Containers includes an embedded system bundle that contains certificates which expire 30 days
6+
after the release. Because of this it is very important to always run the latest release of CRC.
67

7-
CodeReady Containers is a distribution of OpenShift designed to be run on a development PC, and while some features have been disabled by default it is still quite demanding in terms of system resources, and for this reason it is recommended that it be installed on a machine that has at least 32GB of memory.
8+
CodeReady Containers is a distribution of OpenShift designed to be run on a development PC, and while some features
9+
have been disabled by default it is still quite demanding in terms of system resources, and for this reason it is
10+
recommended that it be installed on a machine that has at least 32GB of memory.
811

9-
This guide will walk through the steps of downloading and install CRC, and running the e2e tests against local Codeready Toolchain host-operator and member-operator repositories.
12+
This guide will walk through the steps of downloading and install CRC, and running the e2e tests against local
13+
Codeready Toolchain host-operator and member-operator repositories.
1014

11-
1. Download CodeReady Containers from https://developers.redhat.com/products/codeready-containers/overview[developers.redhat.com].
12-
You will need to login using your Red Hat SSO account, after which you may click on the `Install OpenShift on your laptop` button which will take you to the download page for CRC. From here, select your OS before clicking `Download CodeReady Containers`. You will also need to download your pull secret, and keep that in a safe place.
15+
=== Download and install CRC
16+
Download CodeReady Containers from https://developers.redhat.com/products/codeready-containers/overview[developers.redhat.com].
17+
You will need to login using your Red Hat SSO account, after which you may click on the `Install OpenShift on your
18+
laptop` button which will take you to the download page for CRC. From here, select your OS before clicking `Download
19+
CodeReady Containers`. You will also need to download your pull secret, and keep that in a safe place.
1320
+
1421
image::download.png[align="center"]
1522

16-
2. Extract the downloaded file into a directory of your choice.
17-
+
23+
Extract the downloaded file into a directory of your choice:
24+
25+
```[source,bash]
26+
tar -xvf crc-linux-amd64.tar.xz
27+
```
28+
1829
image::extract_crc.png[align="center"]
19-
+
20-
You may also wish to add this directory to your path so that you can run the `crc` command from anywhere.
2130

22-
3. Enable Cluster Monitoring, which is required for tests to pass by running the following command:
23-
+
24-
`crc config set enable-cluster-monitoring true`
31+
Give execution permissions to the binary and move it to a directory on your path or `/usr/local/bin`:
2532

26-
4. Since cluster monitoring requires at least 14GB of virtual machine memory, you also need to increase the default by running the following command - the value here is sufficient but you may make it higher if desired:
27-
+
28-
`crc config set memory 14500`
33+
```[source,bash]
34+
chmod u+x crc
35+
sudo mv crc /usr/local/bin
36+
```
2937

30-
5. Set the `QUAY_NAMESPACE` environment variable to your quay username:
31-
+
32-
`export QUAY_NAMESPACE=<quay-username>`
38+
=== Enable or tweak the cluster's settings
39+
40+
In order to run the tests seamlessly and without any problems, there is a set of settings you are advised to change.
41+
42+
```[source,bash]
43+
# Cluster monitoring is required for the tests to pass
44+
crc config set enable-cluster-monitoring true
45+
46+
# A minimum of 14Gb of virtual machine memory are required to run by default, so it is recommended to change that
47+
# setting. Tweaking the CPUs and disk size is optional, but also recommended to avoid having issues down the line.
48+
crc config set cpus 8
49+
crc config set disk-size 50
50+
crc config set memory 14500 # or 20000 for 20Gb
51+
```
52+
53+
=== Start the cluster
54+
55+
The first time you will need to set it up and provide the pull request secret you were presented with in the CRC
56+
download page — if you didn't grab it you can come back and copy it. Then, run the following commands:
57+
58+
```[source,bash]
59+
expot QUAY_NAMESPACE=${YOUR_QUAY_USERNAME}
60+
crc setup
61+
crc start
62+
```
63+
64+
While CRC boots, prepare the necessary projects, operators and images.
65+
66+
=== Prepare the projects
67+
68+
In order to run the tests, you need to have certain projects ready and the images pushed to Quay. For that, clone
69+
the following repositories in the same directory level as the `toolchain-e2e` project:
70+
71+
* https://github.com/codeready-toolchain/host-operator[host-operator]
72+
* https://github.com/codeready-toolchain/member-operator[member-operator]
73+
* https://github.com/codeready-toolchain/registration-service[registration-service]
74+
75+
On each of the repositories, build the images and push them to your Quay account:
76+
77+
```[source,bash]
78+
# Expot your namespace so that the build targets tag the image with your Quay repository's name.
79+
export QUAY_NAMESPACE=${YOUR_QUAY_NAMESPACE}
80+
81+
# Build the images.
82+
make podman-image
83+
84+
# Push them to your Quay repositories.
85+
make podman-push
86+
```
87+
88+
For `member-operator`, you might want to manually tag it to be able to push it to the `member-operator-webhook`
89+
repository:
90+
91+
```[source,bash]
92+
podman tag quay.io/${YOUR_QUAY_NAMESPACE}/member-operator:${TAG} quay.io/${YOUR_QUAY_NAMESPACE}/member-operator-webhook:${TAG}
93+
podman push quay.io/${YOUR_QUAY_NAMESPACE}/member-operator-webhook:${TAG}
94+
```
95+
96+
Once you have pushed all the images to Quay, you need to make the repositories public so that CRC can download them.
97+
For each of the repositories...
3398

34-
6. Ensure that the following Quay repositories are set to public:
35-
+
3699
* host-operator
37100
* member-operator
38101
* member-operator-webhook
39102
* registration-service
40103

41-
You can find these on the https://quay.io/repository/[Repository] page at quay.io:
42-
43-
image::quay_repo.png[align=center]
44-
45-
Click on the repository name, then click on the settings icon:
104+
... click on the repository name, then click on the "Settings" icon:
46105

47106
image::quay_repo_detail.png[align=center]
48107

49-
Scroll down to the *Repository Visibility* section, and ensure the repository is set to public:
108+
Then scroll down to the *Repository Visibility* section, and ensure the repository is set to public:
50109

51110
image::quay_repo_visibility.png[align=center]
52111

53-
7. Start the CRC container by executing `crc start`. This will take a few minutes to complete, and the output should look something like this:
112+
=== Final steps and running the tests
113+
114+
After some time has passed, the CRC cluster might be ready to work with. The terminal should show an output similar to
115+
the following one:
54116

55117
image::crc_start_output.png[align=center]
56118

57-
Take note of the `oc login...` command shown in the output.
119+
Add the `oc` executable to your current path by running the following command:
58120

59-
8. Execute the following command to set up the necessary environment variables:
121+
```[source,bash]
122+
eval $(crc oc-env)
123+
```
60124

61-
`eval $(crc oc-env)`
125+
Now, log in as the *kubeadmin* user, since you need the required privileges to manage namespaces, install operators,
126+
clean up resources and what not. Your login command should look something similar to this:
127+
128+
```[source,bash]
129+
oc login -u kubeadmin -p ${THE_PASSWORD} ${URL_SHOWN_IN_OUTPUT}
130+
```
62131

63-
9. Log into the cluster by executing the `oc login` command as shown in the resulting output from running `crc start` in the previous step. The output should look something like this:
64-
+
65132
image::crc_oc_login.png[align=center]
66133

67-
10. Check out the CodeReady Toolchain `host-operator` and `member-operator` repositories and ensure that they are located at the same directory level as the `toolchain-e2e` repository.
68-
+
69-
* https://github.com/codeready-toolchain/host-operator
70-
* https://github.com/codeready-toolchain/member-operator
71-
+
72-
11. Change into the `toolchain-e2e` directory, and execute the tests. It is recommended that you direct console output to a text file, as the test output is of significant length and is likely to be longer than your console buffer:
73-
+
74-
`make test-e2e-local >testoutput.txt`:
75-
+
134+
Finally, run the tests with the following command while you're on the `toolchain-e2e` repository:
135+
136+
```[source,bash]
137+
# It is recommended to redirect the output so that it doesn't overflow your terminal's buffer, and so that you can
138+
# check the entirety of the output.
139+
140+
make test-e2e-local > testoutput.txt
141+
```
142+
143+
=== Cleaning up
76144

145+
After a run, regardless of wheter it was successful or not, you can — and it is recommended to — run the following
146+
target to clean up the resources in the CRC cluster:
77147

148+
```[source,bash]
149+
make clean-e2e-resources
150+
```
78151

152+
If for some reason the cleaning up of the resources gets stuck, you can run the following target before running the
153+
"clean" target again to remove the finalizers that prevent the cleanup:
79154

155+
```[source,bash]
156+
make force-remove-finalizers-from-e2e-resources
80157

158+
# Rerun the cleanup again.
159+
make clean-e2e-resources
160+
```

doc/images/quay_repo.png

-58.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)