Skip to content

Commit d791bcf

Browse files
fmountclaude
andcommitted
Add AGENTS.md
This patch adds AGENTS.md to the repo to ensure any AI agent can follow the conventions defined for this operator. At the same time, it allows to not waste time navigating the repo to find initial information and save tokens. Co-Authored-By: Claude Opus <noreply@anthropic.com> Signed-off-by: Francesco Pantano <fpantano@redhat.com>
1 parent cdd350d commit d791bcf

1 file changed

Lines changed: 97 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# AGENTS.md - openstack-operator
2+
3+
## Project overview
4+
5+
openstack-operator is a Kubernetes meta-operator that orchestrates the entire
6+
[OpenStack](https://www.openstack.org/) control plane and data plane lifecycle
7+
on OpenShift/Kubernetes. It is the top-level "umbrella" operator in the
8+
[openstack-k8s-operators](https://github.com/openstack-k8s-operators) project,
9+
managing all other OpenStack service operators (Keystone, Nova, Neutron, Cinder,
10+
Glance, etc.) and coordinating data plane provisioning via Ansible.
11+
12+
Key domain concepts: **control plane** (all OpenStack services deployed as
13+
pods), **data plane** (compute/network nodes provisioned via Ansible),
14+
**node sets** (groups of data plane nodes), **deployments** (Ansible-based
15+
provisioning runs), **services** (data plane service definitions).
16+
17+
### API groups
18+
19+
| API Group | Version |
20+
|-----------|---------|
21+
| `core.openstack.org` | `v1beta1` |
22+
| `client.openstack.org` | `v1beta1` |
23+
| `dataplane.openstack.org` | `v1beta1` |
24+
| `operator.openstack.org` | `v1beta1` |
25+
26+
## Tech stack
27+
28+
| Layer | Technology |
29+
|-------|------------|
30+
| Language | Go (modules, multi-module workspace via `go.work`) |
31+
| Scaffolding | [Kubebuilder v4](https://book.kubebuilder.io/) + [Operator SDK](https://sdk.operatorframework.io/) |
32+
| CRD generation | controller-gen (DeepCopy, CRDs, RBAC, webhooks) |
33+
| Config management | Kustomize |
34+
| Packaging | OLM bundle |
35+
| Testing | Ginkgo/Gomega + envtest (functional), KUTTL (integration) |
36+
| Linting | golangci-lint (`.golangci.yaml`) |
37+
| CI | Zuul (`zuul.d/`), Prow (`.ci-operator.yaml`), GitHub Actions |
38+
39+
## Custom Resources
40+
41+
CRD types and sub-resources are documented in
42+
[docs/assemblies/ctlplane_resources.adoc](docs/assemblies/ctlplane_resources.adoc) (control plane) and
43+
[docs/assemblies/dataplane_resources.adoc](docs/assemblies/dataplane_resources.adoc) (data plane).
44+
45+
The `OpenStackControlPlane` and `OpenStackDataPlaneNodeSet` CRs have defaulting
46+
and validating admission webhooks.
47+
48+
## Directory structure
49+
50+
| Directory | Contents |
51+
|-----------|----------|
52+
| `api/{core,client,dataplane,operator}/v1beta1/` | CRD types, conditions, webhook markers — one subdir per API group |
53+
| `internal/controller/` | Reconcilers organized by domain: `core/`, `client/`, `dataplane/`, `operator/` |
54+
| `internal/openstack/` | Per-service control plane resource builders (one file per OpenStack service) |
55+
| `internal/dataplane/` | Data plane logic: Ansible inventory, IPAM, certificates, baremetal, deployments |
56+
| `internal/webhook/` | Webhook implementations organized by domain |
57+
| `bindata/` | Embedded CRDs, RBAC, and manifests synced from dependent operators |
58+
| `test/functional/` | envtest-based Ginkgo/Gomega tests, subdirs: `ctlplane/`, `dataplane/` |
59+
| `docs/` | Architecture and configuration documentation ([design](docs/assemblies/design.adoc)) |
60+
61+
## Build commands
62+
63+
After modifying Go code, always run: `make generate manifests fmt vet`.
64+
65+
## Code style guidelines
66+
67+
- Follow standard openstack-k8s-operators conventions and lib-common patterns.
68+
- Use `lib-common` modules for conditions, endpoints, TLS, storage, and other
69+
cross-cutting concerns rather than re-implementing them.
70+
- CRD types are organized by API group under `api/{core,client,dataplane,operator}/v1beta1/`.
71+
Controller logic is organized under `internal/controller/{core,client,dataplane,operator}/`.
72+
- Per-service resource builders (for the control plane) live in
73+
`internal/openstack/` with one file per OpenStack service.
74+
- Data plane logic (inventory, IPAM, certificates, Ansible execution) lives in
75+
`internal/dataplane/`.
76+
- Embedded data from dependent operators is managed in `bindata/`.
77+
- Webhook logic is split between the kubebuilder markers in the API type files
78+
and the implementation in `internal/webhook/`.
79+
80+
## Testing
81+
82+
- Functional tests use the envtest framework with Ginkgo/Gomega and live in
83+
`test/functional/ctlplane/` (control plane) and `test/functional/dataplane/`
84+
(data plane).
85+
- KUTTL integration tests live in `test/kuttl/`.
86+
- Run all functional tests: `make test`.
87+
- When adding a new field or feature, add corresponding test cases in the
88+
appropriate `test/functional/` subdirectory.
89+
90+
## Key dependencies
91+
92+
- [lib-common](https://github.com/openstack-k8s-operators/lib-common): shared modules for conditions, endpoints, database, TLS, secrets, Ansible, etc.
93+
- All [openstack-k8s-operators](https://github.com/openstack-k8s-operators) service operators (barbican, cinder, designate, glance, heat, horizon, ironic, keystone, manila, neutron, nova, octavia, ovn, placement, swift, telemetry, watcher).
94+
- [infra-operator](https://github.com/openstack-k8s-operators/infra-operator): RabbitMQ, Memcached, DNSMasq, and topology APIs.
95+
- [mariadb-operator](https://github.com/openstack-k8s-operators/mariadb-operator): Galera database provisioning.
96+
- [gophercloud](https://github.com/gophercloud/gophercloud): Go OpenStack SDK.
97+
- [Control plane docs](docs/ctlplane.adoc) and [Data plane docs](docs/dataplane.adoc): architecture and configuration documentation.

0 commit comments

Comments
 (0)