Skip to content

Commit bd9db30

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 bd9db30

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

AGENTS.md

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

0 commit comments

Comments
 (0)