|
| 1 | +# AGENTS.md - telemetry-operator |
| 2 | + |
| 3 | +## Project overview |
| 4 | + |
| 5 | +telemetry-operator is a Kubernetes operator that manages |
| 6 | +[OpenStack Telemetry](https://docs.openstack.org/ceilometer/latest/) services |
| 7 | +(Ceilometer metering, Aodh alarming, CloudKitty rating, autoscaling, logging, |
| 8 | +and monitoring) on OpenShift/Kubernetes. It is part of the |
| 9 | +[openstack-k8s-operators](https://github.com/openstack-k8s-operators) project. |
| 10 | + |
| 11 | +Key Telemetry domain concepts: **Ceilometer** (metering: meters, samples, |
| 12 | +pipelines, polling agents), **Aodh** (alarming: alarms, evaluators, |
| 13 | +notifiers), **CloudKitty** (rating/billing: modules, hashmap, processors), |
| 14 | +**autoscaling** (Aodh + Heat integration), **logging** (centralized log |
| 15 | +collection), **monitoring stack** (metrics storage and dashboards). |
| 16 | + |
| 17 | +Go module: `github.com/openstack-k8s-operators/telemetry-operator` |
| 18 | +API group: `telemetry.openstack.org` |
| 19 | +API version: `v1beta1` |
| 20 | + |
| 21 | +## Tech stack |
| 22 | + |
| 23 | +| Layer | Technology | |
| 24 | +|-------|------------| |
| 25 | +| Language | Go (modules, multi-module workspace via `go.work`) | |
| 26 | +| Scaffolding | [Kubebuilder v4](https://book.kubebuilder.io/) + [Operator SDK](https://sdk.operatorframework.io/) | |
| 27 | +| CRD generation | controller-gen (DeepCopy, CRDs, RBAC, webhooks) | |
| 28 | +| Config management | Kustomize | |
| 29 | +| Packaging | OLM bundle | |
| 30 | +| Testing | KUTTL (integration) | |
| 31 | +| Linting | golangci-lint (`.golangci.yaml`) | |
| 32 | +| CI | Zuul (`zuul.d/`), Prow (`.ci-operator.yaml`), GitHub Actions | |
| 33 | + |
| 34 | +## Custom Resources |
| 35 | + |
| 36 | +| Kind | Purpose | |
| 37 | +|------|---------| |
| 38 | +| `Telemetry` | Top-level CR. Orchestrates all telemetry sub-components (Ceilometer, Autoscaling, Logging, CloudKitty). | |
| 39 | +| `Ceilometer` | Manages Ceilometer metering services (central agent, compute agent, IPMI agent, notification agent). | |
| 40 | +| `Autoscaling` | Manages Aodh alarming services (API, evaluator, notifier, listener) for autoscaling. | |
| 41 | +| `Logging` | Manages centralized logging infrastructure. | |
| 42 | +| `CloudKitty` | Manages CloudKitty rating/billing services. | |
| 43 | +| `CloudKittyAPI` | Manages the CloudKitty API deployment. | |
| 44 | +| `CloudKittyProc` | Manages the CloudKitty processor deployment. | |
| 45 | + |
| 46 | +The `Telemetry` CR has defaulting and validating admission webhooks. |
| 47 | +Sub-CRs are created and owned by the `Telemetry` controller -- not intended to |
| 48 | +be created directly by users. |
| 49 | + |
| 50 | +## Directory structure |
| 51 | + |
| 52 | +| Directory | Contents | |
| 53 | +|-----------|----------| |
| 54 | +| `api/v1beta1/` | CRD types (`telemetry_types.go`, `ceilometer_types.go`, `autoscaling_types.go`, `logging_types.go`, `cloudkitty_types.go`, `cloudkittyapi_types.go`, `cloudkittyproc_types.go`), conditions, webhook markers | |
| 55 | +| `cmd/` | `main.go` entry point | |
| 56 | +| `internal/controller/` | Reconcilers for all CR types | |
| 57 | +| `internal/telemetry/` | Telemetry-level resource builders | |
| 58 | +| `internal/ceilometer/` | Ceilometer resource builders | |
| 59 | +| `internal/autoscaling/` | Autoscaling/Aodh resource builders | |
| 60 | +| `internal/cloudkitty/` | CloudKitty-level resource builders | |
| 61 | +| `internal/cloudkittyapi/` | CloudKittyAPI resource builders | |
| 62 | +| `internal/cloudkittyproc/` | CloudKittyProc resource builders | |
| 63 | +| `internal/logging/` | Logging resource builders | |
| 64 | +| `internal/availability/` | Availability helpers | |
| 65 | +| `internal/dashboards/` | Dashboard resource builders | |
| 66 | +| `internal/metricstorage/` | Metric storage resource builders | |
| 67 | +| `internal/mysqldexporter/` | MySQL exporter resource builders | |
| 68 | +| `internal/utils/` | Shared utility functions | |
| 69 | +| `internal/webhook/` | Webhook implementation | |
| 70 | +| `templates/` | Config files and scripts mounted into pods via `OPERATOR_TEMPLATES` env var | |
| 71 | +| `config/crd,rbac,manager,webhook/` | Generated Kubernetes manifests (CRDs, RBAC, deployment, webhooks) | |
| 72 | +| `config/samples/` | Example CRs (Kustomize overlays). Includes TLS variants. | |
| 73 | +| `test/kuttl/` | KUTTL integration tests | |
| 74 | +| `hack/` | Helper scripts (CRD schema checker, local webhook runner) | |
| 75 | +| `docs/` | Documentation | |
| 76 | +| `ci/` | CI job definitions | |
| 77 | + |
| 78 | +## Build commands |
| 79 | + |
| 80 | +After modifying Go code, always run: `make generate manifests fmt vet`. |
| 81 | + |
| 82 | +## Code style guidelines |
| 83 | + |
| 84 | +- Follow standard openstack-k8s-operators conventions and lib-common patterns. |
| 85 | +- Use `lib-common` modules for conditions, endpoints, TLS, storage, and other |
| 86 | + cross-cutting concerns rather than re-implementing them. |
| 87 | +- CRD types go in `api/v1beta1/`. Controller logic goes in |
| 88 | + `internal/controller/`. Resource-building helpers go in `internal/<service>` |
| 89 | + packages matching the CR they support. |
| 90 | +- Config templates are plain files in `templates/` -- they are mounted at |
| 91 | + runtime via the `OPERATOR_TEMPLATES` environment variable. |
| 92 | +- Webhook logic is split between the kubebuilder markers in `api/v1beta1/` and |
| 93 | + the implementation in `internal/webhook/`. |
| 94 | + |
| 95 | +## Testing |
| 96 | + |
| 97 | +- KUTTL integration tests live in `test/kuttl/`. |
| 98 | +- Run all tests: `make test`. |
| 99 | +- When adding a new field or feature, add corresponding test cases and update |
| 100 | + fixture data accordingly. |
| 101 | + |
| 102 | +## Key dependencies |
| 103 | + |
| 104 | +- [lib-common](https://github.com/openstack-k8s-operators/lib-common): shared modules for conditions, endpoints, database, TLS, secrets, Ansible, cert-manager, etc. |
| 105 | +- [infra-operator](https://github.com/openstack-k8s-operators/infra-operator): RabbitMQ and topology APIs. |
| 106 | +- [mariadb-operator](https://github.com/openstack-k8s-operators/mariadb-operator): database provisioning. |
| 107 | +- [keystone-operator](https://github.com/openstack-k8s-operators/keystone-operator): identity service registration. |
| 108 | +- [heat-operator](https://github.com/openstack-k8s-operators/heat-operator): Heat API for autoscaling integration. |
| 109 | +- [ovn-operator](https://github.com/openstack-k8s-operators/ovn-operator): OVN integration. |
0 commit comments