Add companion TSIG API and BindTSIGAPI CRD #8

Merged
benvin merged 1 commits from benvin/tsig-companion-api into main 2026-07-12 19:01:34 +10:00
Owner

Why

The vault-plugin-secrets-bind-tsig plugin needs an HTTP endpoint that creates, reads, rotates and deletes TSIG keys on its behalf, so Vault never talks to the Kubernetes API directly. This adds that companion API and lets the operator deploy it declaratively via a new CRD.

Changes

  • Add the BindTSIGAPI CRD: creating one makes the operator reconcile a Deployment, Service, ConfigMap (env vars), token Secret and namespaced RBAC for the companion API. Spec covers image, replicas, port, targetNamespace, tokenSecretName, extra env, service exposure and resources.
  • Generate the master access token Secret only when absent, so a VaultStaticSecret may pre-seed/overwrite it; the operator does not own that Secret.
  • Add the companion API server (internal/tsigapi): bearer-auth HTTP contract — POST /v1/keys, GET/DELETE /v1/keys/{name}, POST /v1/keys/{name}/rotate — backed by BindTSIGKey custom resources the operator reconciles into key material.
  • Add cmd/tsigapi entrypoint and Dockerfile.tsigapi (distroless, nonroot).
  • Wire the reconciler into setup.go, regenerate CRDs/RBAC/deepcopy.
  • Add Woodpecker build (PR dry-run) and release (tag push) steps for the bind-tsig-api image.
  • Cover the API server with auth and key-lifecycle unit tests.

Follow-ups (separate PRs)

  • argocd-apps: deploy a BindTSIGAPI resource and broaden the operator's deployed RBAC to include deployments/serviceaccounts/roles/rolebindings.
  • Point vault-plugin-secrets-bind-tsig config at the API endpoint.
## Why The `vault-plugin-secrets-bind-tsig` plugin needs an HTTP endpoint that creates, reads, rotates and deletes TSIG keys on its behalf, so Vault never talks to the Kubernetes API directly. This adds that companion API and lets the operator deploy it declaratively via a new CRD. ## Changes - Add the `BindTSIGAPI` CRD: creating one makes the operator reconcile a Deployment, Service, ConfigMap (env vars), token Secret and namespaced RBAC for the companion API. Spec covers image, replicas, port, `targetNamespace`, `tokenSecretName`, extra env, service exposure and resources. - Generate the master access token Secret only when absent, so a `VaultStaticSecret` may pre-seed/overwrite it; the operator does not own that Secret. - Add the companion API server (`internal/tsigapi`): bearer-auth HTTP contract — `POST /v1/keys`, `GET`/`DELETE /v1/keys/{name}`, `POST /v1/keys/{name}/rotate` — backed by `BindTSIGKey` custom resources the operator reconciles into key material. - Add `cmd/tsigapi` entrypoint and `Dockerfile.tsigapi` (distroless, nonroot). - Wire the reconciler into `setup.go`, regenerate CRDs/RBAC/deepcopy. - Add Woodpecker build (PR dry-run) and release (tag push) steps for the `bind-tsig-api` image. - Cover the API server with auth and key-lifecycle unit tests. ## Follow-ups (separate PRs) - argocd-apps: deploy a `BindTSIGAPI` resource and broaden the operator's deployed RBAC to include deployments/serviceaccounts/roles/rolebindings. - Point `vault-plugin-secrets-bind-tsig` config at the API endpoint.
unkinben added 1 commit 2026-07-11 12:44:32 +10:00
Add companion TSIG API and BindTSIGAPI CRD
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
53db084c2d
The vault-plugin-secrets-bind-tsig plugin needs an HTTP endpoint that
creates, reads, rotates and deletes TSIG keys on its behalf, decoupling
Vault from direct Kubernetes API access. This adds that companion API and
lets the operator deploy it declaratively.

- Add BindTSIGAPI CRD: creating one makes the operator reconcile a
  Deployment, Service, ConfigMap (env vars), token Secret and namespaced
  RBAC for the companion API. Spec covers image, replicas, port,
  targetNamespace, tokenSecretName, extra env, service exposure and
  resources.
- Generate the master access token Secret only when absent, so a
  VaultStaticSecret may pre-seed/overwrite it; the operator does not own it.
- Add the companion API server (internal/tsigapi): bearer-auth HTTP
  contract POST /v1/keys, GET/DELETE /v1/keys/{name}, POST
  /v1/keys/{name}/rotate, backed by BindTSIGKey custom resources the
  operator reconciles into key material.
- Add cmd/tsigapi entrypoint and Dockerfile.tsigapi (distroless).
- Wire the reconciler into setup, regenerate CRDs/RBAC/deepcopy, and add
  Woodpecker build (PR dry-run) and release (tag push) steps for the
  bind-tsig-api image.
- Cover the API server with auth and key-lifecycle unit tests.
benvin merged commit 9ab475532c into main 2026-07-12 19:01:34 +10:00
Sign in to join this conversation.