# Production adapters

rs-zero exposes production adapters through optional features while preserving a no-external-service default test path.

## Discovery

- `discovery-etcd` provides a real etcd v3 registry with key/value codecs, lease keep-alive, watch reconnect, health updates, and deregistration.
- `discovery-kube` runs a real Kubernetes EndpointSlice watcher, keeps a local discovery cache, and keeps fixture mapping for offline tests.

External service tests are ignored by default and run through [External integration CI](external-integration-ci.md). Kubernetes CI uses KinD with `kind-rs-zero-external`; local kubeconfig contexts can still be selected with `RS_ZERO_KUBE_CONTEXT` for manual runs.

## Observability

`rs-zero` has an OTLP traces configuration model and shutdown handle. The default build validates configuration without requiring a collector. Real transport dependencies are behind the `otlp` feature and the external CI verifies exporter install, span flush, and shutdown against a local collector.

## Database and cache

- `db-sqlite` provides SQLx SQLite pool setup by default.
- `db-mysql` and `db-postgres` provide MySQL/PostgreSQL pool helpers, health checks, and transaction helper APIs.
- `cache` defines the async cache trait and in-memory backend.
- `cache-redis` provides Redis configuration, client factory, and a cache-store facade that keeps default tests offline.
- `profiling` provides the Pyroscope adapter; external CI validates agent startup and shutdown against a local Pyroscope service.

## CLI generation

`rzcli model gen` supports:

```bash
rzcli model gen -s examples/model-cache/schema.sql -d target/generated --with-sqlx --with-redis-cache
rzcli model gen -s examples/model-cache/schema.sql -d target/generated --with-sqlx --sqlx-backend mysql
rzcli model gen -s tests/fixtures/postgres/model/user.sql -d target/generated --dialect postgres --with-sqlx
```

The generator emits skeletons only. MySQL generation uses `rs_zero::db::MySqlDatabasePool` when `--sqlx-backend mysql` is selected. PostgreSQL generation uses `rs_zero::db::PostgresDatabasePool` when `--dialect postgres --with-sqlx` is selected. Applications still own concrete database queries, Redis topology, credentials, and deployment configuration.

## Production checklist

Use [production-checklist.md](production-checklist.md) before enabling external adapters in a real environment. The checklist keeps default local verification separate from credentials, endpoints, health checks, timeout/backoff settings, and rollback decisions. For repeatable real-dependency checks, use [external-integration-ci.md](external-integration-ci.md).
