Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions examples/demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Here is how to run e2e locally. Make sure that you have installed Docker and Kind.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we write down the precondition (setup) of this demo? looks like we assume we have setup one 1 hub cluster and 2 member clusters.

may be also a sentence about the goal of the demo?


1. Install mongo db
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Install mongo db
1. Install mongo db on the hub

```shell
helm install ryan-mongodb -n mongodb-system --create-namespace azure-marketplace/mongodb-sharded --set service.type=LoadBalancer,configsvr.pdb.create=true,configsvr.persistence.storageClass=managed-csi

kubectl apply -f mongo_install.yaml
```

2. Verify on the member cluster
```shell
helm list -n mongodb-system

export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace mongodb-system ryan-mongodb-mongodb-sharded -o jsonpath="{.data.mongodb-root-password}" | base64 -d)
kubectl run --namespace mongodb-system ryan-mongodb-mongodb-sharded-client --rm --tty -i --restart='Never' --image marketplace.azurecr.io/bitnami/mongodb-sharded:6.0.1-debian-11-r1 --command -- mongosh admin --host ryan-mongodb-mongodb-sharded --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD

export SERVICE_IP=$(kubectl get svc --namespace mongodb-system ryan-mongodb-mongodb-sharded --include "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}")
mongosh --host $SERVICE_IP --port 27017 --authenticationDatabase admin -p $MONGODB_ROOT_PASSWORD
```

3. Add the ArgoCD Helm
```shell
export KUBECONFIG=~/.kube/fleet-hub
helm repo add argo https://argoproj.github.io/argo-helm
helm search repo argo
```

2. Create the CRP on the hub
```shell
kubectl apply -f argoCD_install.yaml
```

3. Install the argoCD
```shell
helm install --create-namespace -n argocd-system aks-demo argo/argo-cd
```

4. Verify on one member cluster that the argoCD is installed
```shell
kubectl get crds -l app.kubernetes.io/part-of=argocd
kubectl -n argocd-system get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
kubectl port-forward svc/aks-demo-argocd-server -n argocd-system 8080:443
```
Check the argoCD web on cluster1

5. Apply the Argo application on the hub
```shell
kubectl apply -f argo-app.yaml
```

6. Check the member cluster1 and cluster2 web

7. Change the Git Repo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
7. Change the Git Repo
7. Change the Git Repo and verify that the latest changes are applied to the member cluster1 and cluster2


8. Delete the argo application
```shell
kubectl delete -f argo-app.yaml
```

9.uninstall the resources
```shell
helm delete ryan-mongodb -n mongodb-system
helm delete aks-demo -n argocd-system
kubectl delete crds -l app.kubernetes.io/part-of=argocd
kubectl delete ns argocd-system
```
21 changes: 21 additions & 0 deletions examples/demo/argo-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: in-cluster-guestbook
namespace: argocd-system
#finalizers:
# - resources-finalizer.argocd.argoproj.io
spec:
destination:
namespace: guestbook
server: https://kubernetes.default.svc
project: default
source:
path: guestbook
repoURL: https://github.com/ryanzhang-oss/argocd-example-apps/
targetRevision: argo-test
syncPolicy:
automated:
prune: true
syncOptions:
- CreateNamespace=true
28 changes: 28 additions & 0 deletions examples/demo/argoCD_install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: fleet.azure.com/v1alpha1
kind: ClusterResourcePlacement
metadata:
name: argocd-installer
spec:
resourceSelectors:
- group: ""
version: v1
kind: Namespace
name: argocd-system
- group: rbac.authorization.k8s.io
version: v1
kind: ClusterRole
labelSelector:
matchLabels:
app.kubernetes.io/part-of: argocd
- group: rbac.authorization.k8s.io
version: v1
kind: ClusterRoleBinding
labelSelector:
matchLabels:
app.kubernetes.io/part-of: argocd
- group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
labelSelector:
matchLabels:
app.kubernetes.io/part-of: argocd
10 changes: 10 additions & 0 deletions examples/demo/mongo_install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: fleet.azure.com/v1alpha1
kind: ClusterResourcePlacement
metadata:
name: mongo-installer
spec:
resourceSelectors:
- group: ""
version: v1
kind: Namespace
name: mongodb-system