# open-cluster-management-io/ocm architecture

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

- Interactive diagram: https://gitdiagram.com/open-cluster-management-io/ocm
- Repository: https://github.com/open-cluster-management-io/ocm

## Overview

OCM is a Kubernetes multicluster management system built around a hub-and-spoke model. A hub registers managed clusters, schedules placements, and distributes ManifestWork; klusterlet agents on spokes register with the hub and apply work locally. The repository also includes hub and spoke operators and an add-on framework for extending cluster management. The README documents the main workflow; controller-manager excerpts show component wiring. Some capabilities are represented at subsystem-directory level because their implementation files were not sampled.

Main entry points: [`pkg/placement/controllers/scheduling/scheduling_controller.go`](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/placement/controllers/scheduling/scheduling_controller.go) (Placement scheduler), [`pkg/registration/hub/managedcluster/controller.go`](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/registration/hub/managedcluster/controller.go) (Hub registration), [`pkg/addon/manager.go`](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/addon/manager.go) (Add-on manager), [`pkg/work/hub/manager.go`](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/work/hub/manager.go) (Hub work manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_registration["Cluster registration"]
  node_hub_registration["Hub registration<br/>[controller.go]"]
  node_spoke_registration["Spoke registration"]
  node_registration_manager["Registration manager<br/>[manager.go]"]
  node_cluster_lifecycle["Cluster lifecycle"]
end

subgraph group_placement["Content placement"]
  node_placement_scheduler["Placement scheduler"]
  node_placement_manager["Placement manager<br/>[manager.go]"]
  node_placement_api["Placement decisions<br/>[controller.go]"]
end

subgraph group_work["Work distribution"]
  node_work_hub["Hub work manager<br/>[manager.go]"]
  node_replica_sets["Work replica sets"]
  node_spoke_work["Spoke work agent"]
  node_work_apply["Manifest applier"]
end

subgraph group_extensions["Add-ons and operators"]
  node_addon_manager["Add-on manager<br/>[manager.go]"]
  node_addon_templates["Add-on templates<br/>[controller.go]"]
  node_addon_progress["Add-on status<br/>[controller.go]"]
  node_addon_tokens["Add-on credentials<br/>[controller.go]"]
  node_cluster_operator["Cluster manager operator"]
  node_klusterlet_operator["Klusterlet operator"]
end

node_admin(("Cluster admin"))
node_hub[("Hub cluster")]
node_spoke[("Managed cluster")]

node_admin -->|"approves registration"| node_hub_registration
node_spoke_registration -->|"establishes mTLS"| node_hub_registration
node_registration_manager -->|"registers controller"| node_hub_registration
node_registration_manager -->|"starts controllers"| node_cluster_lifecycle
node_hub_registration -->|"records cluster"| node_hub
node_placement_manager -->|"starts scheduler"| node_placement_scheduler
node_placement_scheduler -.->|"publishes decisions"| node_placement_api
node_admin -->|"specifies placement"| node_placement_scheduler
node_placement_scheduler -->|"selects clusters"| node_hub
node_admin -->|"submits work"| node_work_hub
node_work_hub -->|"starts controller"| node_replica_sets
node_work_hub -->|"distributes ManifestWork"| node_spoke_work
node_spoke_work -.->|"applies resources"| node_work_apply
node_spoke_work -->|"applies locally"| node_spoke
node_addon_manager -->|"registers controller"| node_addon_templates
node_addon_manager -->|"registers controller"| node_addon_progress
node_addon_manager -->|"registers controller"| node_addon_tokens
node_cluster_operator -.->|"configures hub"| node_hub
node_klusterlet_operator -.->|"configures agents"| node_spoke

click node_hub_registration "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/registration/hub/managedcluster/controller.go"
click node_spoke_registration "https://github.com/open-cluster-management-io/ocm/tree/main/pkg/registration/spoke/registration"
click node_registration_manager "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/registration/hub/manager.go"
click node_cluster_lifecycle "https://github.com/open-cluster-management-io/ocm/tree/main/pkg/registration/hub"
click node_placement_scheduler "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/placement/controllers/scheduling/scheduling_controller.go"
click node_placement_manager "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/placement/controllers/manager.go"
click node_placement_api "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/placement/controllers/sigplacementdecision/controller.go"
click node_work_hub "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/work/hub/manager.go"
click node_replica_sets "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/work/hub/controllers/manifestworkreplicasetcontroller/manifestworkreplicaset_controller.go"
click node_spoke_work "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/work/spoke/controllers/manifestcontroller/manifestwork_controller.go"
click node_work_apply "https://github.com/open-cluster-management-io/ocm/tree/main/pkg/work/spoke/apply"
click node_addon_manager "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/addon/manager.go"
click node_addon_templates "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/addon/controllers/addontemplate/controller.go"
click node_addon_progress "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/addon/controllers/addonprogressing/controller.go"
click node_addon_tokens "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/addon/controllers/addontokeninfra/controller.go"
click node_cluster_operator "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/operator/operators/clustermanager/controllers/clustermanagercontroller/clustermanager_controller.go"
click node_klusterlet_operator "https://github.com/open-cluster-management-io/ocm/blob/main/pkg/operator/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller.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_hub_registration,node_spoke_registration,node_registration_manager,node_cluster_lifecycle toneBlue
class node_placement_scheduler,node_placement_manager,node_placement_api,node_hub,node_spoke toneAmber
class node_work_hub,node_replica_sets,node_spoke_work,node_work_apply toneMint
class node_addon_manager,node_addon_templates,node_addon_progress,node_addon_tokens,node_cluster_operator,node_klusterlet_operator toneRose
class node_admin toneIndigo
```

## Components

### Cluster registration

- [Hub registration](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/registration/hub/managedcluster/controller.go): `pkg/registration/hub/managedcluster/controller.go`
- [Spoke registration](https://github.com/open-cluster-management-io/ocm/tree/main/pkg/registration/spoke/registration): `pkg/registration/spoke/registration`
- [Registration manager](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/registration/hub/manager.go): `pkg/registration/hub/manager.go`
- [Cluster lifecycle](https://github.com/open-cluster-management-io/ocm/tree/main/pkg/registration/hub): `pkg/registration/hub`

### Content placement

- [Placement scheduler](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/placement/controllers/scheduling/scheduling_controller.go): `pkg/placement/controllers/scheduling/scheduling_controller.go`
- [Placement manager](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/placement/controllers/manager.go): `pkg/placement/controllers/manager.go`
- [Placement decisions](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/placement/controllers/sigplacementdecision/controller.go): `pkg/placement/controllers/sigplacementdecision/controller.go`

### Work distribution

- [Hub work manager](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/work/hub/manager.go): `pkg/work/hub/manager.go`
- [Work replica sets](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/work/hub/controllers/manifestworkreplicasetcontroller/manifestworkreplicaset_controller.go): `pkg/work/hub/controllers/manifestworkreplicasetcontroller/manifestworkreplicaset_controller.go`
- [Spoke work agent](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/work/spoke/controllers/manifestcontroller/manifestwork_controller.go): `pkg/work/spoke/controllers/manifestcontroller/manifestwork_controller.go`
- [Manifest applier](https://github.com/open-cluster-management-io/ocm/tree/main/pkg/work/spoke/apply): `pkg/work/spoke/apply`

### Add-ons and operators

- [Add-on manager](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/addon/manager.go): `pkg/addon/manager.go`
- [Add-on templates](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/addon/controllers/addontemplate/controller.go): `pkg/addon/controllers/addontemplate/controller.go`
- [Add-on status](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/addon/controllers/addonprogressing/controller.go): `pkg/addon/controllers/addonprogressing/controller.go`
- [Add-on credentials](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/addon/controllers/addontokeninfra/controller.go): `pkg/addon/controllers/addontokeninfra/controller.go`
- [Cluster manager operator](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/operator/operators/clustermanager/controllers/clustermanagercontroller/clustermanager_controller.go): `pkg/operator/operators/clustermanager/controllers/clustermanagercontroller/clustermanager_controller.go`
- [Klusterlet operator](https://github.com/open-cluster-management-io/ocm/blob/main/pkg/operator/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller.go): `pkg/operator/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller.go`

### Other components

- **Cluster admin**
- **Hub cluster**
- **Managed cluster**

## Connections

- Cluster admin → Hub registration: approves registration (evidence: `README.md`)
- Spoke registration → Hub registration: establishes mTLS (evidence: `README.md`)
- Registration manager → Hub registration: registers controller (evidence: `pkg/registration/hub/manager.go`)
- Registration manager → Cluster lifecycle: starts controllers (evidence: `pkg/registration/hub/manager.go`)
- Hub registration → Hub cluster: records cluster (evidence: `README.md`)
- Placement manager → Placement scheduler: starts scheduler (evidence: `pkg/placement/controllers/manager.go`)
- Placement scheduler → Placement decisions: publishes decisions
- Cluster admin → Placement scheduler: specifies placement (evidence: `README.md`)
- Placement scheduler → Hub cluster: selects clusters (evidence: `README.md`)
- Cluster admin → Hub work manager: submits work (evidence: `README.md`)
- Hub work manager → Work replica sets: starts controller (evidence: `pkg/work/hub/manager.go`)
- Hub work manager → Spoke work agent: distributes ManifestWork (evidence: `README.md`)
- Spoke work agent → Manifest applier: applies resources (evidence: `pkg/work/spoke/controllers/manifestcontroller/manifestwork_controller.go`)
- Spoke work agent → Managed cluster: applies locally (evidence: `README.md`)
- Add-on manager → Add-on templates: registers controller (evidence: `pkg/addon/manager.go`)
- Add-on manager → Add-on status: registers controller (evidence: `pkg/addon/manager.go`)
- Add-on manager → Add-on credentials: registers controller (evidence: `pkg/addon/manager.go`)
- Cluster manager operator → Hub cluster: configures hub
- Klusterlet operator → Managed cluster: configures agents
