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