# openshift/cluster-image-registry-operator architecture

> Architecture diagram of the GitHub repository openshift/cluster-image-registry-operator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openshift/cluster-image-registry-operator
- Repository: https://github.com/openshift/cluster-image-registry-operator

## Overview

The Image Registry Operator creates and reconciles the cluster’s singleton registry configuration and workload. Its main workflow is to start the operator, bootstrap or read the registry configuration, select storage, and reconcile Kubernetes resources; it also manages the image pruner and auxiliary cloud-specific behavior. README-documented configuration, certificates, routes, status, and storage capabilities are represented. Some subsystem links rely on README statements or source-index references because their implementation excerpts were not provided.

Main entry points: [`pkg/operator/controller.go`](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/controller.go) (Registry controller), [`pkg/storage/storage.go`](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/storage.go) (Storage selection), [`cmd/cluster-image-registry-operator/main.go`](https://github.com/openshift/cluster-image-registry-operator/blob/main/cmd/cluster-image-registry-operator/main.go) (Operator entrypoint), [`pkg/resource/generator.go`](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/resource/generator.go) (Workload resources)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Operator runtime"]
  node_operator_entry["Operator entrypoint<br/>[main.go]"]
  node_operator_runner["Operator runner<br/>[starter.go]"]
  node_metrics["Metrics server<br/>[server.go]"]
end

subgraph group_reconcile["Registry reconciliation"]
  node_registry_config[("Registry config")]
  node_registry_controller["Registry controller<br/>[controller.go]"]
  node_bootstrap["Config bootstrap<br/>[bootstrap.go]"]
  node_resource_generator["Workload resources<br/>[generator.go]"]
  node_service_resource["Registry service<br/>[service.go]"]
  node_service_ca["Service CA<br/>[serviceca.go]"]
  node_certificates["Registry certificates"]
  node_status["Operator status<br/>[status.go]"]
end

subgraph group_storage["Storage backends"]
  node_storage_selector["Storage selection<br/>[storage.go]"]
  node_s3["S3 storage<br/>[s3.go]"]
  node_azure["Azure storage<br/>[azure.go]"]
  node_gcs["GCS storage<br/>[gcs.go]"]
  node_ibmcos["IBM COS storage<br/>[ibmcos.go]"]
  node_swift["Swift storage<br/>[swift.go]"]
  node_pvc["PVC storage<br/>[pvc.go]"]
  node_emptydir["EmptyDir storage<br/>[emptydir.go]"]
end

subgraph group_auxiliary["Auxiliary controllers"]
  node_pruner_controller["Image pruner"]
  node_pruner_resources["Pruner resources"]
  node_aws_tags["AWS tag controller"]
  node_azure_path_fix["Azure path fix"]
end

node_cluster(("Cluster configuration"))
node_registry_workload[("Registry deployment")]
node_route_config[("Routes")]

node_cluster -->|"starts"| node_operator_entry
node_operator_entry -->|"runs"| node_operator_runner
node_operator_entry -->|"starts"| node_metrics
node_operator_runner -.->|"runs"| node_registry_controller
node_cluster -->|"configures"| node_registry_config
node_registry_controller -->|"reads"| node_registry_config
node_registry_controller -->|"bootstraps"| node_bootstrap
node_bootstrap -->|"creates"| node_registry_config
node_registry_controller -->|"reconciles"| node_resource_generator
node_resource_generator -.->|"uses"| node_service_resource
node_resource_generator -.->|"uses"| node_service_ca
node_registry_controller -->|"manages"| node_registry_workload
node_registry_controller -->|"manages"| node_route_config
node_registry_controller -->|"manages"| node_certificates
node_registry_controller -->|"reports"| node_status
node_registry_controller -->|"selects"| node_storage_selector
node_storage_selector -->|"selects"| node_s3
node_storage_selector -->|"selects"| node_azure
node_storage_selector -->|"selects"| node_gcs
node_storage_selector -->|"selects"| node_ibmcos
node_storage_selector -->|"selects"| node_swift
node_storage_selector -->|"selects"| node_pvc
node_storage_selector -->|"selects"| node_emptydir
node_registry_controller -.->|"starts"| node_pruner_controller
node_pruner_controller -->|"generates"| node_pruner_resources
node_registry_controller -.->|"coordinates"| node_aws_tags
node_registry_controller -.->|"coordinates"| node_azure_path_fix

click node_operator_entry "https://github.com/openshift/cluster-image-registry-operator/blob/main/cmd/cluster-image-registry-operator/main.go"
click node_operator_runner "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/starter.go"
click node_registry_controller "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/controller.go"
click node_bootstrap "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/bootstrap.go"
click node_resource_generator "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/resource/generator.go"
click node_service_resource "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/resource/service.go"
click node_service_ca "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/resource/serviceca.go"
click node_certificates "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/imageregistrycertificates.go"
click node_status "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/status.go"
click node_storage_selector "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/storage.go"
click node_s3 "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/s3/s3.go"
click node_azure "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/azure/azure.go"
click node_gcs "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/gcs/gcs.go"
click node_ibmcos "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/ibmcos/ibmcos.go"
click node_swift "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/swift/swift.go"
click node_pvc "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/pvc/pvc.go"
click node_emptydir "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/emptydir/emptydir.go"
click node_pruner_controller "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/controllerimagepruner.go"
click node_pruner_resources "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/resource/generatorimagepruner.go"
click node_aws_tags "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/awstagcontroller.go"
click node_azure_path_fix "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/azurepathfixcontroller.go"
click node_metrics "https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/metrics/server.go"

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_operator_entry,node_operator_runner,node_metrics toneBlue
class node_registry_config,node_registry_controller,node_bootstrap,node_resource_generator,node_service_resource,node_service_ca,node_certificates,node_status,node_registry_workload,node_route_config toneAmber
class node_storage_selector,node_s3,node_azure,node_gcs,node_ibmcos,node_swift,node_pvc,node_emptydir toneMint
class node_pruner_controller,node_pruner_resources,node_aws_tags,node_azure_path_fix toneRose
class node_cluster toneIndigo
```

## Components

### Operator runtime

- [Operator entrypoint](https://github.com/openshift/cluster-image-registry-operator/blob/main/cmd/cluster-image-registry-operator/main.go): `cmd/cluster-image-registry-operator/main.go`
- [Operator runner](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/starter.go): `pkg/operator/starter.go`
- [Metrics server](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/metrics/server.go): `pkg/metrics/server.go`

### Registry reconciliation

- **Registry config**
- [Registry controller](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/controller.go): `pkg/operator/controller.go`
- [Config bootstrap](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/bootstrap.go): `pkg/operator/bootstrap.go`
- [Workload resources](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/resource/generator.go): `pkg/resource/generator.go`
- [Registry service](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/resource/service.go): `pkg/resource/service.go`
- [Service CA](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/resource/serviceca.go): `pkg/resource/serviceca.go`
- [Registry certificates](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/imageregistrycertificates.go): `pkg/operator/imageregistrycertificates.go`
- [Operator status](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/status.go): `pkg/operator/status.go`

### Storage backends

- [Storage selection](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/storage.go): `pkg/storage/storage.go`
- [S3 storage](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/s3/s3.go): `pkg/storage/s3/s3.go`
- [Azure storage](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/azure/azure.go): `pkg/storage/azure/azure.go`
- [GCS storage](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/gcs/gcs.go): `pkg/storage/gcs/gcs.go`
- [IBM COS storage](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/ibmcos/ibmcos.go): `pkg/storage/ibmcos/ibmcos.go`
- [Swift storage](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/swift/swift.go): `pkg/storage/swift/swift.go`
- [PVC storage](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/pvc/pvc.go): `pkg/storage/pvc/pvc.go`
- [EmptyDir storage](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/storage/emptydir/emptydir.go): `pkg/storage/emptydir/emptydir.go`

### Auxiliary controllers

- [Image pruner](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/controllerimagepruner.go): `pkg/operator/controllerimagepruner.go`
- [Pruner resources](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/resource/generatorimagepruner.go): `pkg/resource/generatorimagepruner.go`
- [AWS tag controller](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/awstagcontroller.go): `pkg/operator/awstagcontroller.go`
- [Azure path fix](https://github.com/openshift/cluster-image-registry-operator/blob/main/pkg/operator/azurepathfixcontroller.go): `pkg/operator/azurepathfixcontroller.go`

### Other components

- **Cluster configuration**
- **Registry deployment**
- **Routes**

## Connections

- Cluster configuration → Operator entrypoint: starts
- Operator entrypoint → Operator runner: runs (evidence: `cmd/cluster-image-registry-operator/main.go`)
- Operator entrypoint → Metrics server: starts (evidence: `cmd/cluster-image-registry-operator/main.go`)
- Operator runner → Registry controller: runs
- Cluster configuration → Registry config: configures
- Registry controller → Registry config: reads (evidence: `pkg/operator/controller.go`)
- Registry controller → Config bootstrap: bootstraps (evidence: `pkg/operator/controller.go`)
- Config bootstrap → Registry config: creates
- Registry controller → Workload resources: reconciles (evidence: `pkg/operator/controller.go`)
- Workload resources → Registry service: uses
- Workload resources → Service CA: uses
- Registry controller → Registry deployment: manages
- Registry controller → Routes: manages (evidence: `pkg/operator/controller.go`)
- Registry controller → Registry certificates: manages
- Registry controller → Operator status: reports
- Registry controller → Storage selection: selects (evidence: `pkg/operator/controller.go`)
- Storage selection → S3 storage: selects (evidence: `pkg/storage/storage.go`)
- Storage selection → Azure storage: selects (evidence: `pkg/storage/storage.go`)
- Storage selection → GCS storage: selects (evidence: `pkg/storage/storage.go`)
- Storage selection → IBM COS storage: selects (evidence: `pkg/storage/storage.go`)
- Storage selection → Swift storage: selects (evidence: `pkg/storage/storage.go`)
- Storage selection → PVC storage: selects (evidence: `pkg/storage/storage.go`)
- Storage selection → EmptyDir storage: selects (evidence: `pkg/storage/storage.go`)
- Registry controller → Image pruner: starts
- Image pruner → Pruner resources: generates (evidence: `pkg/operator/controllerimagepruner.go`)
- Registry controller → AWS tag controller: coordinates
- Registry controller → Azure path fix: coordinates
