Skip to content

Commit 6dd0740

Browse files
committed
πŸ•ΆοΈ fix formatting πŸ•ΆοΈ
1 parent 830d6d0 commit 6dd0740

File tree

1 file changed

+105
-83
lines changed

1 file changed

+105
-83
lines changed

β€Ždocs/1-the-manual-menace/1-the-basics.mdβ€Ž

Lines changed: 105 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2,127 +2,149 @@
22
## CodeReady Workspaces setup
33

44
1. Login to your CodeReadyWorkspace (CRW) Editor. The link to this will be provided by your instructor.
5-
![crw](./images/crw.png)
65

7-
<p class="warn">
8-
If the workspace has not been set up for you, you can create one from this devfile. On CodeReady Workspaces, "Create Workspace > Custom Workspace". Enter this URL to load the TL500 stack:</br>
9-
<span style="color:blue;"><a href="https://raw.githubusercontent.com/rht-labs/enablement-framework/main/codereadyworkspaces/tl500-devfile.yaml">https://raw.githubusercontent.com/rht-labs/enablement-framework/main/codereadyworkspaces/tl500-devfile.yaml</a><span>
10-
</p>
6+
![crw](./images/crw.png)
7+
8+
<p class="warn">
9+
If the workspace has not been set up for you, you can create one from this devfile. On CodeReady Workspaces, "Create Workspace > Custom Workspace". Enter this URL to load the TL500 stack:</br>
10+
<span style="color:blue;"><a href="https://raw.githubusercontent.com/rht-labs/enablement-framework/main/codereadyworkspaces/tl500-devfile.yaml">https://raw.githubusercontent.com/rht-labs/enablement-framework/main/codereadyworkspaces/tl500-devfile.yaml</a><span>
11+
</p>
1112

1213
2. In your IDE (it may take some time to open ... β°β˜•οΈ), open a new terminal by hitting `Terminal > Open Terminal in Specific Container > stack-tl500` from the menu.
13-
![new-terminal](./images/new-terminal.png)
14+
15+
![new-terminal](./images/new-terminal.png)
1416

1517
3. Notice the nifty default shell in the stack-tl500 container is `zsh` which rhymes with swish. It also has neat shortcuts and plugins - plus all the cool kids are using it 😎! We will be setting our environment variables in both `~/.zshrc` and `~/.bashrc` in case you want to switch to `bash`.
1618

1719
4. Setup your `TEAM_NAME` name in the environment of the CodeReadyWorkspace by running the command below. We will use the `TEAM_NAME` variable throughout the exercises so having it stored in our session means less changing of this variable throughout the exercises πŸ’ͺ. **Ensure your `TEAM_NAME` consists of only lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc.)**
18-
```bash
19-
echo export TEAM_NAME="<TEAM_NAME>" | tee -a ~/.bashrc -a ~/.zshrc
20-
```
20+
21+
```bash
22+
echo export TEAM_NAME="<TEAM_NAME>" | tee -a ~/.bashrc -a ~/.zshrc
23+
```
2124

2225
5. Add the `CLUSTER_DOMAIN` to the environment:
23-
```bash
24-
echo export CLUSTER_DOMAIN="<CLUSTER_DOMAIN>" | tee -a ~/.bashrc -a ~/.zshrc
25-
```
26+
27+
```bash
28+
echo export CLUSTER_DOMAIN="<CLUSTER_DOMAIN>" | tee -a ~/.bashrc -a ~/.zshrc
29+
```
2630

2731
6. Add the `GIT_SERVER` to the environment:
28-
```bash
29-
echo export GIT_SERVER="<GIT_SERVER>" | tee -a ~/.bashrc -a ~/.zshrc
30-
```
32+
33+
```bash
34+
echo export GIT_SERVER="<GIT_SERVER>" | tee -a ~/.bashrc -a ~/.zshrc
35+
```
3136

3237
7. Verify the variables you have set:
33-
```bash
34-
source ~/.zshrc
35-
echo ${TEAM_NAME}
36-
echo ${CLUSTER_DOMAIN}
37-
echo ${GIT_SERVER}
38-
```
38+
39+
```bash
40+
source ~/.zshrc
41+
echo ${TEAM_NAME}
42+
echo ${CLUSTER_DOMAIN}
43+
echo ${GIT_SERVER}
44+
```
3945

4046
8. Check if you can connect to OpenShift. Run the command below.
4147

42-
<p class="tip">
43-
⛷️ <b>TIP</b> ⛷️ - Before you hit enter, make sure you change the username and password to match your team's login details </p>
48+
<p class="tip">
49+
⛷️ <b>TIP</b> ⛷️ - Before you hit enter, make sure you change the username and password to match your team's login details
50+
</p>
4451
45-
```bash
46-
oc login --server=https://api.${CLUSTER_DOMAIN##apps.}:6443 -u <USERNAME> -p <PASSWORD>
47-
```
52+
```bash
53+
oc login --server=https://api.${CLUSTER_DOMAIN##apps.}:6443 -u <USERNAME> -p <PASSWORD>
54+
```
4855
4956
9. Check your user permissions in OpenShift by creating your team's `ci-cd` project.
50-
```bash
51-
oc new-project ${TEAM_NAME}-ci-cd
52-
```
53-
![new-project](./images/new-project.png)
5457

55-
<p class="warn">
56-
⛷️ <b>NOTE</b> ⛷️ - If you are working as a team and are using the same TEAM_NAME, you may receive a message saying this project already exists. One of your team mates would have already created this project. It's all good!
57-
</p>
58+
```bash
59+
oc new-project ${TEAM_NAME}-ci-cd
60+
```
61+
62+
![new-project](./images/new-project.png)
63+
64+
<p class="warn">
65+
⛷️ <b>NOTE</b> ⛷️ - If you are working as a team and are using the same TEAM_NAME, you may receive a message saying this project already exists. One of your team mates would have already created this project. It's all good!
66+
</p>
5867
5968
### Helm 101
69+
6070
> Helm is the package manager for Kubernetes. It provides a way to create templates for the Kubernetes YAML that defines our application. The Kubernetes resources such as `DeploymentConfig`, `Route` & `Service` can be processed by supplying `values` to the templates. In Helm land, there are a few ways to do this. A package containing the templates and their default values is called a `chart`.
6171
6272
Let's deploy a simple application using Helm.
6373

6474
1. Helm charts are packaged and stored in repositories. They can be added as dependencies of other charts or used directly. Let's add a chart repository now. The chart repository stores the version history of our charts as well as the packaged tar file.
65-
```bash
66-
helm repo add tl500 https://rht-labs.com/todolist/
67-
```
75+
76+
```bash
77+
helm repo add tl500 https://rht-labs.com/todolist/
78+
```
6879
6980
2. Let's install a chart from this repo. First search the repository to see what is available.
70-
```bash
71-
helm search repo todolist
72-
```
7381

74-
Now install the latest version. Helm likes to give each install a release, for convenience we've set ours to `my`. This will add a prefix of `my-` to all the resources that are created.
75-
```bash
76-
helm install my tl500/todolist --namespace ${TEAM_NAME}-ci-cd
77-
```
82+
```bash
83+
helm search repo todolist
84+
```
85+
86+
Now install the latest version. Helm likes to give each install a release, for convenience we've set ours to `my`. This will add a prefix of `my-` to all the resources that are created.
87+
88+
```bash
89+
helm install my tl500/todolist --namespace ${TEAM_NAME}-ci-cd
90+
```
7891
7992
3. Open the application up in the browser to verify it's up and running. Here's a handy one-liner to get the address of the app
80-
```bash
81-
echo https://$(oc get route/my-todolist -n ${TEAM_NAME}-ci-cd --template='{{.spec.host}}')
82-
```
83-
![todolist](./images/todolist.png)
8493
94+
```bash
95+
echo https://$(oc get route/my-todolist -n ${TEAM_NAME}-ci-cd --template='{{.spec.host}}')
96+
```
97+
98+
![todolist](./images/todolist.png)
99+
100+
4. You can overwrite the default <span style="color:blue;">[values](https://github.com/rht-labs/todolist/blob/master/chart/values.yaml)</span> in a chart from the command line. Let's upgrade our deployment to show this. We'll make a simple change to the values to scale up our app. By default, we only have 1 replica.
101+
102+
```bash
103+
oc get pods -n ${TEAM_NAME}-ci-cd
104+
```
105+
106+
By default, we only have one replica of our application. Let's use helm to set this to 5.
85107

86-
4. You can overwrite the default <span style="color:blue;">[values](https://github.com/rht-labs/todolist/blob/master/chart/values.yaml)</span> in a chart from the command line. Let's upgrade our deployment to show this. We'll make a simple change to the values to scale up our app. By default, we only have 1 replica.
87-
```bash
88-
oc get pods -n ${TEAM_NAME}-ci-cd
89-
```
108+
```bash
109+
helm upgrade my tl500/todolist --set replicas=5 --namespace ${TEAM_NAME}-ci-cd
110+
```
90111

91-
By default, we only have one replica of our application. Let's use helm to set this to 5.
92-
```bash
93-
helm upgrade my tl500/todolist --set replicas=5 --namespace ${TEAM_NAME}-ci-cd
94-
```
112+
Verify the deployment has scaled up to 5 replicas.
95113

96-
Verify the deployment has scaled up to 5 replicas.
97-
```bash
98-
oc get pods -n ${TEAM_NAME}-ci-cd
99-
```
114+
```bash
115+
oc get pods -n ${TEAM_NAME}-ci-cd
116+
```
100117

101118
5. If you're done playing with the #amazing-todolist-app then let's tidy up our work by removing the chart. To do this, run helm uninstall to remove our release of the chart.
102-
```bash
103-
helm uninstall my --namespace ${TEAM_NAME}-ci-cd
104-
```
105-
Verify the clean up
106-
```bash
107-
oc get pods -n ${TEAM_NAME}-ci-cd | grep todolist
108-
```
109-
<!--@Cansu - this is how you style a colour on a word mid sentence <span style="color:purple;" >zsh</span> -->
119+
120+
```bash
121+
helm uninstall my --namespace ${TEAM_NAME}-ci-cd
122+
```
123+
124+
Verify the clean up
125+
126+
```bash
127+
oc get pods -n ${TEAM_NAME}-ci-cd | grep todolist
128+
```
129+
110130
6. For those who are really interested, this is the anatomy of our Helm chart. It can be <span style="color:blue;">[found here](https://github.com/rht-labs/todolist)</span>, but the basic structure is as follows:
111-
<div class="highlight" style="background: #f7f7f7">
112-
<pre><code class="language-bash">
113-
todolist/chart
114-
β”œβ”€β”€ Chart.yaml
115-
β”œβ”€β”€ templates
116-
β”‚Β Β  β”œβ”€β”€ _helpers.tpl
117-
β”‚Β Β  β”œβ”€β”€ deploymentconfig.yaml
118-
β”‚Β Β  β”œβ”€β”€ route.yaml
119-
β”‚Β Β  └── service.yaml
120-
└── values.yaml
121-
</code></pre></div>
122-
where:
123-
* `Chart.yaml` - is the manifest of the chart. It defines the name, version and dependencies for our chart.
124-
* `values.yaml` - is the sensible defaults for our chart to work, it contains the variables that are passed to the templates. We can overwrite these values on the command line.
125-
* `templates/*.yaml` - they are our k8s resources.
126-
* `_helpers.tpl` - is a collection of reusable variables an yaml snippets that are applied across all of the k8s resources uniformly for example, labels are defined in here and included on each k8s resource file as necessary.
131+
132+
<div class="highlight" style="background: #f7f7f7">
133+
<pre><code class="language-bash">
134+
todolist/chart
135+
β”œβ”€β”€ Chart.yaml
136+
β”œβ”€β”€ templates
137+
β”‚Β Β  β”œβ”€β”€ _helpers.tpl
138+
β”‚Β Β  β”œβ”€β”€ deploymentconfig.yaml
139+
β”‚Β Β  β”œβ”€β”€ route.yaml
140+
β”‚Β Β  └── service.yaml
141+
└── values.yaml
142+
</code></pre></div>
143+
144+
where:
145+
* `Chart.yaml` - is the manifest of the chart. It defines the name, version and dependencies for our chart.
146+
* `values.yaml` - is the sensible defaults for our chart to work, it contains the variables that are passed to the templates. We can overwrite these values on the command line.
147+
* `templates/*.yaml` - they are our k8s resources.
148+
* `_helpers.tpl` - is a collection of reusable variables an yaml snippets that are applied across all of the k8s resources uniformly for example, labels are defined in here and included on each k8s resource file as necessary.
127149

128150
πŸͺ„πŸͺ„ Now, let's continue with even more exciting tools... !πŸͺ„πŸͺ„

0 commit comments

Comments
Β (0)