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
- On Medium: <https://medium.com/@bertelli.luca/ephemeral-test-environments-for-ci-workflows>
9
9
10
-
## How to use vCluster, ArgoCD Events and Argo Workflow to manage short-live test ephemeral environments
10
+
## How to use vClusterand Argo Workflow to manage ephemeral test environments
11
11
12
12
Project structure:
13
13
14
14
```text
15
15
.
16
-
├── argo
17
-
│ ├── events
18
-
│ └── workflow
19
-
│ └── lang
20
-
├── hello-world-app
21
-
└── vcluster
16
+
├── argo-workflow
17
+
│ └── lang
18
+
└── hello-world-app
22
19
```
23
20
24
-
-`argo` folder: All configurations made for
25
-
-`events`: Argo Events webhook, trigger (for Argo Workflow), and sensor
26
-
-`workflow`: CI/CD pipeline triggered by Argo Events
27
-
-`lang`: ArgoWorkflow Templates for supported languages
21
+
-`argo-workflow`: CI/CD pipeline templates
22
+
-`lang`: ArgoWorkflow Templates for supported languages
28
23
-`hello-world-app` folder: Go Hello world application that prints a beautiful octopus 🐙 in ASCII code
29
-
-`vcluster` folder: All configurations made for creating VCluster where deploy the hello world application
30
24
31
25
Key highlights from the article include:
32
26
33
-
1.**vCluster Usage**: The article introduces vCluster as a pivotal tool for creating lightweight, ephemeral Kubernetes clusters. It's so interesting how vCluster can be employed to instantiate and manage test environments on-demand, covering the scenarios where temporary clusters are essential for testing purposes.
27
+
1.**vCluster Usage**: The article introduces vCluster as a pivotal tool for creating lightweight, ephemeral Kubernetes clusters. It's interesting how vCluster can be employed to instantiate and manage test environments on-demand, covering the scenarios where temporary clusters are essential for testing.
34
28
35
-
2.**Argo Events Integration**: The article explores the integration of Argo Events, a tool designed for event-driven architecture in Kubernetes. It details how Argo Events can be utilized to trigger and manage events received from the SCM to manage the lifecycle of short-lived test environments. This allows for dynamic and automated responses to changes in the testing and security requirements.
36
-
37
-
3.**Argo Workflow Implementation**: The article delves into the integration of Argo Workflow, a workflow engine for Kubernetes. It provides insights into how Argo Workflow can be configured to orchestrate the deployment, testing, and teardown processes efficiently. The tool enables the final user to define also another kind of process drawing DAGs (<https://argoproj.github.io/argo-workflows/walk-through/dag/>). This feature supports complex scenarios where there is a requirement to maximize parallelism when running tasks.
29
+
2.**Argo Workflow Implementation**: The article delves into the integration of Argo Workflow, a workflow engine for Kubernetes, providing a way to configure the orchestration of the deployment, testing, and teardown processes efficiently. The tool also enables the final user to define another kind of process drawing DAGs (<https://argoproj.github.io/argo-workflows/walk-through/dag/>). This feature supports complex scenarios where there is a requirement to maximize parallelism when running tasks.
Now you can access the Argo Workflows UI by navigating to `http://localhost:2746` in your web browser.
56
+
Now, you can access the Argo Workflows UI by navigating to `http://localhost:2746` in your web browser.
57
57
58
58
### 5. Add privileges to Argo service accounts
59
59
60
-
> Add this privileges to the Argo service accounts are recommended only for demo purposes. **IT'S STRONGLY NOT RECOMMENDED TO REPLICATE THIS CONFIGURATION IN PRODUCTION EVINRONMENTS.**
60
+
> Add these privileges to the Argo service accounts are recommended only for demo purposes. **IT'S STRONGLY NOT RECOMMENDED TO REPLICATE THIS CONFIGURATION IN PRODUCTION ENVIRONMENTS.**
61
61
62
62
This command adds `cluster-admin` clusterrole to `argo:argo-server` and `argo:default`. In this way, Argo Workflow can manage every kind of resource in every namespace of the cluster.
> In production evironments it's strongly recommended to create a dedicated role to these service accounts allowing only required verbs on the resources managed by the workflows.
69
+
> In production environments, creating a dedicated role for these service accounts is strongly recommended, allowing only required verbs on the resources managed by the workflows.
70
70
71
71
### 6. Prepare secrets required by the pipelines
72
72
73
-
Just in case of a private Git repository you can run this command to allow the clone command executed by the pipeline `ci.yaml`:
73
+
Just in case of a private Git repository, you can run this command to allow the clone command executed by the pipeline `ci.yaml`:
@@ -111,18 +111,16 @@ Alternatively, you can submit the workflow using the UI:
111
111
112
112

113
113
114
-
The CI pipeline performs these steps:
114
+
The CI pipeline performs these steps inside the [ci.yaml](https://github.com/banshee86vr/ephemeral-test-environment/blob/main/argo-workflow/ci.yaml) manifest:
115
115
116
116
1.**Cloning Repository**: Fetches the source code from the git repository.
117
-
2.**Building Application**: Utilizes the GoLang template to compile the Go application.
117
+
2.**Building Application**: Utilizes the GoLang template [go.yaml](https://github.com/banshee86vr/ephemeral-test-environment/blob/main/argo-workflow/lang/go.yaml)to compile the Go application.
118
118
3.**Building and Pushing Docker Image**: Packages the application into a Docker image and pushes it to the registry.
119
119
120
-
After the completion of all steps, you can check the correct status of every step:
120
+
After the completion of all steps, you can check the correct status of every step and locate the updated Docker image in your registry:
121
121
122
122

123
123
124
-
If all steps have been completed, you can find a new version of the Docker image in your registry.
125
-
126
124
### 9. Submit the CD pipeline
127
125
128
126
To submit the CD pipeline, you can use the [official APIs](https://argo-workflows.readthedocs.io/en/latest/rest-api/):
@@ -135,17 +133,15 @@ Alternatively, you can submit the workflow using the UI:
135
133
136
134

137
135
138
-
The CD pipeline performs these steps:
136
+
The CD pipeline performs these steps inside the [cd.yaml](https://github.com/banshee86vr/ephemeral-test-environment/blob/main/argo-workflow/cd.yaml) manifest:
139
137
140
-
1.**Preparing an ephemeral environment**: Prepares an ephemeral environment using vCluster where the user can test the application inside an isolated Kubernetes cluster
141
-
2.**Deploy the application**: Deploy the application Helm chart on the vCluster just created
138
+
1.**Preparing an ephemeral environment**: Prepares a temporary environment using vCluster where the user can test the application inside an isolated Kubernetes cluster.
139
+
2.**Deploy the application**: Deploy the application Helm chart on the vCluster just created.
142
140
143
141
After the completion of all steps, you can check the correct status of every step:
144
142
145
143

146
144
147
-
If all steps have been completed, you can check the status of your application deployed on the vCluster just created
148
-
149
145
### 10. Access to the application
150
146
151
147
To check how to access the application deployed on vCluster, you can run these commands to list all vCluster and to access it:
As reported [here](https://www.vcluster.com/docs/using-vclusters/access) you can expose in different ways the ephemeral vCluster created.
167
-
168
-
-**Via Ingress**: An Ingress Controller with SSL passthrough support will provide the best user experience, but there is a workaround if this feature is not natively supported.
169
-
170
-
- Kubernetes Nginx
171
-
- Traefik Proxy
172
-
- Emissary
162
+
As reported [here](https://www.vcluster.com/docs/using-vclusters/access), you can expose the ephemeral vCluster created differently.
173
163
174
-
Make sure your ingress controller is installed and healthy on the cluster that will host your virtual clusters. More details [here](https://www.vcluster.com/docs/using-vclusters/access#via-ingress)
164
+
-**Via Ingress**: An Ingress Controller with SSL passthrough support will provide the best user experience. Ensure your ingress controller is installed and healthy on the cluster hosting your virtual clusters. More details [here](https://www.vcluster.com/docs/using-vclusters/access#via-ingress)
175
165
-**Via LoadBalancer service**: The easiest way is to use the flag `--expose` in vcluster create to tell vCluster to use a LoadBalancer service. It depends on the specific implementation of the host Kubernetes cluster.
176
-
-**Via NodePort service**: You can also expose the vCluster via a NodePort service. In this case, you have to create a NodePort service and change the `values.yaml` file to use for the creation of the vCluster. More details [here](https://www.vcluster.com/docs/using-vclusters/access#via-nodeport-service)
177
-
-**From Host **Cluster**: To access the virtual cluster from within the host cluster, you can directly connect to the vCluster service. Make sure you can access that service and then create a kube config in the following form:
166
+
-**Via NodePort service**: You can also expose the vCluster via a NodePort service. In this case, you must create a NodePort service and change the `values.yaml` file to use for the creation of the vCluster. More details [here](https://www.vcluster.com/docs/using-vclusters/access#via-nodeport-service)
167
+
-**From Host Cluster**: To access the virtual cluster from within the host cluster, you can directly connect to the vCluster service. Make sure you can access that service and then create a kube config in the following form:
0 commit comments