# openshift/library-go architecture

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

- Interactive diagram: https://gitdiagram.com/openshift/library-go
- Repository: https://github.com/openshift/library-go

## Overview

library-go is a reusable Go library of OpenShift runtime helpers, not a standalone service. Its central product workflow is assembling and running operator controllers that observe cluster state, reconcile resources, and expose status; the tree also shows substantial libraries for registry access, networking, OAuth, templates, and validation. Edges are limited to relationships supported by excerpts, SOURCE INDEX references, or the README; many other listed packages are unsampled, so their internal wiring is not represented.

Main entry points: [`pkg/controller/factory/base_controller.go`](https://github.com/openshift/library-go/blob/master/pkg/controller/factory/base_controller.go) (Controller work queues), [`pkg/operator/staticpod/controllers.go`](https://github.com/openshift/library-go/blob/master/pkg/operator/staticpod/controllers.go) (Static pod assembly), [`pkg/operator/resource/resourceapply/storage.go`](https://github.com/openshift/library-go/blob/master/pkg/operator/resource/resourceapply/storage.go) (Resource apply), [`pkg/operator/staticresourcecontroller/static_resource_controller.go`](https://github.com/openshift/library-go/blob/master/pkg/operator/staticresourcecontroller/static_resource_controller.go) (Static resource sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operator["Operator reconciliation"]
  node_controller_manager["Controller manager"]
  node_controller_factory["Controller work queues<br/>[base_controller.go]"]
  node_staticpod_builder["Static pod assembly<br/>[controllers.go]"]
  node_static_resources["Static resource sync"]
  node_csi_storage["CSI storage classes"]
  node_resource_apply["Resource apply<br/>[storage.go]"]
  node_revision_control["Revision rollout"]
  node_encryption_keys["Encryption key rotation<br/>[key_controller.go]"]
  node_operator_status["Operator status"]
  node_connectivity["Connectivity checks"]
  node_deployment["Deployment reconciliation"]
  node_resource_sync["Resource synchronization"]
end

subgraph group_runtime["Runtime infrastructure"]
  node_registry["Image registry client<br/>[client.go]"]
  node_image_reference["Image references<br/>[reference.go]"]
  node_http_transport["HTTP transport<br/>[transport.go]"]
  node_crypto["Cryptography<br/>[crypto.go]"]
  node_serving["Serving configuration<br/>[server.go]"]
  node_config_helpers["Config clients<br/>[client.go]"]
end

subgraph group_identity["Identity and policy"]
  node_oauth_clients["Service account OAuth"]
  node_scope_metadata["Authorization scopes<br/>[describers.go]"]
  node_route_validation["Route validation<br/>[validation.go]"]
  node_ldap_query["LDAP query builder<br/>[query.go]"]
  node_ldap_client["LDAP client<br/>[client.go]"]
end

subgraph group_utilities["Domain utilities"]
  node_template_processing["Template processing<br/>[template.go]"]
  node_template_generator["Template expressions<br/>[expressionvalue.go]"]
  node_manifest_client["Manifest access<br/>[get.go]"]
  node_certificate_analysis["Certificate analysis<br/>[collector.go]"]
  node_verification["Artifact verification<br/>[verify.go]"]
end

node_operator_user(("Operator integrator"))

node_operator_user -.->|"assembles controllers"| node_staticpod_builder
node_staticpod_builder -->|"registers controllers"| node_controller_manager
node_controller_manager -->|"runs controllers"| node_controller_factory
node_staticpod_builder -->|"registers controller"| node_revision_control
node_staticpod_builder -->|"registers controller"| node_static_resources
node_static_resources -->|"uses framework"| node_controller_factory
node_static_resources -->|"applies resources"| node_resource_apply
node_csi_storage -->|"uses framework"| node_controller_factory
node_csi_storage -->|"applies storage"| node_resource_apply
node_revision_control -->|"uses framework"| node_controller_factory
node_revision_control -->|"uses patch helpers"| node_resource_apply
node_encryption_keys -->|"uses framework"| node_controller_factory
node_operator_status -->|"uses framework"| node_controller_factory
node_connectivity -->|"uses framework"| node_controller_factory
node_deployment -->|"uses framework"| node_controller_factory
node_deployment -->|"applies resources"| node_resource_apply
node_resource_sync -.->|"uses framework"| node_controller_factory
node_registry -->|"uses references"| node_image_reference
node_http_transport -->|"uses crypto"| node_crypto
node_config_helpers -.->|"configures clients"| node_serving
node_oauth_clients -->|"uses scope metadata"| node_scope_metadata
node_route_validation -.->|"uses authorization utilities"| node_scope_metadata
node_ldap_client -.->|"uses LDAP utilities"| node_ldap_query
node_template_processing -->|"uses expressions"| node_template_generator

click node_controller_manager "https://github.com/openshift/library-go/blob/master/pkg/controller/manager/controller_manager.go"
click node_controller_factory "https://github.com/openshift/library-go/blob/master/pkg/controller/factory/base_controller.go"
click node_staticpod_builder "https://github.com/openshift/library-go/blob/master/pkg/operator/staticpod/controllers.go"
click node_static_resources "https://github.com/openshift/library-go/blob/master/pkg/operator/staticresourcecontroller/static_resource_controller.go"
click node_csi_storage "https://github.com/openshift/library-go/blob/master/pkg/operator/csi/csistorageclasscontroller/csi_storageclass_controller.go"
click node_resource_apply "https://github.com/openshift/library-go/blob/master/pkg/operator/resource/resourceapply/storage.go"
click node_revision_control "https://github.com/openshift/library-go/blob/master/pkg/operator/revisioncontroller/revision_controller.go"
click node_encryption_keys "https://github.com/openshift/library-go/blob/master/pkg/operator/encryption/controllers/key_controller.go"
click node_operator_status "https://github.com/openshift/library-go/blob/master/pkg/operator/status/status_controller.go"
click node_connectivity "https://github.com/openshift/library-go/blob/master/pkg/operator/connectivitycheckcontroller/connectivity_check_controller.go"
click node_deployment "https://github.com/openshift/library-go/blob/master/pkg/operator/deploymentcontroller/deployment_controller.go"
click node_resource_sync "https://github.com/openshift/library-go/blob/master/pkg/operator/resourcesynccontroller/resourcesync_controller.go"
click node_registry "https://github.com/openshift/library-go/blob/master/pkg/image/registryclient/client.go"
click node_image_reference "https://github.com/openshift/library-go/blob/master/pkg/image/reference/reference.go"
click node_http_transport "https://github.com/openshift/library-go/blob/master/pkg/network/httptransport/transport.go"
click node_crypto "https://github.com/openshift/library-go/blob/master/pkg/crypto/crypto.go"
click node_serving "https://github.com/openshift/library-go/blob/master/pkg/config/serving/server.go"
click node_config_helpers "https://github.com/openshift/library-go/blob/master/pkg/config/helpers/client.go"
click node_oauth_clients "https://github.com/openshift/library-go/blob/master/pkg/oauth/oauthserviceaccountclient/oauthclientregistry.go"
click node_scope_metadata "https://github.com/openshift/library-go/blob/master/pkg/authorization/scopemetadata/describers.go"
click node_route_validation "https://github.com/openshift/library-go/blob/master/pkg/route/validation/validation.go"
click node_ldap_query "https://github.com/openshift/library-go/blob/master/pkg/security/ldapquery/query.go"
click node_ldap_client "https://github.com/openshift/library-go/blob/master/pkg/security/ldapclient/client.go"
click node_template_processing "https://github.com/openshift/library-go/blob/master/pkg/template/templateprocessing/template.go"
click node_template_generator "https://github.com/openshift/library-go/blob/master/pkg/template/generator/expressionvalue.go"
click node_manifest_client "https://github.com/openshift/library-go/blob/master/pkg/manifestclient/get.go"
click node_certificate_analysis "https://github.com/openshift/library-go/blob/master/pkg/certs/cert-inspection/certgraphanalysis/collector.go"
click node_verification "https://github.com/openshift/library-go/blob/master/pkg/verify/verify.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_controller_manager,node_controller_factory,node_staticpod_builder,node_static_resources,node_csi_storage,node_resource_apply,node_revision_control,node_encryption_keys,node_operator_status,node_connectivity,node_deployment,node_resource_sync toneBlue
class node_registry,node_image_reference,node_http_transport,node_crypto,node_serving,node_config_helpers toneAmber
class node_oauth_clients,node_scope_metadata,node_route_validation,node_ldap_query,node_ldap_client toneMint
class node_template_processing,node_template_generator,node_manifest_client,node_certificate_analysis,node_verification toneRose
class node_operator_user toneIndigo
```

## Components

### Operator reconciliation

- [Controller manager](https://github.com/openshift/library-go/blob/master/pkg/controller/manager/controller_manager.go): `pkg/controller/manager/controller_manager.go`
- [Controller work queues](https://github.com/openshift/library-go/blob/master/pkg/controller/factory/base_controller.go): `pkg/controller/factory/base_controller.go`
- [Static pod assembly](https://github.com/openshift/library-go/blob/master/pkg/operator/staticpod/controllers.go): `pkg/operator/staticpod/controllers.go`
- [Static resource sync](https://github.com/openshift/library-go/blob/master/pkg/operator/staticresourcecontroller/static_resource_controller.go): `pkg/operator/staticresourcecontroller/static_resource_controller.go`
- [CSI storage classes](https://github.com/openshift/library-go/blob/master/pkg/operator/csi/csistorageclasscontroller/csi_storageclass_controller.go): `pkg/operator/csi/csistorageclasscontroller/csi_storageclass_controller.go`
- [Resource apply](https://github.com/openshift/library-go/blob/master/pkg/operator/resource/resourceapply/storage.go): `pkg/operator/resource/resourceapply/storage.go`
- [Revision rollout](https://github.com/openshift/library-go/blob/master/pkg/operator/revisioncontroller/revision_controller.go): `pkg/operator/revisioncontroller/revision_controller.go`
- [Encryption key rotation](https://github.com/openshift/library-go/blob/master/pkg/operator/encryption/controllers/key_controller.go): `pkg/operator/encryption/controllers/key_controller.go`
- [Operator status](https://github.com/openshift/library-go/blob/master/pkg/operator/status/status_controller.go): `pkg/operator/status/status_controller.go`
- [Connectivity checks](https://github.com/openshift/library-go/blob/master/pkg/operator/connectivitycheckcontroller/connectivity_check_controller.go): `pkg/operator/connectivitycheckcontroller/connectivity_check_controller.go`
- [Deployment reconciliation](https://github.com/openshift/library-go/blob/master/pkg/operator/deploymentcontroller/deployment_controller.go): `pkg/operator/deploymentcontroller/deployment_controller.go`
- [Resource synchronization](https://github.com/openshift/library-go/blob/master/pkg/operator/resourcesynccontroller/resourcesync_controller.go): `pkg/operator/resourcesynccontroller/resourcesync_controller.go`

### Runtime infrastructure

- [Image registry client](https://github.com/openshift/library-go/blob/master/pkg/image/registryclient/client.go): `pkg/image/registryclient/client.go`
- [Image references](https://github.com/openshift/library-go/blob/master/pkg/image/reference/reference.go): `pkg/image/reference/reference.go`
- [HTTP transport](https://github.com/openshift/library-go/blob/master/pkg/network/httptransport/transport.go): `pkg/network/httptransport/transport.go`
- [Cryptography](https://github.com/openshift/library-go/blob/master/pkg/crypto/crypto.go): `pkg/crypto/crypto.go`
- [Serving configuration](https://github.com/openshift/library-go/blob/master/pkg/config/serving/server.go): `pkg/config/serving/server.go`
- [Config clients](https://github.com/openshift/library-go/blob/master/pkg/config/helpers/client.go): `pkg/config/helpers/client.go`

### Identity and policy

- [Service account OAuth](https://github.com/openshift/library-go/blob/master/pkg/oauth/oauthserviceaccountclient/oauthclientregistry.go): `pkg/oauth/oauthserviceaccountclient/oauthclientregistry.go`
- [Authorization scopes](https://github.com/openshift/library-go/blob/master/pkg/authorization/scopemetadata/describers.go): `pkg/authorization/scopemetadata/describers.go`
- [Route validation](https://github.com/openshift/library-go/blob/master/pkg/route/validation/validation.go): `pkg/route/validation/validation.go`
- [LDAP query builder](https://github.com/openshift/library-go/blob/master/pkg/security/ldapquery/query.go): `pkg/security/ldapquery/query.go`
- [LDAP client](https://github.com/openshift/library-go/blob/master/pkg/security/ldapclient/client.go): `pkg/security/ldapclient/client.go`

### Domain utilities

- [Template processing](https://github.com/openshift/library-go/blob/master/pkg/template/templateprocessing/template.go): `pkg/template/templateprocessing/template.go`
- [Template expressions](https://github.com/openshift/library-go/blob/master/pkg/template/generator/expressionvalue.go): `pkg/template/generator/expressionvalue.go`
- [Manifest access](https://github.com/openshift/library-go/blob/master/pkg/manifestclient/get.go): `pkg/manifestclient/get.go`
- [Certificate analysis](https://github.com/openshift/library-go/blob/master/pkg/certs/cert-inspection/certgraphanalysis/collector.go): `pkg/certs/cert-inspection/certgraphanalysis/collector.go`
- [Artifact verification](https://github.com/openshift/library-go/blob/master/pkg/verify/verify.go): `pkg/verify/verify.go`

### Other components

- **Operator integrator**

## Connections

- Operator integrator → Static pod assembly: assembles controllers
- Static pod assembly → Controller manager: registers controllers (evidence: `pkg/operator/staticpod/controllers.go`)
- Controller manager → Controller work queues: runs controllers (evidence: `pkg/controller/manager/controller_manager.go`)
- Static pod assembly → Revision rollout: registers controller (evidence: `pkg/operator/staticpod/controllers.go`)
- Static pod assembly → Static resource sync: registers controller (evidence: `pkg/operator/staticpod/controllers.go`)
- Static resource sync → Controller work queues: uses framework (evidence: `pkg/operator/staticresourcecontroller/static_resource_controller.go`)
- Static resource sync → Resource apply: applies resources (evidence: `pkg/operator/staticresourcecontroller/static_resource_controller.go`)
- CSI storage classes → Controller work queues: uses framework (evidence: `pkg/operator/csi/csistorageclasscontroller/csi_storageclass_controller.go`)
- CSI storage classes → Resource apply: applies storage (evidence: `pkg/operator/csi/csistorageclasscontroller/csi_storageclass_controller.go`)
- Revision rollout → Controller work queues: uses framework (evidence: `pkg/operator/revisioncontroller/revision_controller.go`)
- Revision rollout → Resource apply: uses patch helpers (evidence: `pkg/operator/revisioncontroller/revision_controller.go`)
- Encryption key rotation → Controller work queues: uses framework (evidence: `pkg/operator/encryption/controllers/key_controller.go`)
- Operator status → Controller work queues: uses framework (evidence: `pkg/operator/status/status_controller.go`)
- Connectivity checks → Controller work queues: uses framework (evidence: `pkg/operator/connectivitycheckcontroller/connectivity_check_controller.go`)
- Deployment reconciliation → Controller work queues: uses framework (evidence: `pkg/operator/deploymentcontroller/deployment_controller.go`)
- Deployment reconciliation → Resource apply: applies resources (evidence: `pkg/operator/deploymentcontroller/deployment_controller.go`)
- Resource synchronization → Controller work queues: uses framework
- Image registry client → Image references: uses references (evidence: `pkg/image/registryclient/client.go`)
- HTTP transport → Cryptography: uses crypto (evidence: `pkg/network/httptransport/transport.go`)
- Config clients → Serving configuration: configures clients
- Service account OAuth → Authorization scopes: uses scope metadata (evidence: `pkg/oauth/oauthserviceaccountclient/oauthclientregistry.go`)
- Route validation → Authorization scopes: uses authorization utilities
- LDAP client → LDAP query builder: uses LDAP utilities
- Template processing → Template expressions: uses expressions (evidence: `pkg/template/templateprocessing/template.go`)
