Skip to content

Commit 3fd3fdb

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 c103248 commit 3fd3fdb

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# AGENTS.md - horizon-operator
2+
3+
## Project overview
4+
5+
See [README.md](README.md) for a full project overview, configuration examples,
6+
and contributing guidelines.
7+
8+
## Tech stack
9+
10+
| Layer | Technology |
11+
|-------|------------|
12+
| Language | Go (modules; `go.work` is local-only, never commit it) |
13+
| Scaffolding | [Kubebuilder v4](https://book.kubebuilder.io/) + [Operator SDK](https://sdk.operatorframework.io/) |
14+
| CRD generation | controller-gen (DeepCopy, CRDs, RBAC, webhooks) |
15+
| Config management | Kustomize |
16+
| Packaging | OLM bundle |
17+
| Testing | Ginkgo/Gomega + envtest (functional), KUTTL (integration) |
18+
| Linting | golangci-lint (`.golangci.yaml`) |
19+
| CI | Zuul (`zuul.d/`), Prow (`.ci-operator.yaml`), GitHub Actions |
20+
21+
## Custom Resources
22+
23+
| Kind | Purpose |
24+
|------|---------|
25+
| `Horizon` | Single CR managing the Horizon dashboard deployment (httpd/WSGI). No sub-CRs. |
26+
27+
The `Horizon` CR has defaulting and validating admission webhooks.
28+
29+
## Directory structure
30+
31+
**Maintenance rule:** when directories are added, removed, or renamed, or when
32+
their purpose changes, update this table to match.
33+
34+
| Directory | Contents |
35+
|-----------|----------|
36+
| `api/v1beta1/` | CRD types (`horizon_types.go`), conditions, webhook markers |
37+
| `cmd/` | `main.go` entry point |
38+
| `internal/controller/` | Reconciler: `horizon_controller.go` |
39+
| `internal/horizon/` | Horizon resource builders (deployment, volumes, config) |
40+
| `internal/webhook/` | Webhook implementation |
41+
| `templates/` | Config files and scripts mounted into pods via `OPERATOR_TEMPLATES` env var |
42+
| `config/crd,rbac,manager,webhook/` | Generated Kubernetes manifests (CRDs, RBAC, deployment, webhooks) |
43+
| `config/samples/` | Example CRs (Kustomize overlays). `base/`, `custom-theme/`, `httpd-overrides/` for customization. |
44+
| `test/functional/` | envtest-based Ginkgo/Gomega tests |
45+
| `test/kuttl/` | KUTTL integration tests |
46+
| `hack/` | Helper scripts (CRD schema checker, local webhook runner) |
47+
48+
## Build commands
49+
50+
After modifying Go code, always run: `make generate manifests fmt vet`.
51+
Before sending a commit, always run: `pre-commit run --all-files`.
52+
53+
## Code style guidelines
54+
55+
- Follow standard openstack-k8s-operators conventions and lib-common patterns.
56+
- Use `lib-common` modules for conditions, endpoints, TLS, storage, and other
57+
cross-cutting concerns rather than re-implementing them.
58+
- CRD types go in `api/v1beta1/`. Controller logic goes in
59+
`internal/controller/`. Resource-building helpers go in `internal/horizon/`.
60+
- Config templates are plain files in `templates/` -- they are mounted at
61+
runtime via the `OPERATOR_TEMPLATES` environment variable.
62+
- Webhook logic is split between the kubebuilder markers in `api/v1beta1/` and
63+
the implementation in `internal/webhook/`.
64+
65+
## Testing
66+
67+
- Functional tests use the envtest framework with Ginkgo/Gomega and live in
68+
`test/functional/`.
69+
- KUTTL integration tests live in `test/kuttl/`.
70+
- Run all functional tests: `make test`.
71+
- When adding a new field or feature, add corresponding test cases in
72+
`test/functional/` and update fixture data accordingly.
73+
74+
## Key dependencies
75+
76+
- [lib-common](https://github.com/openstack-k8s-operators/lib-common): shared modules for conditions, endpoints, TLS, secrets, etc.
77+
- [infra-operator](https://github.com/openstack-k8s-operators/infra-operator): Memcached and topology APIs.
78+
- [keystone-operator](https://github.com/openstack-k8s-operators/keystone-operator): identity service registration.
79+
- [dev-docs/developer.md](https://github.com/openstack-k8s-operators/dev-docs/blob/main/developer.md): developer guide and coding conventions.

0 commit comments

Comments
 (0)