Skip to content

Commit fb26cb9

Browse files
author
Per Goncalves da Silva
committed
Add AGENTS.md
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 47ef860 commit fb26cb9

File tree

1 file changed

+143
-0
lines changed

1 file changed

+143
-0
lines changed

AGENTS.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to AI agents when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is the Operator Lifecycle Manager (OLM) v0 repository, which is currently in **maintenance mode**. This project provides declarative installation, upgrade, and dependency management for Kubernetes operators through custom resources and controllers.
8+
9+
**Important Note**: This is OLM v0 in maintenance mode. For new development, prefer [operator-controller](https://github.com/operator-framework/operator-controller) (OLM v1). Only critical bug fixes and security updates are accepted here.
10+
11+
## Essential Commands for AI Agents
12+
13+
### Build and Development
14+
```bash
15+
make build # Build binaries for local OS/ARCH
16+
make build-utils # Build utility binaries
17+
make image # Build container image for linux
18+
make local-build # Build image with 'local' tag
19+
make e2e-build # Build image for e2e testing
20+
```
21+
22+
### Testing and Validation
23+
```bash
24+
make test # Run all tests (unit + test-split)
25+
make unit # Run unit tests with setup-envtest
26+
make test-split # Run e2e test split utility tests
27+
make coverage # Run unit tests with coverage
28+
make e2e # Run e2e tests against existing cluster
29+
make e2e-local # Build + deploy + run e2e tests locally
30+
```
31+
32+
### Code Quality and Generation
33+
```bash
34+
make lint # Run golangci-lint
35+
make vet # Run go vet
36+
make fmt # Run go fmt
37+
make verify # Run all verification checks
38+
make gen-all # Update API, generate code and mocks
39+
make codegen # Generate clients, deepcopy, listers, informers
40+
make mockgen # Generate mocks
41+
make manifests # Copy OLM API CRD manifests
42+
```
43+
44+
### Local Development Environment
45+
```bash
46+
make kind-create # Create kind cluster (kind-olmv0)
47+
make kind-clean # Delete kind cluster
48+
make cert-manager-install # Install cert-manager
49+
make deploy # Deploy OLM to kind cluster
50+
make undeploy # Uninstall OLM from kind cluster
51+
make run-local # Full local setup: build + kind + cert-manager + deploy
52+
```
53+
54+
### Dependency Management
55+
```bash
56+
make vendor # Update vendored dependencies
57+
make bingo-upgrade # Upgrade tools managed by bingo
58+
```
59+
60+
## Architecture Overview for AI Agents
61+
62+
OLM consists of two main operators managing different aspects of the operator lifecycle:
63+
64+
### OLM Operator
65+
- Manages **ClusterServiceVersions (CSV)** - the actual operator installation
66+
- Creates deployments, service accounts, RBAC resources
67+
- Handles the CSV lifecycle: Pending → InstallReady → Installing → Succeeded/Failed
68+
69+
### Catalog Operator
70+
- Manages **InstallPlans** - dependency resolution and installation plans
71+
- Manages **Subscriptions** - automatic updates from catalog channels
72+
- Manages **CatalogSources** - repositories of operators
73+
- Handles dependency resolution between operators
74+
75+
### Core Resources Reference
76+
| Resource | Short | Owner | Purpose |
77+
|----------|-------|-------|---------|
78+
| ClusterServiceVersion | csv | OLM | Operator metadata and installation strategy |
79+
| InstallPlan | ip | Catalog | Resolved list of resources to install/upgrade |
80+
| CatalogSource | catsrc | Catalog | Repository of operators and metadata |
81+
| Subscription | sub | Catalog | Tracks operator updates from catalog channels |
82+
| OperatorGroup | og | OLM | Groups namespaces for operator installation scope |
83+
84+
## AI Agent Development Guidelines
85+
86+
### Tool Management
87+
- **bingo** (`.bingo/Variables.mk`) - Manages development tools like golangci-lint, helm, kind, setup-envtest
88+
- **tools.go** - Manages code generation tools and shared dependencies with main module
89+
- All tools are version-pinned for reproducible builds
90+
91+
### Code Generation Patterns
92+
Most code is generated rather than hand-written:
93+
- Client libraries from CRDs using k8s.io/code-generator
94+
- Mocks using counterfeiter and gomock
95+
- CRD manifests copied from operator-framework/api
96+
- Deep-copy methods and informers
97+
98+
### Testing Strategy for AI Agents
99+
- **Unit tests**: Use setup-envtest for real Kubernetes API behavior
100+
- **E2E tests**: Full cluster testing with Ginkgo/Gomega using kind
101+
- **Race detection**: Enabled by default with CGO_ENABLED=1
102+
- **Bundle/catalog testing**: Custom test images in test/images/
103+
104+
### Build Configuration
105+
- **Vendor mode**: All dependencies vendored for reproducible builds
106+
- **Build tags**: `e2e` and `experimental_metrics` for specific test builds
107+
- **Trimmed paths**: Build-time path trimming for smaller binaries
108+
- **Version injection**: Git commit and version info embedded at build time
109+
110+
## Key Dependencies
111+
112+
- **Kubernetes**: v0.34.1 (tracks specific k8s minor version)
113+
- **operator-framework/api**: v0.35.0 (OLM API definitions)
114+
- **operator-registry**: v1.60.0 (catalog/bundle tooling)
115+
- **controller-runtime**: v0.22.2 (Kubernetes controller framework)
116+
- **Ginkgo/Gomega**: v2.26.0/v1.38.2 (BDD testing framework)
117+
118+
## AI Agent Constraints and Guidelines
119+
120+
### Project Status Constraints
121+
- **Maintenance mode only** - no new features accepted
122+
- Only critical security fixes and outage issues addressed
123+
- Direct users to [operator-controller](https://github.com/operator-framework/operator-controller) for OLM v1 development
124+
125+
### Development Requirements
126+
- Go 1.24+
127+
- Docker/Podman for container builds
128+
- kind for local Kubernetes clusters
129+
- kubectl for cluster interaction
130+
131+
### Testing Environment Configuration
132+
- Uses envtest with Kubernetes v0.34.x binaries
133+
- Default kind cluster name: `kind-olmv0`
134+
- E2E timeout: 90 minutes (configurable via E2E_TIMEOUT)
135+
- Test images hosted on quay.io/olmtest organization
136+
137+
## AI Agent Best Practices
138+
139+
1. **Always run `make verify` before suggesting changes**
140+
2. **Use generated code patterns** - most code is auto-generated
141+
3. **Test with real Kubernetes APIs** using setup-envtest
142+
4. **Follow maintenance mode restrictions** - only critical fixes
143+
5. **Reference OLM v1 for new development** - this is legacy maintenance

0 commit comments

Comments
 (0)