This file provides AI agents with comprehensive context about the Operator Lifecycle Manager (OLM) v0 codebase to enable effective navigation, understanding, and contribution.
CRITICAL: This repository is in maintenance mode. OLM v0 accepts only critical bug fixes and security updates. For new development, use operator-controller (OLM v1).
Operator Lifecycle Manager (OLM) extends Kubernetes to provide declarative installation, upgrade, and lifecycle management for Kubernetes operators. It's part of the Operator Framework ecosystem.
- Over-the-Air Updates: Automatic operator updates via catalog channels
- Dependency Resolution: Automatic resolution and installation of operator dependencies
- Multi-tenancy: Namespace-scoped operator management via OperatorGroups
- Discovery: Catalog-based operator discovery and installation
- Stability: Prevents conflicting operators from owning the same APIs
OLM consists of two main operators working together:
Responsibility: Manages the installation and lifecycle of operators defined by ClusterServiceVersions (CSVs)
Key Functions:
- Creates Deployments, ServiceAccounts, Roles, and RoleBindings from CSV specifications
- Manages CSV lifecycle states: None → Pending → InstallReady → Installing → Succeeded/Failed
- Monitors installed operator health and rotates certificates
- Enforces OperatorGroup namespace scoping
Primary Controllers:
- CSV Controller (pkg/controller/operators/olm)
- OperatorGroup Controller
Responsibility: Manages operator catalogs, subscriptions, and dependency resolution
Key Functions:
- Monitors CatalogSources and builds operator catalogs
- Processes Subscriptions to track operator updates
- Generates InstallPlans with resolved dependencies
- Creates CRDs and CSVs from catalog content
Primary Controllers:
- Subscription Controller
- InstallPlan Controller
- CatalogSource Controller
- Registry Reconciler
| Resource | API Group | Owner | Description |
|---|---|---|---|
| ClusterServiceVersion (CSV) | operators.coreos.com/v1alpha1 | OLM | Defines operator metadata, installation strategy, permissions, and owned/required CRDs |
| Subscription | operators.coreos.com/v1alpha1 | Catalog | Tracks operator updates from a catalog channel; drives automatic upgrades |
| InstallPlan | operators.coreos.com/v1alpha1 | Catalog | Calculated list of resources to install/upgrade; requires approval (manual or automatic) |
| CatalogSource | operators.coreos.com/v1alpha1 | Catalog | Repository of operators and metadata; served via grpc from operator-registry |
| OperatorGroup | operators.coreos.com/v1 | OLM | Groups namespaces for operator installation scope; enables multi-tenancy |
| OperatorCondition | operators.coreos.com/v2 | OLM | Tracks operator health status and conditions |
operator-lifecycle-manager/
├── cmd/ # Entry point binaries
│ ├── catalog/ # Catalog Operator main
│ ├── olm/ # OLM Operator main
│ ├── package-server/ # Package API server
│ └── copy-content/ # Content copy utility
│
├── pkg/ # Core implementation
│ ├── api/ # API client and wrappers
│ │ ├── client/ # Generated Kubernetes clients
│ │ └── wrappers/ # Client wrapper utilities
│ │
│ ├── controller/ # Main controllers
│ │ ├── bundle/ # Bundle lifecycle controller
│ │ ├── install/ # Installation controller
│ │ ├── operators/ # Operator/CSV controllers (OLM Operator)
│ │ └── registry/ # Catalog/registry controllers (Catalog Operator)
│ │
│ ├── lib/ # Shared libraries and utilities
│ │ ├── catalogsource/ # CatalogSource utilities
│ │ ├── csv/ # CSV manipulation utilities
│ │ ├── operatorclient/ # Operator client abstractions
│ │ ├── operatorlister/ # Informer-based listers
│ │ ├── operatorstatus/ # Status management
│ │ ├── ownerutil/ # Owner reference utilities
│ │ ├── queueinformer/ # Queue-based informers
│ │ ├── scoped/ # Scoped client for multi-tenancy
│ │ └── [other utilities]
│ │
│ ├── metrics/ # Prometheus metrics
│ └── package-server/ # Package server implementation
│
├── test/ # Testing infrastructure
│ ├── e2e/ # End-to-end tests
│ └── images/ # Test container images
│
├── doc/ # Documentation
│ ├── design/ # Architecture and design docs
│ └── contributors/ # Contributor guides
│
└── vendor/ # Vendored dependencies
The heart of the OLM Operator. Contains the CSV controller that manages the complete operator lifecycle.
Key files:
olm/operator.go- Main OLM operator reconcilerolm/csv.go- CSV reconciliation logiccatalog/operator.go- Catalog operator reconciler
Registry and catalog management for the Catalog Operator.
Key files:
reconciler/reconciler.go- CatalogSource reconciliationgrpc/source.go- gRPC catalog source handling
Manages the installation of resources defined in InstallPlans.
Abstraction layer over Kubernetes clients providing OLM-specific operations.
Informer-based listers for efficient caching and querying of OLM resources.
Queue-based informer pattern used throughout OLM controllers for event-driven reconciliation.
Owner reference management ensuring proper garbage collection of OLM-managed resources.
Scoped clients that respect OperatorGroup namespace boundaries for multi-tenancy.
make build # Build all binaries
make image # Build container image
make local-build # Build with 'local' tagmake unit # Unit tests with setup-envtest
make e2e # E2E tests (requires cluster)
make e2e-local # Build + deploy + e2e locally
make coverage # Unit tests with coveragemake gen-all # Generate all code (clients, mocks, manifests)
make codegen # Generate K8s clients and deep-copy methods
make mockgen # Generate test mocks
make manifests # Copy CRD manifests from operator-framework/apimake run-local # Complete local setup
# OR step-by-step:
make kind-create # Create kind cluster (kind-olmv0)
make cert-manager-install
make deploy # Deploy OLM to clusterCSV Lifecycle:
None → Pending → InstallReady → Installing → Succeeded
↑ ↓
←----------←------←-------Failed
InstallPlan Lifecycle:
None → Planning → RequiresApproval → Installing → Complete
↓ ↓
←-------←-------Failed
Subscription Lifecycle:
None → UpgradeAvailable → UpgradePending → AtLatestKnown
↑ ↓
←-----------←-----------←-------------←
- CSVs declare owned CRDs (what they provide) and required CRDs (what they need)
- Catalog Operator resolves transitive dependencies via graph traversal
- InstallPlans capture the complete dependency closure
- Resolution is based on (Group, Version, Kind) - no version pinning
Package (e.g., "etcd")
├── Channel: "stable" → CSV v0.9.4 → CSV v0.9.3 → CSV v0.9.2
├── Channel: "alpha" → CSV v0.10.0
└── Channel: "beta" → CSV v0.9.4
Subscriptions track a channel; OLM follows the replacement chain to upgrade operators.
- Use
setup-envtestfor real Kubernetes API behavior - Race detection enabled by default (
CGO_ENABLED=1) - Mock generation via
counterfeiterandgomock
- Full cluster testing with Ginkgo/Gomega BDD framework
- Test images in
test/images/hosted on quay.io/olmtest - Default timeout: 90 minutes (configurable via
E2E_TIMEOUT) - Uses kind cluster named
kind-olmv0
- Bundle and catalog integration testing
- Upgrade path validation
- Multi-tenant scenario testing
| Dependency | Version | Purpose |
|---|---|---|
| kubernetes | v0.34.1 | Core K8s libraries |
| controller-runtime | v0.22.2 | Controller framework |
| operator-framework/api | v0.35.0 | OLM API definitions |
| operator-registry | v1.60.0 | Catalog/bundle tooling |
| ginkgo/gomega | v2.26.0 / v1.38.2 | BDD testing |
- User creates Subscription pointing to catalog/package/channel
- Catalog Operator queries catalog for latest CSV in channel
- Catalog Operator creates InstallPlan with resolved dependencies
- Upon approval, Catalog Operator creates CRDs and CSV
- OLM Operator detects CSV, validates requirements, creates Deployment/RBAC
- CSV transitions through: Pending → InstallReady → Installing → Succeeded
- Check CSV status and conditions:
kubectl get csv -o yaml - Examine InstallPlan:
kubectl get ip -o yaml - Review operator logs: OLM Operator and Catalog Operator pods in
olmnamespace - Verify OperatorGroup configuration for namespace scoping
REMINDER: This repository is in maintenance mode - only critical fixes accepted!
For understanding existing code:
- Controllers follow controller-runtime patterns with Reconcile() methods
- Use informers and listers from
pkg/lib/operatorlister - Queue-based event handling via
pkg/lib/queueinformer - Always respect OperatorGroup namespace scoping
Most code is generated - don't hand-edit:
- Client code: Generated from CRDs using k8s.io/code-generator
- Deep-copy methods: Auto-generated for all API types
- Mocks: Generated via counterfeiter/gomock
- CRD manifests: Copied from operator-framework/api repository
Always run make gen-all after API changes.
- OLM Operator controllers:
pkg/controller/operators/ - Catalog Operator controllers:
pkg/controller/registry/, subscription/installplan logic inpkg/controller/operators/catalog/
- CRDs are defined in operator-framework/api (external dependency)
- Clients are in
pkg/api/client/ - Listers are in
pkg/lib/operatorlister/
- CSV installation:
pkg/controller/operators/olm/ - Dependency resolution:
pkg/controller/registry/resolver/ - Catalog management:
pkg/controller/registry/reconciler/ - InstallPlan execution:
pkg/controller/install/
- Owner references:
pkg/lib/ownerutil/ - Scoped clients:
pkg/lib/scoped/ - Operator clients:
pkg/lib/operatorclient/ - Queue informers:
pkg/lib/queueinformer/
- Don't bypass OperatorGroup scoping - Always use scoped clients for multi-tenancy
- Don't modify generated code - Edit source (CRDs, annotations) and regenerate
- Don't skip approval for InstallPlans - Respect manual approval settings
- Don't create CSVs directly - Use Subscriptions/Catalogs for proper lifecycle
- Don't ignore owner references - Critical for garbage collection
- OLM Documentation
- Architecture Doc
- Philosophy
- Design Proposals
- Operator Framework Community
- OperatorHub.io - Public operator catalog
kubectl get csv # ClusterServiceVersions
kubectl get sub # Subscriptions
kubectl get ip # InstallPlans
kubectl get catsrc # CatalogSources
kubectl get og # OperatorGroupsmake build build-utils # Build all binaries
make test unit e2e # Run tests
make lint verify # Code quality
make gen-all # Generate everything
make run-local # Full local dev environmentTools are managed via bingo (.bingo/Variables.mk) for reproducible builds. All tools are version-pinned.
See CONTRIBUTING.md and CLAUDE.md for detailed guidelines.
Remember: OLM v0 is in maintenance mode - only critical security fixes and outage issues are accepted!