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 support for Vault namespaces (used in Vault Enterprise) #39

Merged

Conversation

mariusgiger
Copy link

Add support for Vault namespaces (used in Vault Enterprise)

Description

This PR adds support Vault Enterprise namespaces. In accordance with vault-cli the Vault Namespace can be configured using the environment variable VAULT_NAMESPACE.

Also refer to: https://www.vaultproject.io/docs/commands#vault_namespace

Fixes #38

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Mentions:

@Just-Insane

src/vault.py Outdated
@@ -198,7 +198,7 @@ def __init__(self, args, envs):

# Setup Vault client (hvac)
try:
self.client = hvac.Client(url=self.envs.vault_addr, token=os.environ["VAULT_TOKEN"])
self.client = hvac.Client(url=self.envs.vault_addr, namespace=os.environ["VAULT_NAMESPACE"], token=os.environ["VAULT_TOKEN"])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears VAULT_NAMESPACE becomes mandatory when set this way, can it be made optional, and an additional error message added?

@Just-Insane
Copy link
Owner

Hello,

It appears this fails if VAULT_NAMESPACE is not provided, can this be made optional?

Some additional tests around vault namespaces would be needed as well.

@mariusgiger
Copy link
Author

Hello,

It appears this fails if VAULT_NAMESPACE is not provided, can this be made optional?

Some additional tests around vault namespaces would be needed as well.

Hi @Just-Insane, thanks for the feedback. I have fixed the issue where VAULT_NAMESPACE was required and have added some scripts to allow running tests locally without setting up a vault beforehand. Let me know what you think. When it comes to additional tests I am not sure how to best test this as this is an enterprise feature. Any hints?

Cheers,
Marius

@Just-Insane
Copy link
Owner

I'm also not sure how to test the Vault namespace feature, as I don't have an enterprise license.

It looks like this is all part of hvac so I'm not too worried about testing it within helm_vault itself.

@Just-Insane Just-Insane merged commit ba98d3a into Just-Insane:master Jun 1, 2021
Just-Insane added a commit that referenced this pull request Jun 1, 2021
Make some slight adjustments to the built-in help related to #39
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.

Add support for Vault Namespace
2 participants