Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add write support for vaulktkv secrets #925

Closed
wants to merge 23 commits into from

Conversation

MatteoVoges
Copy link
Contributor

@MatteoVoges MatteoVoges commented Jan 20, 2023

Proposed Changes

  • Support writing vaultkv secrets with kapitan.

Examples

  • ref-tag-pattern: ?{vaultkv:path/to/ref:mount_in_vault:path/in/vault:key||random:str}
  • If some of the fields are not specified then following defaults get chosen:
    • e.g. tag ?{vaultkv:path/to/ref:::key||random:str} would create / lookup a secret with
      • mount=secret and
      • path/in/vault=path/to/ref

I could check that always the last entry is the key, so that the ::: isn't neccessary. (will be put in a future issue)

CLI

Use kapitan refs --write vaultkv:test/secret -f test/secret/file -- refs-path refs/path --vault-mount testmount --vault-path test/path -- vault-key testkey to write your secret stored in test/secret/file to kapitan ref engine.

Known issues

  • Some of the appended functions do not work, e.g. |base64 (testing needed)
  • mount can't be specified per ref tag (only in vault-params (inside whole target) or secret as default)
  • Future Issue (not relevant for base functionality): Only one key per path is allowed and will be overwritten (versioned). We could fix that with checking if a key already exists and ask the user if he wants to continue. Alternatively we could just throw an error.

TODO

  • Add documentation
  • Refactor code (some parts are no longer needed)
  • Add tests
  • Add CLI (kapitan refs) support
  • Fix current tests

@MatteoVoges
Copy link
Contributor Author

MatteoVoges commented Jan 27, 2023

Hey @ramaro and @ademariag ,
the base functionality is finished now. The other appended functions like |base64 or sha256 are compatible with it as well. I would mark the PR as ready for review, so that you can have a look at it.

As already written in the description, I will move some features into another issue for the future.

The errors are fixed now :)

@MatteoVoges MatteoVoges marked this pull request as ready for review February 10, 2023 11:02
@MatteoVoges
Copy link
Contributor Author

replaced by #958

@MatteoVoges MatteoVoges deleted the vaultkv-write-secrets branch February 28, 2023 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant