Per-app ESO SecretStores: app ServiceAccount login and reader-tier OpenBao policies #186

Open
opened 2026-11-22 21:29:08 +00:00 by ginjiruu · 1 comment
Owner

ADR-0004 wanted each app to read only its own secrets, logged in as its own ServiceAccount. It chose VSO for that, and VSO was never deployed (lab/clusters#1525 closed unmerged, lab/clusters#1524 closed). ADR-0012 makes ESO the read path. This issue delivers the per-app isolation that ADR-0004 asked for, using ESO.

Today

Each cluster has one ESO identity in OpenBao: <cluster>-external-secrets (vault/modules/openbao-platform) on c1, and mini-external-secrets (vault/eso-mini.tf) on mini. Every app reads through a ClusterSecretStore logged in as that identity. Policies are scoped per cluster (c1: infra/apps/c1/*; mini: an explicit key list), so a namespace that can create an ExternalSecret can read every secret its cluster's ESO can read. The cheap interim guard is lab/clusters#1784 (namespace lists on the stores).

Target

  • Namespaced SecretStore per app. It lives in the app's namespace and logs in as the app's own ServiceAccount: auth.kubernetes.serviceAccountRef on c1, auth.jwt.kubernetesServiceAccountToken.serviceAccountRef on mini (kubernetes-mini, ADR-0010). A namespaced SecretStore can only reference a ServiceAccount in its own namespace, which gives the same-namespace binding ADR-0004 credited to VSO.
  • One OpenBao role per app, bound to that ServiceAccount and namespace (on mini, bound_subject = system:serviceaccount:<ns>:<sa>). The role carries a reader-tier policy for that app's paths and nothing else.
  • PushSecret into the generated/ tier (ADR-0002) stays on the cluster store. Per-app writer roles can come later if they turn out to be worth it.
  • ClusterSecretStores stay for platform namespaces (flux-system, cert-manager, external-dns and similar), with namespace lists from lab/clusters#1784.

Open questions

  • Path layout: per-app policies need a settled KV layout (secret/<key> on mini, infra/apps/<cluster>/... on c1). Decide that in #26 first, or pilot on c1, where the layout is already per app.
  • Who declares the per-app role and policy: hand-written in vault/ for the pilot, or generated by the catalog (#103, paused).
  • Pilot app: pick one with a single ExternalSecret and no PushSecret.

Done when

  • One pilot app reads through its own SecretStore and per-app role, and its namespace no longer appears in any ClusterSecretStore's namespace list.
  • The pattern is written down (an AGENTS.md section, or an amendment to ADR-0012), so the next app is a copy.
  • A follow-up lists the remaining apps to move.

Related: #184 (mini Vault retirement), lab/clusters#1669, #26, #103.

ADR-0004 wanted each app to read only its own secrets, logged in as its own ServiceAccount. It chose VSO for that, and VSO was never deployed (lab/clusters#1525 closed unmerged, lab/clusters#1524 closed). ADR-0012 makes ESO the read path. This issue delivers the per-app isolation that ADR-0004 asked for, using ESO. ## Today Each cluster has one ESO identity in OpenBao: `<cluster>-external-secrets` (`vault/modules/openbao-platform`) on c1, and `mini-external-secrets` (`vault/eso-mini.tf`) on mini. Every app reads through a ClusterSecretStore logged in as that identity. Policies are scoped per cluster (c1: `infra/apps/c1/*`; mini: an explicit key list), so a namespace that can create an ExternalSecret can read every secret its cluster's ESO can read. The cheap interim guard is lab/clusters#1784 (namespace lists on the stores). ## Target - **Namespaced SecretStore per app.** It lives in the app's namespace and logs in as the app's own ServiceAccount: `auth.kubernetes.serviceAccountRef` on c1, `auth.jwt.kubernetesServiceAccountToken.serviceAccountRef` on mini (`kubernetes-mini`, ADR-0010). A namespaced SecretStore can only reference a ServiceAccount in its own namespace, which gives the same-namespace binding ADR-0004 credited to VSO. - **One OpenBao role per app**, bound to that ServiceAccount and namespace (on mini, `bound_subject = system:serviceaccount:<ns>:<sa>`). The role carries a reader-tier policy for that app's paths and nothing else. - PushSecret into the `generated/` tier (ADR-0002) stays on the cluster store. Per-app writer roles can come later if they turn out to be worth it. - **ClusterSecretStores stay for platform namespaces** (flux-system, cert-manager, external-dns and similar), with namespace lists from lab/clusters#1784. ## Open questions - Path layout: per-app policies need a settled KV layout (`secret/<key>` on mini, `infra/apps/<cluster>/...` on c1). Decide that in #26 first, or pilot on c1, where the layout is already per app. - Who declares the per-app role and policy: hand-written in `vault/` for the pilot, or generated by the catalog (#103, paused). - Pilot app: pick one with a single ExternalSecret and no PushSecret. ## Done when - One pilot app reads through its own SecretStore and per-app role, and its namespace no longer appears in any ClusterSecretStore's namespace list. - The pattern is written down (an AGENTS.md section, or an amendment to ADR-0012), so the next app is a copy. - A follow-up lists the remaining apps to move. Related: #184 (mini Vault retirement), lab/clusters#1669, #26, #103.
Author
Owner

ADR: #188

ADR: #188
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/iac#186
No description provided.