ArgoCD Complementary Operator
Add ArgocdUser CRD to be able to create a static ArgoCD user for each ArgocdUser.
Also, it creates ArgoCD projects based on labels you have on the namespaces beside the users defined as ArgocdUser.
This operator extends ArgoCD functionality by providing:
- ArgocdUser CRD - Create static ArgoCD users with admin/view roles and CI credentials
- Automatic AppProject Management - Projects are automatically created and configured based on ArgocdUser resources
- Namespace-based Configuration - Use labels on namespaces to define project destinations and application sources
- RBAC Integration - Automatic ClusterRole and ClusterRoleBinding creation for user access control
- OpenShift Group Support - Automatic Group management on OpenShift clusters (skipped on vanilla Kubernetes)
- Cleanup on Deletion - Finalizer-based cleanup ensures all related resources are removed when an ArgocdUser is deleted
The operator consists of two controllers:
Watches ArgocdUser resources and manages:
| Resource | Description |
|---|---|
| AppProject | ArgoCD project with roles, policies, destinations, and source repos |
ConfigMap (argocd-cm) |
Static user account entries |
Secret (argocd-secret) |
Hashed passwords for CI users |
| ClusterRole | RBAC rules allowing users to view/edit their ArgocdUser |
| ClusterRoleBinding | Binds admin users to the ClusterRole |
| Group (OpenShift only) | OpenShift groups for admin and view users |
Watches Namespaces and updates AppProject configurations:
| Label | Description |
|---|---|
argocd.snappcloud.io/appproj |
Adds namespace as a deployment destination for the specified project(s) |
argocd.snappcloud.io/source |
Allows ArgoCD Applications to be created in this namespace for the project |
Each ArgoCD project maps to a team. Label namespaces to configure project destinations:
apiVersion: v1
kind: Namespace
metadata:
name: my-app-namespace
labels:
argocd.snappcloud.io/appproj: team-a.team-b # Projects team-a and team-b can deploy hereWhich means ArgoCD projects team-a and team-b can deploy resources into namespace my-app-namespace. Also, there are some cases in which you want to create ArgoCD applications by submitting them from the CLI instead of using the UI. For these cases, you can use ApplicationSet, or you can use your team namespace.
To allow creating ArgoCD Applications in a namespace (instead of user-argocd):
apiVersion: v1
kind: Namespace
metadata:
name: team-a-apps
labels:
argocd.snappcloud.io/appproj: team-a
argocd.snappcloud.io/source: team-a # Applications can be created hereCreate an ArgocdUser to set up a team with admin and view roles:
apiVersion: argocd.snappcloud.io/v1alpha1
kind: ArgocdUser
metadata:
name: team-a
spec:
admin:
ciPass: "secure-ci-password-for-admin"
users:
- admin@example.com
- lead@example.com
view:
ciPass: "secure-ci-password-for-view"
users:
- dev1@example.com
- dev2@example.comThis creates:
-
AppProject
team-awith:- Admin role: full access to applications, repositories, and exec
- View role: read-only access to applications, repositories, and logs
- Destinations from labeled namespaces
- Source namespaces from labeled namespaces
-
Static users in ArgoCD:
team-a-admin-ci- for CI/CD pipelines with admin accessteam-a-view-ci- for CI/CD pipelines with view access
-
RBAC resources:
- ClusterRole allowing access to the ArgocdUser resource
- ClusterRoleBinding for admin users
-
OpenShift Groups (if running on OpenShift):
team-a-admin- contains admin usersteam-a-view- contains view users
When an ArgocdUser is deleted, the operator automatically cleans up:
- The associated AppProject
- ConfigMap entries for static users
- Secret entries for passwords
- ClusterRole and ClusterRoleBinding (via OwnerReferences)
OpenShift Groups(Currently Disabled)
| Variable | Description |
|---|---|
PUBLIC_REPOS |
Comma-separated list of public repositories available to all projects |
CLUSTER_ADMIN_TEAMS |
Comma-separated list of teams with cluster-admin privileges |
make generate # Update generated code
make manifests # Generate CRD manifests
make test # Run tests
make lint # Run linterexport IMG=ghcr.io/your-repo/argocd-complementary-operator:latest
make build # Build binary locally
make docker-build # Build Docker image
make docker-push # Push to registrymake run # Run locally (for development)
make install # Install CRDs
make deploy # Deploy to Kubernetesmake undeploy # delete resouces in k8s.| Metric | Notes |
|---|---|
controller_runtime_active_workers |
Number of currently used workers per controller |
controller_runtime_max_concurrent_reconciles |
Maximum number of concurrent reconciles per controller |
controller_runtime_reconcile_errors_total |
Total number of reconciliation errors per controller |
controller_runtime_reconcile_time_seconds |
Length of time per reconciliation per controller |
controller_runtime_reconcile_total |
Total number of reconciliations per controller |
rest_client_request_latency_seconds |
Request latency in seconds. Broken down by verb and URL. |
rest_client_requests_total |
Number of HTTP requests, partitioned by status code, method, and host. |
workqueue_adds_total |
Total number of adds handled by workqueue |
workqueue_depth |
Current depth of workqueue |
workqueue_longest_running_processor_seconds |
How many seconds has the longest running processor for workqueue been running. |
workqueue_queue_duration_seconds |
How long in seconds an item stays in workqueue before being requested |
workqueue_retries_total |
Total number of retries handled by workqueue |
workqueue_unfinished_work_seconds |
How many seconds of work has been done that is in progress and hasn't been observed by work_duration. Large values indicate stuck threads. One can deduce the number of stuck threads by observing the rate at which this increases. |
workqueue_work_duration_seconds |
How long in seconds processing an item from workqueue takes. |
If you find a security vulnerability or any security related issues, please DO NOT file a public issue. Instead, send your report privately to cloud@snapp.cab. Security reports are greatly appreciated and we will publicly thank you for it.
Apache-2.0 License, see LICENSE.