Skip to content

Commit 731e511

Browse files
author
Per Goncalves da Silva
committed
Add CLAUDE.MD
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 9eac616 commit 731e511

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

CLAUDE.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This repository contains the **operator-controller**, which is the central component of Operator Lifecycle Manager (OLM) v1. OLM v1 is a Kubernetes operator lifecycle management system that provides APIs, controllers, and tooling for packaging, distributing, and managing Kubernetes extensions/operators.
8+
9+
The project consists of two main components:
10+
- **operator-controller**: Manages ClusterExtension lifecycle (install, upgrade, uninstall)
11+
- **catalogd**: Serves operator catalogs and provides catalog content via HTTP API
12+
13+
## Essential Commands
14+
15+
### Build and Development
16+
```bash
17+
make build # Build binaries for current GOOS/GOARCH
18+
make build-linux # Build binaries for GOOS=linux
19+
make docker-build # Build container images
20+
make generate # Generate code (DeepCopy methods, etc.)
21+
make manifests # Generate CRDs, RBAC, and other manifests
22+
make fmt # Format Go code
23+
make lint # Run golangci linter
24+
make verify # Verify all generated code is up-to-date
25+
```
26+
27+
### Testing
28+
```bash
29+
make test # Run all tests (unit, e2e, regression)
30+
make test-unit # Run unit tests only
31+
make test-e2e # Run e2e tests (requires kind cluster)
32+
make test-experimental-e2e # Run experimental e2e tests
33+
make test-regression # Run regression tests
34+
make envtest-k8s-bins # Download ENVTEST binaries for unit tests
35+
```
36+
37+
### Local Development and Cluster Management
38+
```bash
39+
make kind-cluster # Create local kind cluster
40+
make kind-load # Load built images into kind cluster
41+
make kind-deploy # Deploy to kind cluster
42+
make kind-clean # Delete kind cluster
43+
make run # Build, create cluster, and deploy (standard)
44+
make run-experimental # Build, create cluster, and deploy (experimental)
45+
```
46+
47+
### Release and Documentation
48+
```bash
49+
make release # Run goreleaser (snapshot by default)
50+
make quickstart # Generate release manifests and install scripts
51+
make crd-ref-docs # Generate API reference documentation
52+
```
53+
54+
## Architecture and Patterns
55+
56+
### Core API Types
57+
- **ClusterExtension**: Represents an operator/extension to be installed
58+
- **ClusterCatalog**: References a catalog of available operators
59+
60+
### Controller Architecture
61+
The system follows standard Kubernetes controller patterns:
62+
- Controllers use **controller-runtime** framework
63+
- **Reconciliation loops** manage desired vs actual state
64+
- **Finalizers** ensure proper cleanup during deletion
65+
- **Status conditions** track installation/upgrade progress
66+
67+
### Key Components
68+
- **Resolver**: Determines which operator version to install based on constraints
69+
- **Applier**: Handles Helm-based installations and upgrades
70+
- **Authentication/Authorization**: Manages service account permissions and RBAC
71+
- **Catalog Metadata Client**: Fetches operator metadata from catalogs
72+
- **Bundle Utilities**: Processes operator bundle formats
73+
74+
### Testing Strategy
75+
- **Unit tests**: Use ENVTEST with real Kubernetes APIs
76+
- **E2E tests**: Full cluster testing with kind
77+
- **Integration tests**: Test component interactions
78+
- **Regression tests**: Verify conversion between bundle formats
79+
80+
## Development Environment
81+
82+
### Required Tools
83+
- Go 1.24+
84+
- Docker or Podman for container builds
85+
- kubectl for cluster interaction
86+
- kind for local development clusters
87+
- make for build automation
88+
89+
### Tool Management
90+
- Uses **bingo** for version-pinned tools (stored in `.bingo/`)
91+
- Tools include: kind, kustomize, controller-gen, golangci-lint, etc.
92+
93+
### Code Generation
94+
Most Kubernetes resources are generated:
95+
- **CRDs** generated from Go struct definitions using controller-gen
96+
- **RBAC** manifests generated based on controller annotations
97+
- **DeepCopy methods** generated for API types
98+
- **Kustomize overlays** for different deployment configurations
99+
100+
## Important Development Notes
101+
102+
### Multi-Component Coordination
103+
- Changes often affect both operator-controller and catalogd
104+
- Shared utilities exist in `internal/shared/`
105+
- API definitions in `api/v1/` are used by both components
106+
107+
### Testing Requirements
108+
- Always run `make verify` before submitting changes
109+
- E2E tests are crucial for Kubernetes integration
110+
- Unit tests use controller-runtime's envtest package
111+
- Coverage tracking enabled for both unit and e2e tests
112+
113+
### Feature Gates
114+
The project uses feature gates for experimental functionality:
115+
- Standard vs Experimental builds via Go build tags
116+
- Feature flags defined in `internal/*/features/`
117+
- Different manifests for standard vs experimental deployments
118+
119+
### Configuration Management
120+
- **Kustomize** used for manifest generation and customization
121+
- Multiple overlays: standard, experimental, e2e variants
122+
- Environment-specific configurations in `config/overlays/`
123+
124+
### Container Images and Registries
125+
- Multi-arch container builds supported
126+
- Default registry: `quay.io/operator-framework`
127+
- Local development uses kind for loading images
128+
- E2E tests include registry setup for testing
129+
130+
This is a complex, production-grade Kubernetes operator system requiring understanding of operator patterns, Helm integration, and catalog-based software distribution.

0 commit comments

Comments
 (0)