vault: ESO may write generated credentials under infra/apps/<cluster>/generated/ #161

Closed
opened 2026-11-19 04:01:07 +00:00 by ginjiruu · 0 comments
Owner

c1 apps need credentials that are generated once and survive a rebuild or a restore onto another cluster: the PowerDNS API key (lab/clusters#1673) and the UniFi admin and mongo passwords (#81). Pattern: an ESO ClusterGenerator mints the value, a PushSecret with updatePolicy: IfNotExists stores it in OpenBao, and an ExternalSecret reads it back. OpenBao is the source of truth, so a second cluster reads the existing value instead of making a new one.

Today <cluster>-external-secrets is read-only on infra/apps/<cluster>/*. Needed: create/update under infra/apps/<cluster>/generated/*, and never delete or destroy.

Policy-level write-once (create without update) breaks ESO: it writes the key's custom_metadata before the data, so its first data write already counts as an update. Tested on a throwaway OpenBao dev server (call order from ESO v2.14 providers/v1/vault/client_push.go):

Policy on generated/ ESO create sequence overwrite v1 after overwrite delete / destroy / metadata delete
create, read 403 on first data write n/a n/a 403
create, read, update (proposed) passes allowed readable 403

Write-once therefore comes from IfNotExists on the PushSecret. The policy guarantees nothing is ever lost: KV v2 keeps 10 versions and no delete or destroy is granted.

c1 apps need credentials that are generated once and survive a rebuild or a restore onto another cluster: the PowerDNS API key (lab/clusters#1673) and the UniFi admin and mongo passwords (#81). Pattern: an ESO ClusterGenerator mints the value, a PushSecret with `updatePolicy: IfNotExists` stores it in OpenBao, and an ExternalSecret reads it back. OpenBao is the source of truth, so a second cluster reads the existing value instead of making a new one. Today `<cluster>-external-secrets` is read-only on `infra/apps/<cluster>/*`. Needed: create/update under `infra/apps/<cluster>/generated/*`, and never delete or destroy. Policy-level write-once (create without update) breaks ESO: it writes the key's `custom_metadata` before the data, so its first data write already counts as an update. Tested on a throwaway OpenBao dev server (call order from ESO v2.14 `providers/v1/vault/client_push.go`): | Policy on generated/ | ESO create sequence | overwrite | v1 after overwrite | delete / destroy / metadata delete | |---|---|---|---|---| | create, read | 403 on first data write | n/a | n/a | 403 | | create, read, update (proposed) | passes | allowed | readable | 403 | Write-once therefore comes from `IfNotExists` on the PushSecret. The policy guarantees nothing is ever lost: KV v2 keeps 10 versions and no delete or destroy is granted.
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#161
No description provided.