feat(migrations): add OpenBao migration for event-ledger#378
Open
shelleyshen-0 wants to merge 1 commit into
Open
feat(migrations): add OpenBao migration for event-ledger#378shelleyshen-0 wants to merge 1 commit into
shelleyshen-0 wants to merge 1 commit into
Conversation
Adds 22_setup_event-ledger.sh with: - KV2 secrets engine at services/event-ledger/kv for Cassandra credentials - JWT secrets engine at services/event-ledger/jwt (issuer: http://event-ledger.nvcf.svc.cluster.local) - JWT signing roles for sis-api and nvca, merged into their existing auth roles - JWT auth role for the event-ledger service account (namespace: nvcf) Updates 07_setup_api-keys.sh: - Adds event-ledger to the registrations/services KV array (service ID: nvidia-cloud-events-ncp-service-id-ckozoh6f) - Switches the write to overwrite=true so re-runs on existing clusters pick up new entries
📝 WalkthroughWalkthroughThe migrations register event-ledger as a service, provision its Vault KV and JWT configuration, store Cassandra credentials, and create JWT signing and authentication roles for event-ledger, SIS, and NVCA. ChangesEvent Ledger Vault Provisioning
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Migration as 22_setup_event-ledger.sh
participant Vault
participant EventLedger as event-ledger service account
participant SIS
participant NVCA
Migration->>Vault: Provision KV and JWT mounts
Migration->>Vault: Store Cassandra credentials and policies
Migration->>Vault: Create event-ledger auth role
Migration->>Vault: Create SIS and NVCA signing roles
SIS->>Vault: Sign scoped JWT
NVCA->>Vault: Sign scoped JWT
EventLedger->>Vault: Authenticate with event-ledger policies
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@migrations/openbao/migrations/07_setup_api-keys.sh`:
- Around line 90-93: Add repository-native tests covering the base64-decoded
registration payload and overwrite behavior in
migrations/openbao/migrations/07_setup_api-keys.sh:90-93, and generated KV/JWT
mounts, policies, and preservation of existing SIS/NVCA role policies in
migrations/openbao/migrations/22_setup_event-ledger.sh:42-106; otherwise
document why these tests are not applicable and run the repository-native test
runner.
In `@migrations/openbao/migrations/22_setup_event-ledger.sh`:
- Line 44: The write_secrets_kv invocation for Cassandra credentials must not
interpolate DEFAULT_CASSANDRA_PASSWORD into the bao kv put arguments. Update the
event-ledger migration and its supporting write_secrets_kv flow in functions.sh
to use OpenBao’s stdin/file input form for the password while preserving the
existing username and secret path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 3655c746-1a25-421f-831f-477c0a975127
📒 Files selected for processing (2)
migrations/openbao/migrations/07_setup_api-keys.shmigrations/openbao/migrations/22_setup_event-ledger.sh
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.
TL;DR
Adds the OpenBao migration needed to integrate event-ledger into the self-managed stack. Event-ledger's Cassandra credentials are provisioned in its own KV2 secrets engine, its JWT secrets engine is set up as an issuer so SIS and NVCA can obtain JWTs for inbound writes, and event-ledger is registered as a service in api-keys-api.
Additional Details
22_setup_event-ledger.shsets up:services/event-ledger/kv— Cassandra credentials forevent_ledger_app_v0services/event-ledger/jwt— JWT secrets engine; SIS and NVCA sign tokens from here (scopes:fnds:createEvent,fnds:archiveEvents) to authenticate inbound writesevent-ledgerservice account in thenvcfnamespacesis-apiandnvcaauth roles viamerge_jwt_role_policies(no policy loss on re-run)07_setup_api-keys.shadds event-ledger to theregistrations/servicesKV array and switches tooverwrite=trueso re-runs on existing clusters pick up the new entry (this also fixes the same gap for the prior NVCT registration).For the Reviewer
07_setup_api-keys.shlines 37 and 88-91:write_secrets_kvis idempotent by default — it skips the write if the key already exists. Withoutoverwrite=true, existing clusters that ran migrations before this change would never get event-ledger (or NVCT) added to the registration list. The content is fully deterministic so overwriting on every run is safe.For QA
N/A
Issues
Relates to #167
Checklist
Summary by CodeRabbit