Skip to content

Broker credentials + TLS for the ElpioTask dispatcher#38

Merged
joy-software merged 1 commit into
mainfrom
feat/33-broker-creds-tls
Jun 7, 2026
Merged

Broker credentials + TLS for the ElpioTask dispatcher#38
joy-software merged 1 commit into
mainfrom
feat/33-broker-creds-tls

Conversation

@joy-software

Copy link
Copy Markdown
Contributor

What

The dispatcher brokers (Redis/RabbitMQ/NATS) connected with bare URLs and no auth or TLS. This adds optional connection settings to BrokerConfig and threads them into each broker's connect call.

Spec (models/task.py + both CRD copies)

  • broker.auth: username / usernameEnv, passwordEnv, token / tokenEnv.
  • broker.tls: enabled, caCert (PEM path), insecureSkipVerify.

Secret handling

Nothing sensitive lives in the CR. The *Env fields name an env var the dispatcher pod gets from a Secret. Precedence per value: the *Env var name wins over the inline literal. Passwords are env-only (no inline field). The reconciler maps the spec to ELPIO_BROKER_* env, passing secret references by name; the dispatcher resolves them at connect time.

Wiring

  • Redis: ssl / ssl_ca_certs + username / password.
  • RabbitMQ: PlainCredentials + SSLOptions.
  • NATS: tls context + user / password / token, tls:// scheme.

Client imports stay lazy and guarded, so the registry is still importable without redis/pika/nats. insecureSkipVerify defaults off and is documented as dev-only.

Tests

tests/unit/test_brokers.py asserts the connection kwargs/URL are built correctly from creds+TLS using fake/monkeypatched clients (no sockets). tests/unit/test_task_render.py asserts the reconciler emits the right env and never the password value. Existing NATS lifecycle tests untouched. Full unit suite green, ruff clean.

Also adds examples/task-secure-broker.yaml documenting the precedence.

Closes #33.

The Redis/RabbitMQ/NATS brokers connected with bare URLs, no auth, no
TLS. Add optional connection settings on BrokerConfig:

- auth: username (+ usernameEnv), passwordEnv, token (+ tokenEnv).
  Secrets are sourced from env var names, never inline plaintext in the
  CR. Precedence per value: the *Env var name wins over the inline
  literal; passwords are env-only by design.
- tls: enabled, caCert (PEM path), insecureSkipVerify (dev only).

The reconciler maps these to ELPIO_BROKER_* env on the dispatcher pod,
passing secret references by name. The dispatcher resolves them at
connect time and threads them into each client:

- Redis: ssl / ssl_ca_certs + username / password.
- RabbitMQ: PlainCredentials + SSLOptions.
- NATS: tls context + user / password / token, tls:// scheme.

Library imports stay lazy and guarded so the registry is importable
without redis/pika/nats. CRD schema (both the deploy and Helm copies)
and the Pydantic model are kept in sync, with an example manifest and
unit tests that assert the kwargs/URL are built correctly from a fake
client without opening sockets.
@joy-software joy-software merged commit 8634a9d into main Jun 7, 2026
7 of 8 checks passed
@joy-software joy-software deleted the feat/33-broker-creds-tls branch June 7, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant