Skip to content

Commit 8acd733

Browse files
authored
Merge pull request #347 from alvarolop/feature/improve-section-2-docs
💄 Improve Attack of the Pipelines section💄 LGTM ! thanks a lot
2 parents 2bf5725 + 9385b80 commit 8acd733

File tree

6 files changed

+53
-54
lines changed

6 files changed

+53
-54
lines changed

docs/2-attack-of-the-pipelines/1-sealed-secrets.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
When we say GitOps, we say _"if it's not in Git, it's NOT REAL"_. But how are we going to store our sensitive data like credentials in Git repositories, where many people can access?! Sure, Kubernetes provides a way to manage secrets, but the problem is that it stores the sensitive information as a base64 string - anyone can decode the base64 string! Therefore, we cannot store `Secret` manifest files openly. We use an open-source tool called Sealed Secrets to address this problem.
44

5-
Sealed Secrets allows us to _seal_ Kubernetes secrets by using a utility called `kubeseal`. The `SealedSecrets` are Kubernetes resources that contain encrypted `Secret` object that only the controller can decrypt. Therefore, a `SealedSecret` is safe to store even in a public repository.
5+
Sealed Secrets allows us to _seal_ Kubernetes secrets by using a utility called `kubeseal`. The `SealedSecrets` are Kubernetes resources that contain an encrypted `Secret` object that only the controller can decrypt. Therefore, a `SealedSecret` is safe to store even in a public repository.
66

77
<p class="warn">
8-
⛷️ <b>NOTE</b> ⛷️ - If you switch to a different Dev Spaces Workspaces environment, please run below commands before going forward.
8+
⛷️ <b>NOTE</b> ⛷️ - If you switch to a different Dev Spaces Workspace environment, please run below commands before going forward.
99
</p>
1010

1111
```bash
@@ -16,7 +16,7 @@ git pull
1616

1717
### Sealed Secrets in action
1818

19-
1. The observant among you will have noticed that in the previous exercise we created a secret for git and added it to the cluster WITHOUT putting it in git...😳 Let's start by fixing this and sealing our Git credentials so they can be safely checked in to the code. First, we'll create the secret in a tmp directory. Make sure you have your gitlab user and PAT from the previous exercise set in your environment
19+
1. The observant among you will have noticed that in the previous exercise we created a secret for git and added it to the cluster WITHOUT putting it in git...😳 Let's start by fixing this and sealing our Git credentials so they can be safely checked into the code. First, we'll create the secret in a tmp directory. Make sure you have your gitlab user and PAT from the previous exercise set in your environment
2020

2121
```bash
2222
echo ${GITLAB_USER}
@@ -67,7 +67,7 @@ EOF
6767
cat /tmp/sealed-git-auth.yaml
6868
```
6969

70-
We should now see the secret is sealed, so it is safe for us to store in our repository. It should look something a bit like this, but with longer password and username output.
70+
We should now see the secret is sealed, so it is safe for us to store in our repository. It should look something like this, but with longer password and username output.
7171

7272
<div class="highlight" style="background: #f7f7f7">
7373
<pre><code class="language-yaml">
@@ -107,7 +107,7 @@ EOF
107107
source_ref: "1.0.3"
108108
values:
109109
secrets:
110-
# Additional secrets will be added to this list along the exercises.
110+
# Additional secrets will be added to this list throughout the exercises.
111111
- name: git-auth
112112
type: kubernetes.io/basic-auth
113113
annotations:
@@ -148,7 +148,7 @@ EOF
148148

149149
![argocd-git-auth-synced.png](images/argocd-git-auth-synced.png)
150150

151-
9. You can also verify it's been synced to Jenkins now by opening `Jenkins -> Manage Jenkins -> Manage Credentials` to view the `<TEAM_NAME>-ci-cd-git-auth` credential
151+
9. You can also verify it's been synced to Jenkins now by opening `Jenkins -> Manage Jenkins -> Credentials` to view the `<TEAM_NAME>-ci-cd-git-auth` credential
152152
153153
```bash#test
154154
echo https://$(oc get route jenkins --template='{{ .spec.host }}' -n ${TEAM_NAME}-ci-cd)

docs/2-attack-of-the-pipelines/2-app-of-apps.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
We need a way to bundle up all of our applications and deploy them into each environment. Each PetBattle application has its own Git repository and Helm chart, making it easier to code and deploy independently from other apps.
44

5-
A developer can get the same experience and end result installing an application chart using `helm install` as our fully automated pipeline. This is important from a useability perspective. Argo CD has great support for all sorts of packaging formats that suit Kubernetes deployments, `Kustomize`, `Helm`, as well as just raw YAML files. Because Helm is a template language, we can mutate the Helm chart templates and their generated Kubernetes objects with various values allowing us to configure them with a custom configuration per environment.
5+
A developer can get the same experience and end result installing an application chart using `helm install` as our fully automated pipeline. This is important from a usability perspective. Argo CD has great support for all sorts of packaging formats that suit Kubernetes deployments, `Kustomize`, `Helm`, as well as just raw YAML files. Because Helm is a template language, we can mutate the Helm chart templates and their generated Kubernetes objects with various values allowing us to configure them with a custom configuration per environment.
66

7-
We deploy each of our applications using an Argo CD `application` definition. We use one Argo CD `application` definition for every environment in which we wish to deploy the application. We make use of Argo CD `app of apps pattern` to bundle all of these all up; some might call this an application suite or a system! In PetBattle we generate the app-of-apps definitions using a Helm chart.
7+
We deploy each of our applications using an Argo CD `application` definition. We use one Argo CD `application` definition for every environment in which we wish to deploy the application. We make use of Argo CD `app-of-apps pattern` to bundle all of these up; some might call this an application suite or a system! In Pet Battle we generate the app-of-apps definitions using a Helm chart.
88

99
### Deploying Pet Battle - Keycloak
1010

1111
> In this exercise we'll deploy PetBattle and a supporting piece of tech it uses (Keycloak) using the same pattern. We'll deploy PetBattle to two environments - `test` and `stage` by configuring the values files in `pet-battle/stage/values.yaml` && `pet-battle/test/values.yaml`
1212
13-
1. In your IDE - open `tech-exercises/values.yaml` file at the root of this project and **swap** `enabled: false` to `enabled: true` as shown below for each of the app-of-pb definitions:
13+
1. In your IDE - open `tech-exercise/values.yaml` file at the root of this project and **swap** `enabled: false` to `enabled: true` as shown below for each of the app-of-pb definitions:
1414

1515
<div class="highlight" style="background: #f7f7f7">
1616
<pre><code class="language-yaml">
@@ -102,6 +102,7 @@ We deploy each of our applications using an Argo CD `application` definition. We
102102
image_version: latest # container image version
103103
hpa:
104104
enabled: false
105+
servicemonitor: false
105106
106107
pet-battle:
107108
name: pet-battle
@@ -118,7 +119,7 @@ We deploy each of our applications using an Argo CD `application` definition. We
118119
```bash#test
119120
# test
120121
if [[ $(yq e '.applications[] | select(.name=="pet-battle-api") | length' /projects/tech-exercise/pet-battle/test/values.yaml) < 1 ]]; then
121-
yq e '.applications.pet-battle-api = {"name": "pet-battle-api","enabled": true,"source": "https://petbattle.github.io/helm-charts","chart_name": "pet-battle-api","source_ref": "1.5.0","values": {"image_name": "pet-battle-api","image_version": "latest", "hpa": {"enabled": false}}}' -i /projects/tech-exercise/pet-battle/test/values.yaml
122+
yq e '.applications.pet-battle-api = {"name": "pet-battle-api","enabled": true,"source": "https://petbattle.github.io/helm-charts","chart_name": "pet-battle-api","source_ref": "1.5.0","values": {"image_name": "pet-battle-api","image_version": "latest", "hpa": {"enabled": false}}, "servicemonitor": false }' -i /projects/tech-exercise/pet-battle/test/values.yaml
122123
fi
123124
if [[ $(yq e '.applications[] | select(.name=="pet-battle") | length' /projects/tech-exercise/pet-battle/test/values.yaml) < 1 ]]; then
124125
yq e '.applications.pet-battle = {"name": "pet-battle","enabled": true,"source": "https://petbattle.github.io/helm-charts","chart_name": "pet-battle","source_ref": "1.0.6","values": {"image_version": "latest"}}' -i /projects/tech-exercise/pet-battle/test/values.yaml
@@ -128,7 +129,7 @@ We deploy each of our applications using an Argo CD `application` definition. We
128129
sed -i '/^# Pet Battle Apps/d' /projects/tech-exercise/pet-battle/test/values.yaml
129130
# stage
130131
if [[ $(yq e '.applications[] | select(.name=="pet-battle-api") | length' /projects/tech-exercise/pet-battle/stage/values.yaml) < 1 ]]; then
131-
yq e '.applications.pet-battle-api = {"name": "pet-battle-api","enabled": true,"source": "https://petbattle.github.io/helm-charts","chart_name": "pet-battle-api","source_ref": "1.5.0","values": {"image_name": "pet-battle-api","image_version": "latest", "hpa": {"enabled": false}}}' -i /projects/tech-exercise/pet-battle/stage/values.yaml
132+
yq e '.applications.pet-battle-api = {"name": "pet-battle-api","enabled": true,"source": "https://petbattle.github.io/helm-charts","chart_name": "pet-battle-api","source_ref": "1.5.0","values": {"image_name": "pet-battle-api","image_version": "latest", "hpa": {"enabled": false}}, "servicemonitor": false }' -i /projects/tech-exercise/pet-battle/stage/values.yaml
132133
fi
133134
if [[ $(yq e '.applications[] | select(.name=="pet-battle") | length' /projects/tech-exercise/pet-battle/stage/values.yaml) < 1 ]]; then
134135
yq e '.applications.pet-battle = {"name": "pet-battle","enabled": true,"source": "https://petbattle.github.io/helm-charts","chart_name": "pet-battle","source_ref": "1.0.6","values": {"image_version": "latest"}}' -i /projects/tech-exercise/pet-battle/stage/values.yaml
@@ -138,7 +139,7 @@ We deploy each of our applications using an Argo CD `application` definition. We
138139
sed -i '/^# Pet Battle Apps/d' /projects/tech-exercise/pet-battle/stage/values.yaml
139140
```
140141
141-
2. The frontend needs to have some configuration applied to it. This could be packaged up in the helm chart or baked into the image - BUT we should really apply configuration as *code*. We should build our apps once so they can be initialized in many environments with configuration supplied at runtime. For the frontend, this means supplying the information about where the API live. We use ArgoCD to manage our application deployments, hence we should update the values supplied to this chart as such.
142+
2. The frontend needs to have some configuration applied to it. This could be packaged up in the helm chart or baked into the image - BUT we should really apply configuration as *code*. We should build our apps once so they can be initialized in many environments with configuration supplied at runtime. For the frontend, this means supplying the information about where the API lives. We use ArgoCD to manage our application deployments, hence we should update the values supplied to this chart as such.
142143
143144
```bash#test
144145
export JSON="'"'{
@@ -239,30 +240,28 @@ We deploy each of our applications using an Argo CD `application` definition. We
239240
240241
![test-pet-battle-apps-topology.png](images/test-pet-battle-apps-topology.png)
241242
242-
</br>
243-
🔐🔐 If you have not seen the Keycloak Test or Stage dashboard, visit the following URL to test the access and accept the respective SSL certificate 🔐🔐
243+
### Accessing the Pet Battle Application
244244
245-
```bash#test
246-
https://keycloak-<TEAM_NAME>-test.<CLUSTER_DOMAIN>/auth
247-
https://keycloak-<TEAM_NAME>-stage.<CLUSTER_DOMAIN>/auth
248-
```
245+
As we saw when configuring the `pet-battle` application in the `values.yaml` file, it consists of three components:
249246
250-
![test-pet-battle-apps-first.png](images/keycloak.png)
247+
* **Pet Battle API**: API that serves the Pet Battle application.
248+
* **Pet Battle**: Frontend application.
249+
* **Keycloak**: Serves the authentication and authorization for the Pet Battle application.
251250
252-
</br>
253-
🔐🔐 If you have not seen the Pet Battle API service, visit the following URL to test the access and accept the respective SSL certificate 🔐🔐
251+
Let's see how to access each of these components:
254252
255-
```bash#test
256-
https://pet-battle-api-<TEAM_NAME>-test.<CLUSTER_DOMAIN>
257-
https://pet-battle-api-<TEAM_NAME>-stage.<CLUSTER_DOMAIN>
258-
```
253+
1. 🔐🔐 **Keycloak** 🔐🔐
254+
* https://keycloak-<TEAM_NAME>-test.<CLUSTER_DOMAIN>/auth
255+
* https://keycloak-<TEAM_NAME>-stage.<CLUSTER_DOMAIN>/auth
256+
257+
![test-pet-battle-apps-first.png](images/keycloak.png)
259258
260-
</br>
261-
😻😻 Finally, select the Pet Battle URL link highlighted above and you should see ... 😻😻
259+
2. 🔗🔗 **Pet Battle API** 🔗🔗
260+
* https://pet-battle-api-<TEAM_NAME>-test.<CLUSTER_DOMAIN>
261+
* https://pet-battle-api-<TEAM_NAME>-stage.<CLUSTER_DOMAIN>
262262
263-
```bash#test
264-
https://pet-battle-<TEAM_NAME>-test.<CLUSTER_DOMAIN>
265-
https://pet-battle-<TEAM_NAME>-stage.<CLUSTER_DOMAIN>
266-
```
263+
3. 😻😻 **Pet Battle** 😻😻
264+
* https://pet-battle-<TEAM_NAME>-test.<CLUSTER_DOMAIN>
265+
* https://pet-battle-<TEAM_NAME>-stage.<CLUSTER_DOMAIN>
267266
268267
![test-pet-battle-apps-first.png](images/test-pet-battle-apps-first.png)

docs/2-attack-of-the-pipelines/3-the-pipelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Pipelines
22

3-
Why creating pipelines:
3+
Why create pipelines:
44

55
* Assurance - drive up code quality and remove the need for dedicated deployment / release management teams
66
* Freedom - allow developers to take ownership of how and when code gets built and shipped
@@ -33,7 +33,7 @@ Choose your own adventure! Each group will get to perform similar tasks:
3333
| * We need to fork PetBattle (clone from GitHub and push to GitLab) | * We need to fork PetBattle API (clone from GitHub and push to GitLab) |
3434
| * Update `Jenkinsfile` task to leave out some stuff for participants | * Update Tekton task to leave out some stuff for participants |
3535
| * Add a webhook into GitLab repositories for triggering jobs | * Add webhook into GitLab repositories for triggering jobs |
36-
| * Update `pet-battle/stage/values.yaml` && `pet-battle/test/values.yaml` with services information. (That's where two teams integrate their work.) | * Update `pet-battle/stage/values.yaml` && `pet-battle/test/values.yaml` with services information. (That's where two teams integrate their work.)
36+
| * Update `pet-battle/stage/values.yaml` && `pet-battle/test/values.yaml` with services information. (That's where two groups integrate their work.) | * Update `pet-battle/stage/values.yaml` && `pet-battle/test/values.yaml` with services information. (That's where two groups integrate their work.)
3737
| * By updating version files (pom.xml etc), kick off the pipelines | * By updating version files (pom.xml etc), kick off the pipelines |
3838
| <span style="color:blue;">[jenkins](2-attack-of-the-pipelines/3a-jenkins.md)</span> | <span style="color:blue;">[tekton](2-attack-of-the-pipelines/3b-tekton.md)</span> |
3939

0 commit comments

Comments
 (0)