Skip to content

Commit 9d295f6

Browse files
Lmittieall4code
andauthored
Add How to start page, update developers guide cd and workflows pages
--------- Co-authored-by: Alexander Ulyanov <ulyanov.alexander@gmail.com>
1 parent 241905a commit 9d295f6

7 files changed

Lines changed: 251 additions & 51 deletions

File tree

724 KB
Loading

docs/assets/argocd_sync.png

439 KB
Loading
Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,48 @@
1-
The CG DevX reference implementation provides continuous delivery using a tool called ArgoCD.
1+
# Continuous Delivery with ArgoCD
2+
3+
The CG DevX reference implementation provides continuous delivery using a tool called ArgoCD. ArgoCD is a declarative, GitOps-based continuous delivery tool for Kubernetes applications. This guide provides a beginner-friendly walkthrough on how to work with ArgoCD to manage application deployments in CG DevX.
4+
5+
## Overview
6+
7+
ArgoCD integrates seamlessly with CG DevX to automate the deployment and synchronization of Kubernetes applications. It continuously monitors the **GitOps Repository** for changes and updates your cluster automatically. This guide will help you:
8+
9+
- Understand ArgoCD's core concepts.
10+
- Learn how to navigate the ArgoCD UI.
11+
- Deploy, monitor, and troubleshoot applications using ArgoCD.
12+
13+
## Core Concepts
14+
15+
Before diving in, it’s essential to understand the following concepts:
16+
17+
### **Application**
18+
An ArgoCD **Application** represents a deployed Kubernetes workload. It maps to a specific directory in your **GitOps Repository**, containing manifests that define the desired state of your application.
19+
20+
### **GitOps Repository**
21+
The GitOps repository stores Kubernetes manifests, and Terraform setups. These files define your workload and its infrastructure. Please not that ArgoCD application configuration is a part of the platform GitOps repository, not a workload GitOps repository.
22+
23+
### **Sync**
24+
The process of aligning the desired state (as defined in the GitOps Repository) with the live state in the Kubernetes cluster.
25+
26+
## Setting Up ArgoCD for Your Workload
27+
28+
### 1. **Accessing the ArgoCD Dashboard**
229

3-
ArgoCD is K8s and GitOps centric, and provides detailed visualization.
430
To access ArgoCD, follow the link in the platform GitOps repository readme file (`README.md`),
531
or provided by operators (AKA a platform team).
632

733
ArgoCD is configured to use Vault as its OIDC provider.
834

935
![argocd_login.png](../../assets/argocd_login.png)
1036

11-
You will need to press the `Log in via Vault` button, which will redirect you to Vault login page,
12-
which will look like this:
37+
You will need to press the Log in via Vault button, which will redirect you to Vault login page. Log in using the credentials (username/password or token) given to you by your platform operator.
1338

14-
<!-- All images on this page can probably be re-shot with a tighter viewport so that the text is larger. -->
1539
![vault_login.png](../../assets/vault_login_userpass.png)
1640

17-
CG DevX creates one project per workload and applies RBAC to limit access to workload dashboards and management.
41+
Once logged in, you’ll see a list of existing ArgoCD applications.
42+
43+
![argocd_applications.png](../../assets/argocd_applications.png)
1844

19-
All workload environments will be listed on the ArgoCD project page.
45+
CG DevX creates one project per workload and applies RBAC to limit access to workload dashboards and management. All workload environments will be listed on the ArgoCD project page.
2046

2147
![argocd_workload.png](../../assets/argocd_workload.png)
2248

@@ -26,3 +52,31 @@ statistics on the pod and node level, and ingress configuration.
2652
![argocd_workload_environment_tree.png](../../assets/argocd_workload_environment_tree.png)
2753
![argocd_workload_environment_resource.png](../../assets/argocd_workload_environment_resource.png)
2854
![argocd_workload_environment_network.png](../../assets/argocd_workload_environment_network.png)
55+
56+
### 2. **Deploying an Application**
57+
58+
ArgoCD automatically detects and deploys applications defined in the GitOps Repository. To deploy a workload:
59+
60+
1. Add the necessary Kubernetes manifests for your application to the GitOps Repository.
61+
2. Commit and push the changes.
62+
63+
ArgoCD will automatically sync the changes and deploy the application to your cluster.
64+
65+
![argocd_workload.png](../../assets/argocd_workload.png)
66+
67+
### 3. **Syncing Your Application**
68+
69+
ArgoCD will continuously monitor the GitOps Repository, but you can also trigger a manual sync:
70+
71+
1. In the ArgoCD dashboard, find your application.
72+
2. Click **Sync** to align the live state with the desired state from the GitOps Repository.
73+
3. Monitor the sync process and confirm successful deployment.
74+
75+
![argocd_sync.png](../../assets/argocd_sync.png)
76+
77+
## Additional Resources
78+
79+
- [Official ArgoCD Documentation](https://argo-cd.readthedocs.io/)
80+
- [Kubernetes Getting Started Guide](https://kubernetes.io/docs/tutorials/kubernetes-basics/)
81+
- [Debugging Kubernetes Deployments](https://kubernetes.io/docs/tasks/debug/)
82+
Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,64 @@
11
# Argo workflows: basic flows and templates
22

3-
CG DEVX's argo workflows approach implements following execution scheme:
3+
CG DevX leverages **Argo Workflows** to streamline CI/CD processes. Workflows defined in the `.argo` directory of your workload repository.
4+
These workflows rely on pre-configured **Cluster Workflow Templates (CWFTs)** to perform specific actions, ensuring efficiency and consistency across all workloads.
5+
6+
CG DevX's argo workflows approach implements following execution scheme:
47

58
```mermaid
69
flowchart TD
7-
node_A["GitHub Action Job Step"] --> node_B["argo workflow in .argo/"]
8-
node_B --> node_C["cwft"]
10+
node_A["GitHub Action Job Step"]
11+
node_A --> node_B["Argo Workflow in .argo/"]
12+
node_B --> node_C["CWFT"]
913
node_C --> node_D["DAG steps"]
1014
linkStyle 1 stroke:#000000
1115
```
1216

1317
&nbsp;
1418

15-
## Basic workflows
16-
17-
- **build**, which includes *build*, *lint* and *check* steps
18-
- **registry_put** places successfully builded image into the Harbor image repository
19-
- **crane_img_tag** tags images for unchanged services in the same *apps* structure
20-
- **version_change** promotes version in the version.yaml file in workload's gitops-repo.
21-
22-
## Cluster workflow templates
23-
24-
For every action workflows use cluster workflow templates consist of one or several steps to perform.
25-
In case of a list of parameters to process templates from clusterworkflow templates can be called iteratively.
26-
Cluster workflow templates are used to implement atomic phases of services images build process,
27-
except `build_chain_p_cwft`, which have a DAG inside and called in a special way: inside so-called
28-
workflow-of-workflows structure in `.argo/build-wow-wf.yaml`.
29-
30-
- build_chain_p_cwft
31-
- megalinter-cwft — lints service code using Megalinter
32-
- trivy-fs-s3-cwft — checks service fs with Trivy
33-
- kaniko-s3-p-cwft — builds tar-image with Kaniko
34-
- crane-s3-p-cwft — tags and puts image into the Harbor image repo
35-
- crane-img-tag-cwft — tags unchanged (if any) services latest images and tag it with the same tag as changed
36-
- version-changer-cwft — change version in version.yaml in gitops-repo
37-
19+
## How It Works
20+
21+
1. **GitHub Actions Job**: When triggered, a step from your GitHub Actions job submits an Argo Workflow.
22+
23+
2. **Argo Workflow Submission**: The Argo Workflow acts as orchestrator, submitting tasks to CWFTs.
24+
25+
3. **Cluster Workflow Templates (CWFTs)**
26+
Cluster Workflow Templates (CWFTs) are reusable building blocks that execute individual tasks, such as building images or scanning code. They are centrally defined and shared across workloads.
27+
28+
4. **DAG Steps**
29+
Some CWFTs, like _build_chain_p_cwft_, use a Directed Acyclic Graph (DAG) to handle tasks with dependencies, allowing for parallel execution wherever possible.
30+
31+
## Basic Workflows
32+
33+
The `.argo` directory in your workload repository contains workflows for common CI/CD tasks:
34+
35+
- **build-wow-wf**
36+
Handles building, linting, and running quality checks to prepare your workload for deployment.
37+
38+
- **crane-p-wf**
39+
Pushes successfully built Docker images to the Harbor container registry.
40+
41+
- **crane-img-tag-wf**
42+
Updates tags for unchanged services to keep their versions aligned with the new ones.
43+
44+
- **version_changer-wf**
45+
Updates the `version.yaml` file in the GitOps repository with the latest versions for deployment.
46+
47+
## Key Cluster Workflow Templates
48+
49+
- **build_chain_p_cwft**
50+
Orchestrates the build process through a series of steps:
51+
- **megalinter-cwft**: Lints the code to ensure it meets quality standards.
52+
- **trivy-fs-s3-cwft**: Scans the filesystem for vulnerabilities.
53+
- **kaniko-s3-p-cwft**: Builds container tar-images with Kaniko.
54+
55+
- **crane-s3-p-cwft**
56+
Pushes built tar-image to the Harbor container registry.
57+
58+
- **crane-img-tag-cwft**
59+
Updates tags for unchanged services to keep them consistent with updated ones.
60+
61+
- **version-changer-cwft**
62+
Updates the `version.yaml` file in the GitOps repository for the dev environment to reference the latest image versions.
63+
64+
Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,74 @@
11
# Github Action Workflow Structure
22

3-
CI Github Action start is triggered by push new tag to the workload repo.
4-
All the CI chain elements run from the steps of job `multi_service_parallel_build` described
5-
in `multi_service_parallel_build.yml`. If one of the steps fails, the Github action fails completely. Some steps are
6-
simple bash executed on the runner, another are submissions of relatively complex argo workflows. The workflow structure
7-
is linear: steps are executed one after another.
3+
The **multi_service_parallel_build** GA workflow in CG DevX automates the process of building, testing, and pushing container images for your workload. It is designed to handle multiple services efficiently, making it ideal for microservices architectures.
4+
5+
## What Does This Workflow Do?
6+
7+
The workflow focuses on the following tasks:
8+
9+
1. **Build Container Images**: Builds Docker images for all changed services in your repository.
10+
2. **Push to Container Registry**: Uploads the built images to the Harbor container registry for deployment.
11+
3. **Update GitOps Repository**: Updates deployment manifests in the GitOps repository to reflect new image versions.
12+
13+
## How Is It Triggered?
14+
15+
The workflow starts automatically when a tag is pushed. For example, pushing a tag like `v1.0.0` to your workload repository triggers the workflow.
16+
17+
## Key Steps
18+
19+
All the CI chain elements run as part of the job `multi_service_parallel_build`, described in the `multi_service_parallel_build.yml` file located in the `.github/workflows` directory of your workload repository.
20+
21+
If any step fails, the entire GitHub Action fails. Some steps are simple bash scripts executed on the runner, while others involve submitting more complex workflows to Argo Workflows. You can find these workflows in `.argo` directory of your workload repository.
22+
23+
The workflow follows a linear structure: steps are executed sequentially, one after another.
824

925
```mermaid
1026
---
11-
title: multi_service_parallel_build workflow chart
27+
title: multi_service_parallel_build workflow chart
1228
---
1329
flowchart
1430
n1["`**semver_chk**`"
15-
cheks if tag matchs SEMVER format
31+
Validates SEMVER tag format
1632
]--if not SEMVER tag, exit-->
1733
n2["`**actions/checkout@v4**`"
34+
Checks out the workload repository
1835
]-->
1936
n3["`**argo_cli_install**
20-
installs _argo cli_ on runner`"]-->
37+
Installs the Argo CLI for workflow submission
38+
`"]-->
2139
n4["`**build**`"
22-
checks build conditions, detects repo changes and submits workflow of services build workflows
40+
Detects modified services and submits the _build-wow-wf_ argo workflow to build Docker images for them using Kaniko
2341
]-- if any build fails, exit -->
24-
n41["`**trivy_libs**
25-
if _#quot;apps#quot;_ structure, submits _trivy-libs-wf_ workflow to scan shared libs source code in _libs_ directory.
42+
n5["`**trivy_libs**
43+
Submits _trivy-libs-wf_ argo workflow to scan shared libraries with Trivy (if workload follows _#quot;apps#quot;_ structure)
2644
`"]-->
27-
n5["`**registry_put**
28-
submits _crane_ workflow to tag and put images to Harbor`"
29-
]-- if any put fails, exit -->
30-
n6["`**up_tags**
31-
submits _crane-img-tag_ workflow to up the tag for unchanged services (if any)
45+
n6["`**registry_put**
46+
Submits _crane-p-wf_ argo workflow to tag and push built images to Harbor
47+
`"]-- if any push fails, exit -->
48+
n7["`**up_tags**
49+
Submits _crane-img-tag-wf_ argo workflow to update tags for unchanged services in apps structure
3250
`"]-->
33-
n7["`**version_change**
34-
submits _version_change_ workflow to change version in gitops repo
51+
n8["`**version_change**
52+
Submits _version_changer-wf_ argo workflow to update GitOps manifests with new image tags
3553
`"]
3654
```
55+
56+
## Core Tools
57+
58+
- **Kaniko**: Used for building container images directly in the CI environment without requiring a local Docker daemon. Learn more about Kaniko workflow [here](kaniko_build.md).
59+
- **Trivy**: A security scanner that detects vulnerabilities in shared libraries. Learn more about Trivy workflow [here](trivy.md).
60+
- **Harbor**: A container image registry where built images are stored for deployment. Learn more about Harbor registry [here](../artifacts/registry.md).
61+
62+
## Monitoring the Workflow
63+
64+
You can monitor the status of builds and workflows:
65+
66+
1. **GitHub Actions UI**: Provides logs for each step in the workflow.
67+
2. **Argo Workflows Dashboard**: Displays the status of submitted workflows and provides detailed logs.
68+
69+
## Example Flow
70+
71+
1. A developer pushes the tag `1.0.0` to the repository.
72+
2. The workflow detects changes in `wl-service-name/src/` directory.
73+
3. Docker image for `wl-service-name:1.0.0` is built and pushed to the registry.
74+
4. The GitOps repository `version.yaml` manifest is updated to reference the new image version.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# How to Start
2+
3+
This guide walks you through the initial steps to start working with your workload in CG DevX. By following these instructions, you'll learn how to prepare your workload repository, build your application, and deploy it to Kubernetes.
4+
5+
## Overview
6+
7+
CG DevX simplifies the adoption of modern development practices by integrating open-source tools into a cohesive platform. Getting started involves these key steps:
8+
9+
- Requesting repository setup.
10+
- Preparing your workload repository.
11+
- Building and deploying your workload.
12+
- Monitoring your deployment.
13+
14+
Each step is designed to minimize manual intervention, allowing you to focus on application development.
15+
16+
## Step 1: Request Repository Setup
17+
18+
Before starting, request your platform operator to provision the necessary repositories for you. By default, you'll receive:
19+
20+
- **Workload Repository**:
21+
Stores your application's source code and the `Dockerfile` for containerization. Learn more about workload concepts in the [Workloads Guide](workloads/concept.md).
22+
23+
- **GitOps Repository**:
24+
Contains Kubernetes manifests, Terraform configurations, and environment-specific values for managing deployments. Learn more about GitOps structure and environments in the [How to Model Your Environments](workloads/gitops_environments.md).
25+
26+
> **Why it matters**: These repositories separate application logic from infrastructure, ensuring clear boundaries and maintainability.
27+
28+
For more details on the structure of these repositories, refer to the [Bootstrap Templates Guide](../operators_guide/workload_management/bootstrap_templates.md).
29+
30+
## Step 2: Prepare Your Workload Repository
31+
32+
Once you have access to the **Workload Repository**, add your application’s source code and customize the provided `Dockerfile` to match your workload’s requirements.
33+
34+
- Use the [CG DevX Workload Template](https://github.com/CloudGeometry/cg-devx-wl-template) as a basic starting point for your repository setup.
35+
- As a real-world example, check out [CG DevX CNASK Workload](https://github.com/CloudGeometry/cg-devx-wl-cnask) for a working implementation.
36+
37+
## Step 3: Build and Deploy Your Workload
38+
39+
The next step is to build and deploy your application. This process is automated via CG DevX’s CI/CD pipelines.
40+
41+
### Trigger the Build
42+
43+
Push a tag to your Workload Repository to trigger the build process:
44+
45+
```bash
46+
git tag v0.0.1
47+
git push origin v0.0.1
48+
```
49+
50+
### Behind the Scenes
51+
52+
When you push a tag to your **Workload Repository**:
53+
54+
1. **GitHub Actions** submits an **Argo Workflow** with the required parameters.
55+
2. **Argo Workflow** builds the container image, pushes it to the registry, and updates the **GitOps Repository**.
56+
3. **ArgoCD** syncs the updated configurations and deploys your application.
57+
58+
This automated pipeline streamlines building, deploying, and syncing your workload.
59+
60+
## Step 4: Monitor Your Deployment
61+
62+
Once deployed, you can verify your application and monitor its performance:
63+
64+
### Access Your Application
65+
66+
- Navigate to the **Ingress URL** listed in the ArgoCD dashboard to access your application.
67+
68+
### Monitor Logs and Metrics
69+
70+
- **Metrics**: Use [Grafana](observability/monitoring.md) to track application performance and resource usage.
71+
- **Dashboards**: Explore the [pre-configured Grafana dashboards](observability/dashboards.md) to visualize metrics and monitor workload health.
72+
- **Logs**: Use [Loki](observability/log_management.md) for centralized log aggregation and troubleshooting.
73+
74+
## Step 5: Troubleshoot Issues
75+
76+
If the deployment encounters any issues, use the following tools to diagnose and resolve them:
77+
78+
- **Argo Workflows**: Review the [Argo Workflows dashboard](ci/integration.md) for details on pipeline execution.
79+
- **ArgoCD Dashboard**: Check deployment logs directly in the ArgoCD dashboard for insights into application issues.
80+
- **Loki Logs**: Use [Loki](observability/log_management.md) to analyze application and Kubernetes logs for potential errors.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ nav:
5151
- operators_guide/delivery_pipelines/core_services_delivery.md
5252

5353
- 'Developers Guide':
54+
- developers_guide/getting_started.md
5455
- developers_guide/concept.md
5556
- 'Workloads':
5657
- developers_guide/workloads/concept.md

0 commit comments

Comments
 (0)