How argoproj-labs/argocd-operator works
Purpose and runtime
This is a Go Kubernetes operator that manages Argo CD installations through custom resources. Its manager process watches desired-state CRs, reconciles Kubernetes/OpenShift resources, and records operational status. Main entry point: cmd/main.go; versioning: version/version.go; container runtime definition: Dockerfile.
API contract and admission boundary
The operator exposes ArgoCD, ArgoCDExport, NotificationsConfiguration, and namespace-management APIs, with both v1alpha1 and v1beta1 compatibility/conversion paths. Webhook logic validates Argo CD resources before persistence. CRD schemas are generated/deployed separately from reconciliation code.
• api/v1beta1/argocd_types.go
• api/v1alpha1/argocd_conversion.go
• api/v1beta1/argocd_webhook.go
Primary Argo CD reconciliation
controllers/argocd is the central control plane. It translates an ArgoCD spec into the Argo CD component topology—server, application controller, repo server, Redis, Dex/SSO, ApplicationSet, services, routes/ingress, RBAC, secrets/configuration, monitoring, and status. Reconciliation is declarative and idempotent: Kubernetes resources are created/updated/deleted to converge on the CR specification.
• controllers/argocd/argocd_controller.go
• controllers/argocd/deployment.go
• controllers/argocd/status.go
Supporting controller domains
Independent controllers manage specialized desired-state domains:
• Exports orchestrate jobs and targets such as local/PVC or cloud-backed storage: controllers/argocdexport/argocdexport_controller.go, controllers/argocdexport/job.go, controllers/argocdexport/storage.go.
• Notification configuration is converted into Argo CD configuration resources: controllers/notificationsconfiguration/notificationsconfiguration_controller.go, controllers/notificationsconfiguration/reconcile.go.
• Argo CD Agent support reconciles principal/agent-side networking, workload, service, and RBAC resources: controllers/argocdagent/deployment.go, controllers/argocdagent/networkpolicy.go.
• GitOps Promoter deployment integration provisions its operational resources: controllers/gitopspromoter/deployment.go, controllers/gitopspromoter/controllerconfiguration.go.
Shared resource and security layer
Argo CD reconcilers share utilities for environment/configuration, namespaces, resource mutation, secrets, TLS, security contexts, volumes, logging, and Redis configuration. This is the principal boundary for platform-sensitive behavior, including TLS/FIPS and credential handling.
• controllers/argoutil/resource.go
• controllers/argoutil/secret.go
• controllers/argoutil/tls.go
Cluster infrastructure and external integrations
The operator runs against Kubernetes and supports OpenShift-specific resources such as Routes. It manages Argo CD’s Redis deployment, including HA/sentinel templates, and integrates with cert-manager for serving certificates. Observability is exposed through manager metrics and Prometheus resources. Argo CD itself connects onward to Git/SCM, identity providers via Dex/SSO, registries/image updater, and notification providers as configured in CRs.
• build/redis/redis.conf.tpl
• config/certmanager/certificate.yaml
• config/prometheus/monitor.yaml
Installation and packaging flow
Kustomize assembles CRDs, RBAC, manager deployment, webhooks, certificates, and metrics into a default install. Operator Lifecycle Manager artifacts package the same operator for catalog distribution; bundle manifests include dependent CRDs such as Argo CD and Promoter APIs.
• config/default/kustomization.yaml
• config/manager/manager.yaml
• bundle/manifests/argocd-operator.clusterserviceversion.yaml
Main entry points: main.go Controller manager · kustomization.yaml Kustomize installation · argocd_controller.go ArgoCD reconciler · deployment.go Argo CD workloads
Components 20
Operator runtime
- Controller manager · Registers watches, reconcilers, webhooks, and metrics.
cmd/main.go - Version metadata
version/version.go - Operator container
Dockerfile
API and admission
- ArgoCD v1beta1 API
api/v1beta1/argocd_types.go - v1alpha1 conversion
api/v1alpha1/argocd_conversion.go - ArgoCD validation webhook · Validates ArgoCD resources before persistence.
api/v1beta1/argocd_webhook.go
Reconciliation domains
- ArgoCD reconciler · Converges ArgoCD CRs into the complete Argo CD topology.
controllers/argocd/argocd_controller.go - Argo CD workloads · Deploys server, controllers, repo server, Dex, Redis, and ApplicationSet.
controllers/argocd/deployment.go - ArgoCD status
controllers/argocd/status.go - Export reconciler · Orchestrates export jobs and storage targets.
controllers/argocdexport/argocdexport_controller.go - Notifications reconciler · Turns notification configuration into Argo CD resources.
controllers/notificationsconfiguration/notificationsconfiguration_controller.go - Argo CD Agent resources · Reconciles agent networking, workloads, services, and RBAC.
controllers/argocdagent/deployment.go - GitOps Promoter integration · Provisions Promoter operational resources.
controllers/gitopspromoter/deployment.go - Shared resource and security layer · Applies platform-sensitive resource, secret, TLS, and security behavior.
controllers/argoutil/resource.go
Cluster and integrations
- Kubernetes / OpenShift · Target for workloads, RBAC, services, routes, and custom resources.
- cert-manager · Issues serving certificates.
config/certmanager/certificate.yaml - Prometheus monitoring · Scrapes operator metrics through Prometheus resources.
config/prometheus/monitor.yaml - Configured Argo CD providers · Git/SCM, identity, registries, and notification providers.
Installation and packaging
- Kustomize installation · Assembles CRDs, RBAC, manager, webhooks, certificates, and metrics.
config/default/kustomization.yaml - OLM bundle · Packages the operator and dependent CRDs for catalog distribution.
bundle/manifests/argocd-operator.clusterserviceversion.yaml
Connections 29
- Operator container → Controller manager: runs
- Version metadata → Controller manager: versions
- ArgoCD v1beta1 API → v1alpha1 conversion: supports legacy conversion
- ArgoCD validation webhook → ArgoCD v1beta1 API: validates
- Controller manager → ArgoCD validation webhook: serves
- Controller manager → ArgoCD reconciler: watches ArgoCD
- Controller manager → Export reconciler: watches exports
- Controller manager → Notifications reconciler: watches notifications
- Controller manager → Argo CD Agent resources: runs domain reconciliation
- Controller manager → GitOps Promoter integration: runs integration reconciliation
- ArgoCD reconciler → Argo CD workloads: builds topology
- ArgoCD reconciler → ArgoCD status: records outcome
- ArgoCD reconciler → Shared resource and security layer: uses
- Export reconciler → Shared resource and security layer: uses
- Notifications reconciler → Shared resource and security layer: uses
- Argo CD workloads → Kubernetes / OpenShift: applies resources
- ArgoCD status → Kubernetes / OpenShift: updates CR status
- Export reconciler → Kubernetes / OpenShift: creates jobs and storage
- Notifications reconciler → Kubernetes / OpenShift: applies configuration
- Argo CD Agent resources → Kubernetes / OpenShift: applies resources
- GitOps Promoter integration → Kubernetes / OpenShift: applies resources
- Argo CD workloads → Configured Argo CD providers: connects as configured
- cert-manager → Kubernetes / OpenShift: provisions certificates
- Prometheus monitoring → Controller manager: scrapes metrics
- Kustomize installation → Controller manager: deploys
- Kustomize installation → ArgoCD validation webhook: installs
- Kustomize installation → cert-manager: configures
- Kustomize installation → Prometheus monitoring: configures
- OLM bundle → Kustomize installation: packages deployment assets