# argoproj-labs/argocd-operator architecture

> Architecture diagram of the GitHub repository argoproj-labs/argocd-operator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/argoproj-labs/argocd-operator
- Repository: https://github.com/argoproj-labs/argocd-operator

## Overview

#### 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: [`cmd/main.go`](https://github.com/argoproj-labs/argocd-operator/blob/master/cmd/main.go) (Controller manager), [`config/default/kustomization.yaml`](https://github.com/argoproj-labs/argocd-operator/blob/master/config/default/kustomization.yaml) (Kustomize installation), [`controllers/argocd/argocd_controller.go`](https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocd/argocd_controller.go) (ArgoCD reconciler), [`controllers/argocd/deployment.go`](https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocd/deployment.go) (Argo CD workloads)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operator["Operator runtime"]
  node_manager{{"Controller manager<br/>Go process<br/>[main.go]"}}
  node_version["Version metadata<br/>Go package<br/>[version.go]"]
  node_container["Operator container<br/>Container build"]
end

subgraph group_api["API and admission"]
  node_argocd_api["ArgoCD v1beta1 API<br/>Custom resource API<br/>[argocd_types.go]"]
  node_conversion["v1alpha1 conversion<br/>API compatibility"]
  node_webhook["ArgoCD validation webhook<br/>Admission webhook<br/>[argocd_webhook.go]"]
end

subgraph group_controllers["Reconciliation domains"]
  node_argocd_controller{{"ArgoCD reconciler<br/>Controller"}}
  node_argocd_workloads["Argo CD workloads<br/>Resource layer<br/>[deployment.go]"]
  node_argocd_status["ArgoCD status<br/>Status writer<br/>[status.go]"]
  node_export_controller["Export reconciler<br/>Controller"]
  node_notifications["Notifications reconciler<br/>Controller"]
  node_agent["Argo CD Agent resources<br/>Controller domain<br/>[deployment.go]"]
  node_promoter["GitOps Promoter integration<br/>Controller domain<br/>[deployment.go]"]
  node_argoutil["Shared resource and security layer<br/>Reconciliation library<br/>[resource.go]"]
end

subgraph group_platform["Cluster and integrations"]
  node_cluster[("Kubernetes / OpenShift<br/>Cluster API")]
  node_certmanager["cert-manager<br/>External controller<br/>[certificate.yaml]"]
  node_observability["Prometheus monitoring<br/>Observability integration<br/>[monitor.yaml]"]
  node_external["Configured Argo CD providers<br/>External systems"]
end

subgraph group_delivery["Installation and packaging"]
  node_install["Kustomize installation<br/>Deployment assembly<br/>[kustomization.yaml]"]
  node_olm["OLM bundle<br/>Catalog package"]
end

node_container -->|"runs"| node_manager
node_version -->|"versions"| node_manager
node_argocd_api -->|"supports legacy conversion"| node_conversion
node_webhook -->|"validates"| node_argocd_api
node_manager -->|"serves"| node_webhook
node_manager -->|"watches ArgoCD"| node_argocd_controller
node_manager -->|"watches exports"| node_export_controller
node_manager -->|"watches notifications"| node_notifications
node_manager -->|"runs domain reconciliation"| node_agent
node_manager -->|"runs integration reconciliation"| node_promoter
node_argocd_controller -->|"builds topology"| node_argocd_workloads
node_argocd_controller -->|"records outcome"| node_argocd_status
node_argocd_controller -->|"uses"| node_argoutil
node_export_controller -->|"uses"| node_argoutil
node_notifications -->|"uses"| node_argoutil
node_argocd_workloads -->|"applies resources"| node_cluster
node_argocd_status -->|"updates CR status"| node_cluster
node_export_controller -->|"creates jobs and storage"| node_cluster
node_notifications -->|"applies configuration"| node_cluster
node_agent -->|"applies resources"| node_cluster
node_promoter -->|"applies resources"| node_cluster
node_argocd_workloads -.->|"connects as configured"| node_external
node_certmanager -->|"provisions certificates"| node_cluster
node_observability -.->|"scrapes metrics"| node_manager
node_install -->|"deploys"| node_manager
node_install -->|"installs"| node_webhook
node_install -->|"configures"| node_certmanager
node_install -->|"configures"| node_observability
node_olm -->|"packages deployment assets"| node_install

click node_manager "https://github.com/argoproj-labs/argocd-operator/blob/master/cmd/main.go"
click node_version "https://github.com/argoproj-labs/argocd-operator/blob/master/version/version.go"
click node_container "https://github.com/argoproj-labs/argocd-operator/blob/master/Dockerfile"
click node_argocd_api "https://github.com/argoproj-labs/argocd-operator/blob/master/api/v1beta1/argocd_types.go"
click node_conversion "https://github.com/argoproj-labs/argocd-operator/blob/master/api/v1alpha1/argocd_conversion.go"
click node_webhook "https://github.com/argoproj-labs/argocd-operator/blob/master/api/v1beta1/argocd_webhook.go"
click node_argocd_controller "https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocd/argocd_controller.go"
click node_argocd_workloads "https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocd/deployment.go"
click node_argocd_status "https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocd/status.go"
click node_export_controller "https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocdexport/argocdexport_controller.go"
click node_notifications "https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/notificationsconfiguration/notificationsconfiguration_controller.go"
click node_agent "https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocdagent/deployment.go"
click node_promoter "https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/gitopspromoter/deployment.go"
click node_argoutil "https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argoutil/resource.go"
click node_certmanager "https://github.com/argoproj-labs/argocd-operator/blob/master/config/certmanager/certificate.yaml"
click node_observability "https://github.com/argoproj-labs/argocd-operator/blob/master/config/prometheus/monitor.yaml"
click node_install "https://github.com/argoproj-labs/argocd-operator/blob/master/config/default/kustomization.yaml"
click node_olm "https://github.com/argoproj-labs/argocd-operator/blob/master/bundle/manifests/argocd-operator.clusterserviceversion.yaml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_manager,node_version,node_container toneBlue
class node_argocd_api,node_conversion,node_webhook toneAmber
class node_argocd_controller,node_argocd_workloads,node_argocd_status,node_export_controller,node_notifications,node_agent,node_promoter,node_argoutil toneMint
class node_cluster,node_certmanager,node_observability,node_external toneRose
class node_install,node_olm toneIndigo
```

## Components

### Operator runtime

- [Controller manager](https://github.com/argoproj-labs/argocd-operator/blob/master/cmd/main.go): Go process · Registers watches, reconcilers, webhooks, and metrics. · `cmd/main.go`
- [Version metadata](https://github.com/argoproj-labs/argocd-operator/blob/master/version/version.go): Go package · `version/version.go`
- [Operator container](https://github.com/argoproj-labs/argocd-operator/blob/master/Dockerfile): Container build · `Dockerfile`

### API and admission

- [ArgoCD v1beta1 API](https://github.com/argoproj-labs/argocd-operator/blob/master/api/v1beta1/argocd_types.go): Custom resource API · `api/v1beta1/argocd_types.go`
- [v1alpha1 conversion](https://github.com/argoproj-labs/argocd-operator/blob/master/api/v1alpha1/argocd_conversion.go): API compatibility · `api/v1alpha1/argocd_conversion.go`
- [ArgoCD validation webhook](https://github.com/argoproj-labs/argocd-operator/blob/master/api/v1beta1/argocd_webhook.go): Admission webhook · Validates ArgoCD resources before persistence. · `api/v1beta1/argocd_webhook.go`

### Reconciliation domains

- [ArgoCD reconciler](https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocd/argocd_controller.go): Controller · Converges ArgoCD CRs into the complete Argo CD topology. · `controllers/argocd/argocd_controller.go`
- [Argo CD workloads](https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocd/deployment.go): Resource layer · Deploys server, controllers, repo server, Dex, Redis, and ApplicationSet. · `controllers/argocd/deployment.go`
- [ArgoCD status](https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocd/status.go): Status writer · `controllers/argocd/status.go`
- [Export reconciler](https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocdexport/argocdexport_controller.go): Controller · Orchestrates export jobs and storage targets. · `controllers/argocdexport/argocdexport_controller.go`
- [Notifications reconciler](https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/notificationsconfiguration/notificationsconfiguration_controller.go): Controller · Turns notification configuration into Argo CD resources. · `controllers/notificationsconfiguration/notificationsconfiguration_controller.go`
- [Argo CD Agent resources](https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argocdagent/deployment.go): Controller domain · Reconciles agent networking, workloads, services, and RBAC. · `controllers/argocdagent/deployment.go`
- [GitOps Promoter integration](https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/gitopspromoter/deployment.go): Controller domain · Provisions Promoter operational resources. · `controllers/gitopspromoter/deployment.go`
- [Shared resource and security layer](https://github.com/argoproj-labs/argocd-operator/blob/master/controllers/argoutil/resource.go): Reconciliation library · Applies platform-sensitive resource, secret, TLS, and security behavior. · `controllers/argoutil/resource.go`

### Cluster and integrations

- **Kubernetes / OpenShift**: Cluster API · Target for workloads, RBAC, services, routes, and custom resources.
- [cert-manager](https://github.com/argoproj-labs/argocd-operator/blob/master/config/certmanager/certificate.yaml): External controller · Issues serving certificates. · `config/certmanager/certificate.yaml`
- [Prometheus monitoring](https://github.com/argoproj-labs/argocd-operator/blob/master/config/prometheus/monitor.yaml): Observability integration · Scrapes operator metrics through Prometheus resources. · `config/prometheus/monitor.yaml`
- **Configured Argo CD providers**: External systems · Git/SCM, identity, registries, and notification providers.

### Installation and packaging

- [Kustomize installation](https://github.com/argoproj-labs/argocd-operator/blob/master/config/default/kustomization.yaml): Deployment assembly · Assembles CRDs, RBAC, manager, webhooks, certificates, and metrics. · `config/default/kustomization.yaml`
- [OLM bundle](https://github.com/argoproj-labs/argocd-operator/blob/master/bundle/manifests/argocd-operator.clusterserviceversion.yaml): Catalog package · Packages the operator and dependent CRDs for catalog distribution. · `bundle/manifests/argocd-operator.clusterserviceversion.yaml`

## Connections

- 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
