Skip to content

Commit 27dc341

Browse files
committed
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. Signed-off-by: Francesco Pantano <fpantano@redhat.com>
1 parent 32d27fe commit 27dc341

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# AGENTS.md - heat-operator
2+
3+
## Project overview
4+
5+
heat-operator is a Kubernetes operator that manages
6+
[OpenStack Heat](https://docs.openstack.org/heat/latest/) (the orchestration
7+
service: stack lifecycle, HOT templates, autoscaling, resource dependencies)
8+
on OpenShift/Kubernetes. It is part of the
9+
[openstack-k8s-operators](https://github.com/openstack-k8s-operators) project.
10+
11+
Key Heat domain concepts: **stacks**, **HOT templates** (Heat Orchestration
12+
Template), **resources**, **nested stacks**, **autoscaling groups**,
13+
**wait conditions**, **software deployments**, **DB purge**.
14+
## Tech stack
15+
16+
| Layer | Technology |
17+
|-------|------------|
18+
| Language | Go (modules, multi-module workspace via `go.work`) |
19+
| Scaffolding | [Kubebuilder v4](https://book.kubebuilder.io/) + [Operator SDK](https://sdk.operatorframework.io/) |
20+
| CRD generation | controller-gen (DeepCopy, CRDs, RBAC, webhooks) |
21+
| Config management | Kustomize |
22+
| Packaging | OLM bundle |
23+
| Testing | Ginkgo/Gomega + envtest (functional), KUTTL (integration) |
24+
| Linting | golangci-lint (`.golangci.yaml`) |
25+
| CI | Zuul (`zuul.d/`), Prow (`.ci-operator.yaml`), GitHub Actions |
26+
27+
## Custom Resources
28+
29+
| Kind | Purpose |
30+
|------|---------|
31+
| `Heat` | Top-level CR. Owns the database, keystone service, transport URL, and spawns sub-CRs for each service component. |
32+
| `HeatAPI` | Manages the Heat API deployment (httpd/WSGI). |
33+
| `HeatCfnAPI` | Manages the Heat CloudFormation-compatible API deployment. |
34+
| `HeatEngine` | Manages the engine service deployment (stack operations). |
35+
36+
The `Heat` CR has defaulting and validating admission webhooks.
37+
Sub-CRs are created and owned by the `Heat` controller -- not intended to
38+
be created directly by users.
39+
40+
## Directory structure
41+
42+
**Maintenance rule:** when directories are added, removed, or renamed, or when
43+
their purpose changes, update this table to match.
44+
45+
| Directory | Contents |
46+
|-----------|----------|
47+
| `api/v1beta1/` | CRD types (`heat_types.go`, `heatapi_types.go`, `heatcfnapi_types.go`, `heatengine_types.go`), conditions, webhook markers |
48+
| `cmd/` | `main.go` entry point |
49+
| `internal/controller/` | Reconcilers: `heat_controller.go`, `heatapi_controller.go`, `heatcfnapi_controller.go`, `heatengine_controller.go` |
50+
| `internal/heat/` | Heat-level resource builders (db-sync, common helpers) |
51+
| `internal/heatapi/` | HeatAPI resource builders |
52+
| `internal/heatcfnapi/` | HeatCfnAPI resource builders |
53+
| `internal/heatengine/` | HeatEngine resource builders |
54+
| `internal/webhook/` | Webhook implementation |
55+
| `templates/` | Config files and scripts mounted into pods via `OPERATOR_TEMPLATES` env var |
56+
| `config/crd,rbac,manager,webhook/` | Generated Kubernetes manifests (CRDs, RBAC, deployment, webhooks) |
57+
| `config/samples/` | Example CRs (Kustomize overlays). Includes TLS and topology variants. |
58+
| `test/functional/` | envtest-based Ginkgo/Gomega tests |
59+
| `test/kuttl/` | KUTTL integration tests |
60+
| `hack/` | Helper scripts (CRD schema checker, local webhook runner) |
61+
| `ci/` | CI job definitions |
62+
63+
## Build commands
64+
65+
After modifying Go code, always run: `make generate manifests fmt vet`.
66+
67+
## Code style guidelines
68+
69+
- Follow standard openstack-k8s-operators conventions and lib-common patterns.
70+
- Use `lib-common` modules for conditions, endpoints, TLS, storage, and other
71+
cross-cutting concerns rather than re-implementing them.
72+
- CRD types go in `api/v1beta1/`. Controller logic goes in
73+
`internal/controller/`. Resource-building helpers go in `internal/heat*`
74+
packages matching the CR they support.
75+
- Config templates are plain files in `templates/` -- they are mounted at
76+
runtime via the `OPERATOR_TEMPLATES` environment variable.
77+
- Webhook logic is split between the kubebuilder markers in `api/v1beta1/` and
78+
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/`.
84+
- KUTTL integration tests live in `test/kuttl/`.
85+
- Run all functional tests: `make test`.
86+
- When adding a new field or feature, add corresponding test cases in
87+
`test/functional/` and update fixture data accordingly.
88+
89+
## Key dependencies
90+
91+
- [lib-common](https://github.com/openstack-k8s-operators/lib-common): shared modules for conditions, endpoints, database, TLS, secrets, etc.
92+
- [infra-operator](https://github.com/openstack-k8s-operators/infra-operator): RabbitMQ and topology APIs.
93+
- [mariadb-operator](https://github.com/openstack-k8s-operators/mariadb-operator): database provisioning.
94+
- [keystone-operator](https://github.com/openstack-k8s-operators/keystone-operator): identity service registration.

0 commit comments

Comments
 (0)