You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -18,21 +18,22 @@ This Micro App guidance continues to build upon the micro-services that were bui
18
18
19
19
## Using CD to deploy to Test
20
20
21
-
ArgoCD is a tool that provides continuous delivery for projects and applications. If you haven't already, be sure to read
22
-
through the [Continuous Delivery with ArgoCD guide](/continuous-delivery).
23
-
24
-
For this exercise, we are going to use ArgoCD to push the Inventory app from `dev` to `test` (and possibly `staging` as well). If you have already completed the Inventory Micro App , then it can be used for the ArgoCD process (although perhaps with some minor pipeline updates). If you haven't completed the exercise, you can start from the [solution repositories](/developer-intermediate/inventory-app#deploy-the-inventory-app-solution) to perform the ArgoCD steps.
21
+
ArgoCD is a tool that provides continuous delivery for projects and applications. For this exercise, we are going to use ArgoCD to push the Inventory app from `dev` to `test`. If you have already completed the Inventory Micro App, then it can be used for the ArgoCD process. If you haven't completed the exercise, you can start from the [solution repositories](/developer-intermediate/inventory-prebuilt-solution/) to perform the ArgoCD steps.
25
22
26
23
27
24
### Set up the GitOps repo
28
25
29
26
Let's get started with using Argo CD.
30
27
31
-
- Create a new repo from the [ArgoCD Code Pattern](https://github.com/IBM/template-argocd-gitops/generate)
28
+
- Create a new repo from the [ArgoCD Code Pattern](https://github.com/IBM/template-argocd-gitops/generate), name it something like `inv-app-gitops-{your initials}`.
32
29
33
-
- Clone the project to your machine
30
+
- On the Web Terminal, clone the repository you have just created:
@@ -42,6 +43,20 @@ Let's get started with using Argo CD.
42
43
git push -u origin test
43
44
```
44
45
46
+
- Hook the CI pipeline to the CD pipeline, using the `test` branch of the current gitops repository:
47
+
```bash
48
+
igc gitops
49
+
```
50
+
51
+
!!! note
52
+
**What just happened?**: The `igc gitops`command creates a secret `git-credentials` and a configmap named `gitops-repo`in the OpenShift project. These contain the url, username, password, and branch information for the GitOps repository. You can verify the secret was created by running:
53
+
```bash
54
+
oc get configmap/gitops-repo -n dev-{initials} -o yaml
55
+
oc get secret/git-credentials -n dev-{initials} -o yaml
56
+
```
57
+
58
+
- Manually trigger the pipeline for the Inventory Management service by going to the last pipeline run and click **Action**, then**Rerun**. When the pipeline has finished you will see a new folder on the `test` branch of the GitOps repo.
59
+
45
60
- Create the test namespace with the CLI by running `oc sync test-{initials}`
46
61
47
62
### Grant required access to the service account of the test namespace
Now that the repository has been created, we need to tell ArgoCD where it is.
58
73
59
-
- Get the ArgoCD login information from the `oc credentials` cli command
60
-
61
-
!!! note
62
-
You need to be logged into the cluster on the command-line for the CLI to access the cluster information.
63
-
64
-
- Log into ArgoCD (use `oc credentials` to obtain your credentials and login to argo)
74
+
- Log into ArgoCD using the `Cluster Argo CD` console link on the top menu of the OpenShift console.
65
75
66
76
- Click on the gear icon on the left menu to access the Settings options
67
77
@@ -80,7 +90,7 @@ on what can be done for applications that make up a project.
80
90
81
91
To create a project, do the following:
82
92
83
-
- Log into ArgoCD
93
+
- Log into ArgoCD using the `Cluster Argo CD` console link on the top menu of the OpenShift console.
84
94
85
95
- Click on the gear icon on the left menu to access the Settings options
86
96
@@ -97,61 +107,10 @@ To create a project, do the following:
97
107
- `sources` - click `add source` and pick the Git repository from the list that was added previously
98
108
- `destinations`
99
109
- Add `https://kubernetes.default.svc`for the cluster url and `test-{initials}`for the namespace
100
-
- Add `https://kubernetes.default.svc`for the cluster url and `staging-{initials}`for the namespace
101
110
102
111
**Note:** Initially, the only cluster that is available is the one in which ArgoCD is -
103
112
`https://kubernetes.default.svc`. By adding the two destinations we have allowed the project to be deployed
104
-
to both the `test-{initials}` and `staging-{initials}` namespaces within the current cluster.
105
-
106
-
### Configure the GitOps repo for Inventory Management service
107
-
108
-
- Clone the GitOps repository you created earlier, copy the folder `templates/app-helm` to the root of the repository and give it a name that matches the Inventory Management service component
109
-
(e.g. `inv-svc-{initials}`)
110
-
111
-
- Update `inv-svc-{initials}/Chart.yaml` and update the name to match the directory name
112
-
113
-
- Update `inv-svc-{initials}/requirements.yaml` with the following values:
114
-
115
-
- `name` - the name of helm chart/image. This should match the folder name
116
-
- `version` - the version number of the helm chart
117
-
- `repository` - the url to the helm repository including the folder where helm charts are being stored.
- The url of the Artifactory helm repository can be taken from the below step.
127
-
128
-
129
-
- In the Artifactory Setup screen, in Set Me Up Section, selectthe tool as "Generic" and repository as "generic-local". Copy the deploy URL from the Set Me Up dialog box. That is the Artifactory helm repository URL.
- Run `kubectl get configmap/ibmcloud-config -n tools -o yaml` to print the configuration information
133
-
for the cluster
134
-
135
-
- In `inv-svc-{initials}/values.yaml` replace `<app-chart-name>` with the directory name. Replace `ingressSubdomain` with the value from the previous step. Update `tlsSecretName` with the value from the previous step. The result should look something like the following
- Log into the ArgoCD UI and look at the state of the application. It should say `Synchronizing`.
213
-
If you don't want to wait you can manually by pressing the `Synchronize` button.
214
-
215
-
### Hook the CI pipeline to the CD pipeline
216
-
217
-
The last stage in the CI pipeline updates the version number in the `requirements.yaml` to the version of the helm chart
218
-
that was just built. Through a couple naming conventions the only thing the pipeline needs in order to interact
219
-
with the CD process is a kubernetes secret named `gitops-cd-secret` that provides the details needed
220
-
to connect to the git repo to push updates.
221
-
222
-
The [IGC CLI](/getting-started/cli) has a command that provides a helper to make the creating of a kubernetes secret
223
-
with git credentials very easy.
224
-
225
-
- Log into the cluster on the command-line and select your dev project.
226
-
227
-
- Run `igc gitops <GITOPS_REPO_URL>`. This command will prompt for the username,
228
-
personal access token, and the branch to use.
229
-
230
-
### What just happened?
231
-
232
-
- The `igc gitops` command creates a secret `git-credentials` and a configmap named `gitops-repo` in the OpenShift project. These contain the url, username, password, and branch information for the GitOps repository. You can verify the secret was created by running:
233
-
234
-
```bash
235
-
oc get configmap/gitops-repo -n dev-{initials} -o yaml
236
-
oc get secret/git-credentials -n dev-{initials} -o yaml
237
-
```
238
-
239
-
!!! note
240
-
- For the secret to be available to the CI pipeline, the secret needs to be created in the same namespace
241
-
where the pipeline is running (e.g. `dev-{initials}`).
242
-
- The value provided for `branch` is the one the pipeline will use to when committing changes to trigger
243
-
the CD pipeline. `test` is the recommended value for the branch field.
244
-
245
-
- Trigger the pipeline for the Inventory Management service to build by making a change to the Inventory Management Service code and push the changes to Git.
136
+
- Click on the newly created application. The app should be synchronizing and a graph of kubernetes resources should be shown if everything is configured correctly.
246
137
247
138
### Repeat for BFF and UI components
248
139
249
-
Starting from [Configure the GitOps repo for Inventory Management service](#configure-the-gitops-repo-for-inventory-management-service),
250
-
the steps need to be repeated for each application within the project.
140
+
Manually trigger rerun of BFF and UI pipelines and when it's finished repeat this last step to create applications for BFF and UI.
0 commit comments