|
| 1 | +# AGENTS.md - watcher-operator |
| 2 | + |
| 3 | +## Project overview |
| 4 | + |
| 5 | +watcher-operator is a Kubernetes operator that manages |
| 6 | +[OpenStack Watcher](https://docs.openstack.org/watcher/latest/) |
| 7 | +on OpenShift/Kubernetes. It is part of the |
| 8 | +[openstack-k8s-operators](https://github.com/openstack-k8s-operators) project. |
| 9 | + |
| 10 | +## Tech stack |
| 11 | + |
| 12 | +| Layer | Technology | |
| 13 | +|-------|------------| |
| 14 | +| Language | Go (modules, multi-module workspace via `go.work`) | |
| 15 | +| Scaffolding | [Kubebuilder v4](https://book.kubebuilder.io/) + [Operator SDK](https://sdk.operatorframework.io/) | |
| 16 | +| CRD generation | controller-gen (DeepCopy, CRDs, RBAC, webhooks) | |
| 17 | +| Config management | Kustomize | |
| 18 | +| Packaging | OLM bundle | |
| 19 | +| Testing | Ginkgo/Gomega + envtest (functional), KUTTL (integration) | |
| 20 | +| Linting | golangci-lint (`.golangci.yaml`) | |
| 21 | +| CI | Zuul (`zuul.d/`), Prow (`.ci-operator.yaml`), GitHub Actions | |
| 22 | + |
| 23 | +## Directory structure |
| 24 | + |
| 25 | +**Maintenance rule:** when directories are added, removed, or renamed, or when their purpose changes, update this table to match. |
| 26 | + |
| 27 | +| Directory | Contents | |
| 28 | +|-----------|----------| |
| 29 | +| `api/v1beta1/` | CRD types (`watcher.openstack.org/v1beta1`), conditions, webhook markers | |
| 30 | +| `internal/controller/` | Reconcilers for Watcher, WatcherAPI, WatcherApplier, WatcherDecisionEngine | |
| 31 | +| `internal/watcher/` | Watcher resource-building helpers | |
| 32 | +| `internal/watcherapi/` | WatcherAPI resource-building helpers | |
| 33 | +| `internal/watcherapplier/` | WatcherApplier resource-building helpers | |
| 34 | +| `internal/watcherdecisionengine/` | WatcherDecisionEngine resource-building helpers | |
| 35 | +| `internal/webhook/` | Webhook implementations | |
| 36 | +| `templates/` | Config templates per service, mounted via `OPERATOR_TEMPLATES` | |
| 37 | +| `test/functional/` | envtest-based Ginkgo/Gomega tests | |
| 38 | +| `test/kuttl/` | KUTTL integration tests | |
| 39 | + |
| 40 | +## Build commands |
| 41 | + |
| 42 | +After modifying Go code, always run: `make generate manifests fmt vet`. |
| 43 | + |
| 44 | +## Code style guidelines |
| 45 | + |
| 46 | +- Follow standard openstack-k8s-operators conventions and lib-common patterns. |
| 47 | +- Use `lib-common` modules for conditions, endpoints, TLS, storage, and other |
| 48 | + cross-cutting concerns rather than re-implementing them. |
| 49 | +- CRD types live in `api/v1beta1/`. |
| 50 | +- Controller logic goes in `internal/controller/`. |
| 51 | + Resource-building helpers go in `internal/<service>/` packages. |
| 52 | +- Config templates are split per service under `templates/` and mounted at |
| 53 | + runtime via the `OPERATOR_TEMPLATES` environment variable. |
| 54 | +- Webhook logic is split between the kubebuilder markers in `api/` and |
| 55 | + the implementation in `internal/webhook/`. |
| 56 | + |
| 57 | +## Testing |
| 58 | + |
| 59 | +- Functional tests use the envtest framework with Ginkgo/Gomega and live in |
| 60 | + `test/functional/`. |
| 61 | +- KUTTL integration tests live in `test/kuttl/`. |
| 62 | +- Run all functional tests: `make test`. |
| 63 | +- When adding a new field or feature, add corresponding test cases in |
| 64 | + `test/functional/` and update fixture data accordingly. |
| 65 | + |
| 66 | +## Key dependencies |
| 67 | + |
| 68 | +- [lib-common](https://github.com/openstack-k8s-operators/lib-common): shared modules for conditions, endpoints, database, TLS, secrets, etc. |
| 69 | +- [infra-operator](https://github.com/openstack-k8s-operators/infra-operator): RabbitMQ and topology APIs. |
| 70 | +- [mariadb-operator](https://github.com/openstack-k8s-operators/mariadb-operator): database provisioning. |
| 71 | +- [keystone-operator](https://github.com/openstack-k8s-operators/keystone-operator): identity service registration. |
| 72 | +- [dev-docs](https://github.com/openstack-k8s-operators/dev-docs): shared development guide covering operator conventions, debugging, testing, and best practices. |
| 73 | +- [Documentation](docs/main.adoc): install guide and user workflows. |
0 commit comments