fix(vault-config): refuse to auto-init when openbao-unseal already holds keys#1982
Merged
Merged
Conversation
…lds keys vault-init auto-ran 'bao operator init' whenever no pod reported an initialized barrier. That state is ambiguous: it is what a fresh install looks like, but it is ALSO what data loss looks like (raft dir missing/unreadable after a botched storage cutover). In the second case auto-init silently brings up an EMPTY vault and store-keys overwrites the previous unseal key + root token — which is exactly how the 2026-06-10 incident destroyed the entire KV store: the standalone→raft deploy flip-flop left openbao-0's data dir without a raft db, the Job saw 'uninitialized' and happily initialized a blank vault over it. Guard: if no pod is initialized BUT the openbao-unseal Secret already holds keys, fail loudly with recovery instructions instead. A fresh init then requires an explicit operator acknowledgement (kubectl delete secret openbao-unseal -n openbao). Fresh installs (no Secret) and Velero restores (Secret + data both present, pods report initialized) are unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jun 10, 2026
Contributor
Author
ℹ️ The 🧪 System Test failure here is pre-existing on main, not caused by this PR: every CI run since ~18:30 UTC today fails identically (including the unrelated Renovate PRs #1971/#1972/#1974). The test cluster's |
Contributor
|
🎉 This PR is included in version 1.47.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The
vault-initinit container auto-runsbao operator initwhenever no pod reports an initialized barrier. That state is ambiguous:store-keysthen overwrites the previous unseal key + root token inopenbao-unseal, making any surviving data unrecoverableThe second case is precisely how the 2026-06-10 incident destroyed the entire KV store: the standalone→raft deploy flip-flop (#1907 deployed pre-merge at 06:43 UTC, reverted by a main deploy at 13:08, re-applied at 14:57) left
openbao-0's data dir without a raft db; when the pods were rolled, the Job saw "uninitialized", initialized a blank vault over it at 17:48 UTC, and replaced the old keys.Fix
If no pod is initialized but the
openbao-unsealSecret already holds keys from a previous cluster, the Job now fails loudly with recovery instructions instead of initializing. A fresh init requires explicit operator acknowledgement of the data loss:Unaffected flows: fresh installs (no Secret → init proceeds), Velero restores (Secret + data PVCs both restored → pods report initialized → init skipped), and the current prod cluster (pods report initialized → init skipped).
Validation
kubectl kustomizelocal + prod ✅Companion to #1979/#1980/#1981 (2026-06-10 OpenBao incident remediation).
🤖 Generated with Claude Code