Skip to content

Commit a9e9e3b

Browse files
committed
add argo workflow
Signed-off-by: Carlos Santana <[email protected]>
1 parent 8f7ac54 commit a9e9e3b

File tree

7 files changed

+598
-0
lines changed

7 files changed

+598
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# AWS Secret Manager for ArgoCD Admin Password
2+
3+
Example on how to deploy Amazon EKS with addons configured via ArgoCD.
4+
In this example we show how to deploy Argo Workflows
5+
6+
## Prerequisites
7+
Before you begin, make sure you have the following command line tools installed:
8+
- git
9+
- terraform
10+
- kubectl
11+
- argocd (brew install argocd)
12+
- argo (brew install argo)
13+
14+
## Fork the Git Repositories
15+
16+
### Fork the Addon GitOps Repo
17+
1. Fork the git repository for addons [here](https://github.com/gitops-bridge-dev/gitops-bridge-argocd-control-plane-template).
18+
2. Update the following environment variables to point to your fork by changing the default values:
19+
```shell
20+
export TF_VAR_gitops_addons_org=https://github.com/gitops-bridge-dev
21+
export TF_VAR_gitops_addons_repo=gitops-bridge-argocd-control-plane-template
22+
```
23+
24+
## Deploy the EKS Cluster
25+
Initialize Terraform and deploy the EKS cluster:
26+
```shell
27+
terraform init
28+
terraform apply -auto-approve
29+
```
30+
Retrieve `kubectl` config, then execute the output command:
31+
```shell
32+
terraform output -raw configure_kubectl
33+
```
34+
35+
### Monitor GitOps Progress for Addons
36+
Wait until all the ArgoCD applications' `HEALTH STATUS` is `Healthy`. Use Crl+C to exit the `watch` command
37+
```shell
38+
watch kubectl get applications -n argocd
39+
```
40+
41+
## Use Argo Workflows
42+
Make sure you have kubectl/KUBECONFIG setup by usind the output of `terraform output -raw configure_kubectl`
43+
Run a workflow in the `default` namespace using the service account created by the argo-workflow helm chart addon
44+
```shell
45+
argo submit -n default --serviceaccount argo-workflow https://raw.githubusercontent.com/argoproj/argo-workflows/main/examples/hello-world.yaml
46+
```
47+
Check the status of the workflow
48+
```shell
49+
argo list
50+
```
51+
Expected output:
52+
```
53+
NAME STATUS AGE DURATION PRIORITY MESSAGE
54+
hello-world-zvczz Succeeded 59s 10s 0
55+
```
56+
Get the output of the workflow
57+
```shell
58+
argo logs @latest
59+
```
60+
Expected output:
61+
```
62+
hello-world-zvczz: _____________
63+
hello-world-zvczz: < hello world >
64+
hello-world-zvczz: -------------
65+
hello-world-zvczz: \
66+
hello-world-zvczz: \
67+
hello-world-zvczz: \
68+
hello-world-zvczz: ## .
69+
hello-world-zvczz: ## ## ## ==
70+
hello-world-zvczz: ## ## ## ## ===
71+
hello-world-zvczz: /""""""""""""""""___/ ===
72+
hello-world-zvczz: ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
73+
hello-world-zvczz: \______ o __/
74+
hello-world-zvczz: \ \ __/
75+
hello-world-zvczz: \____\______/
76+
hello-world-zvczz: time="2024-01-23T20:32:24.174Z" level=info msg="sub-process exited" argo=true error="<nil>"
77+
```
78+
Use the Argo Workflow UI, use port-forward, and open url http://localhost:8080
79+
```shell
80+
kubectl port-forward -n argo-workflows svc/argo-workflows-server 8080:2746
81+
```
82+
Get authentication token using argo cli
83+
```shell
84+
argo auth token
85+
```
86+
87+
88+
## Access ArgoCD
89+
Access ArgoCD's UI, run the command from the output:
90+
```shell
91+
terraform output -raw access_argocd
92+
```
93+
94+
Destroy EKS Cluster
95+
```shell
96+
cd hub
97+
./destroy.sh
98+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: ApplicationSet
3+
metadata:
4+
name: cluster-addons
5+
namespace: argocd
6+
spec:
7+
syncPolicy:
8+
preserveResourcesOnDeletion: true
9+
generators:
10+
- clusters: {}
11+
template:
12+
metadata:
13+
name: cluster-addons
14+
spec:
15+
project: default
16+
source:
17+
repoURL: '{{metadata.annotations.addons_repo_url}}'
18+
path: '{{metadata.annotations.addons_repo_basepath}}{{metadata.annotations.addons_repo_path}}'
19+
targetRevision: '{{metadata.annotations.addons_repo_revision}}'
20+
directory:
21+
recurse: true
22+
destination:
23+
namespace: argocd
24+
name: '{{name}}'
25+
syncPolicy:
26+
automated: {}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
set -uo pipefail
4+
5+
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
ROOTDIR="$(cd ${SCRIPTDIR}/../..; pwd )"
7+
[[ -n "${DEBUG:-}" ]] && set -x
8+
9+
# Delete the Ingress/SVC before removing the addons
10+
TMPFILE=$(mktemp)
11+
terraform -chdir=$SCRIPTDIR output -raw configure_kubectl > "$TMPFILE"
12+
# check if TMPFILE contains the string "No outputs found"
13+
if [[ ! $(cat $TMPFILE) == *"No outputs found"* ]]; then
14+
source "$TMPFILE"
15+
kubectl delete -n argocd applicationset workloads
16+
kubectl delete -n argocd applicationset cluster-addons
17+
kubectl delete -n argocd applicationset addons-aws-argo-workflows-ingress
18+
kubectl delete -n argo-workflows ing --all
19+
fi
20+
21+
terraform destroy -target="module.gitops_bridge_bootstrap" -auto-approve
22+
terraform destroy -target="module.eks_blueprints_addons" -auto-approve
23+
terraform destroy -target="module.eks" -auto-approve
24+
terraform destroy -target="module.vpc" -auto-approve
25+
terraform destroy -auto-approve

0 commit comments

Comments
 (0)