An ArgoCD application watcher monitors the CRUD (Create, Read, Update, Delete) operations of ArgoCD Application custom resources (CRs) and saves the events to Redis for further processing.
- Watch CRUD Operations: Detect changes to ArgoCD Application CRs in real-time.
- Redis Integration: Save event data into a Redis database with the Redis key
<appproject-name>|<application-name>
, value:<application-cr>
.
Integrates with argocd-proxy project to enhance the ArgoCD list application API performance by reading applications from the Redis cache and performing RBAC filtering in-memory using casbin.
- ArgoCD: A working ArgoCD setup with applications.
- Kubernetes: A Kubernetes cluster where ArgoCD is deployed.
- Redis: A running Redis instance to store event data.
- Go: Installed Go environment for building and running the watcher.
-
Clone this repository:
git clone git@github.com:hsiaoairplane/argocd-watcher.git cd argocd-watcher
-
Build the watcher:
go build -o argocd-watcher *.go
-
Deploy to Kubernetes:
- Ensure Redis is running and accessible within your cluster.
- Apply the necessary RBAC roles and bindings for the watcher to access ArgoCD resources.
- Create a Kubernetes deployment for the watcher.
Example deployment:
apiVersion: apps/v1 kind: Deployment metadata: name: argocd-watcher spec: replicas: 1 selector: matchLabels: app: argocd-watcher template: metadata: labels: app: argocd-watcher spec: containers: - name: argocd-watcher image: hsiaoairplane/argocd-watcher:latest
-
Run the watcher locally for testing:
./argocd-watcher --argocd-namespace=<argocd-namespace> --redis-address=<redis-address> --redis-db=<redis-db-index>
- Flags:
--argocd-namespace
: Namespace to monitor.--redis-address
: Redis server address.--redis-db
: Redis DB index.