Skip to content

Extract JSON key-value pairs from secrets #229

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

Open
vitordeap opened this issue Feb 28, 2023 · 3 comments
Open

Extract JSON key-value pairs from secrets #229

vitordeap opened this issue Feb 28, 2023 · 3 comments
Labels

Comments

@vitordeap
Copy link

TL;DR

Some secrets are stored with multiple properties (JSON structure, e.g. {"user":"user","password":"password"}. This feature would bring the ability of mounting secrets and extract the properties individually.

Design

Proposal
The existing structure for a secret object could have another property (array), such as extractKey. The file would be saved only with the value of the extracted key (e.g. only the password value). This would be an initial version just to enable this feature, in the future this can be improved by using multiple keys and maybe manipulating the JSON.

Example:

spec:
  provider: gcp
  parameters:
    secrets: |
      - resourceName: projects/<project_id>/secrets/<secret_name>/versions/<version>
         path: <filepath>
         extractKey: <my_json_key_to_be_extracted>
        

Alternatives considered
Today, we solve this by running bash scripts in the pods where the files were mounted, not a very nice design.

Resources
Other providers have this implementation, examples below:
AWS, check for the jmesPath field description.
Hashicorp Vault, check for the secretKey field description

Additional information
This will empower the provider to be used alongside other technologies, since the secrets can be used directly with config files easily. We intend to use this feature with prometheus, grafana, rabbitmq, etc.

@pragativ-splunk
Copy link

pragativ-splunk commented Jul 18, 2024

Any traction on a solution for this issue? We are trying to use something similar but unable to parse json credentials through csi

@RuiSMagalhaes
Copy link

no news @vitordeap ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants