feat: configurable Vault storage key and write action (replace/append) - #77
Open
cxdy wants to merge 1 commit into
Open
feat: configurable Vault storage key and write action (replace/append)#77cxdy wants to merge 1 commit into
cxdy wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates latr’s Vault KV v2 storage behavior to support configurable data keys and configurable write semantics (replace vs append with CAS), enabling in-place adoption for pre-existing Vault secrets without changing secret paths in downstream consumers.
Changes:
- Add
storage.key(KV data key) andstorage.action(replace/append) for Vault storage, with defaulting/normalization and config validation. - Implement KV v2 append behavior via read-modify-write with CAS retries in the Vault client.
- Update docs/examples/tests to treat
storage.pathas relative tovault.mount_path(omit mount name anddata/).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/testdata/config-rotate.yaml | Update e2e config to use mount-relative Vault path. |
| test/e2e/testdata/config-dryrun.yaml | Update e2e config to use mount-relative Vault path. |
| test/e2e/testdata/config-daemon.yaml | Update e2e config to use mount-relative Vault path. |
| test/e2e/testdata/config-create.yaml | Update e2e config to use mount-relative Vault path. |
| README.md | Document mount-relative paths and new key/action fields and AppRole policy implications. |
| internal/vault/client.go | Implement configurable key + replace/append write actions with CAS retry logic. |
| internal/vault/client_test.go | Add/adjust tests for custom key, replace vs append behavior, and CAS retries. |
| internal/rotation/engine.go | Pass normalized key/action from storage config through to Vault client; log chosen values. |
| internal/rotation/engine_test.go | Update mocks and add coverage for custom key and append action. |
| internal/config/loader_test.go | Update config test data to use mount-relative Vault path. |
| internal/config/config.go | Add key/action fields, defaults/normalization, and storage validation. |
| internal/config/config_test.go | Add tests for defaults, normalization, and validation of new storage fields and path rules. |
| helm/latr/values.yaml | Update Helm values documentation for mount-relative path plus key/action. |
| helm/latr/README.md | Update Helm chart docs/examples for mount-relative Vault path. |
| examples/config.yaml | Update example config with mount-relative path and demonstrate key/action. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cxdy
force-pushed
the
feat/override-key-and-action
branch
from
July 23, 2026 08:51
67240eb to
c96233a
Compare
cxdy
force-pushed
the
feat/override-key-and-action
branch
from
July 23, 2026 13:08
c96233a to
2687894
Compare
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.
latr currently sets the key to
tokenwhen storing Linode API tokens in Vault, i.e:This is unfortunate for many reasons, but a big one is being able to migrate in-place to using latr when you've already got API keys all over the place in Vault. This way, I can have an existing token at
{mount}/data/tokens/api-token, but the data ismy-api-token: REDACTEDand latr can drop in and replace it when it's time. No need to go update Vault paths in your code to use latr.This also adds in the
actionbehavior:replace(default) - replaces the entire secret, so you're left withtoken: yOuRnEwApItOkEnappend- appends the new token to the existing secret, so you're left with something more like the example at the top.appendsounds dangerous, yes, but we are practicing CAS (check-and-set) here to prevent situations where:maxAppendCASAttemptsininternal/vault/client.go)