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

Feature: Allow retrieval of a JSON from secretKey value #122

Closed
wants to merge 1 commit into from

Conversation

agates4
Copy link

@agates4 agates4 commented Dec 3, 2021

#115
This issue describes how if a key with the value of a JSON is specified, it will not be successfully returned because it is not a string. However, if no secretKey is specified, the entire JSON response is returned, with no option for selecting a specific inner JSON. This means that the standard data: {}, metadata: {} response of Vault is at the top level of the JSON.

Problem Use-case
For a sample use-case, this means that a JSON service account secret cannot be successfully mounted into a Kubernetes pod using the vault-csi-provider, without the additional properties of the fully returned response.

Solution
Allow the retrieval of a JSON from the secretKey value.

Updates

  • If the value of secretKey within the secret data is not a string,
    • Check if it is a valid JSON and return the full JSON if it is
  • Test for the return of an expected JSON

@agates4
Copy link
Author

agates4 commented Dec 22, 2021

Requesting a review from @tomhjp @tvoran

@agates4
Copy link
Author

agates4 commented Jan 3, 2022

Hey folks it's been 1 month since submission @tomhjp @tvoran.

Any feedback is better than no feedback.

@tomhjp
Copy link
Contributor

tomhjp commented Jan 10, 2022

Hi @agates4, thanks for raising this PR and UX issue. I think you should be able to mount JSON content with today's code, but you would have to escape it all into a big long string which is obviously far from ideal.

I needed to play around with this myself to properly understand the way we should process string vs JSON data and whether we needed any special casing. In the process I've expanded the change set a bit to have as little special casing as possible and also pass around []byte contents instead of string as that now seems to make more sense. I've opened #126, which should address this. Feel free to leave any comments there.

@tomhjp tomhjp closed this Jan 10, 2022
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.

2 participants