democratic-csi / democratic-csi

csi storage for container orchestration systems
MIT License
878 stars 77 forks source link

Allow injecting environment variables into the driver config #400

Open LiquidPL opened 5 months ago

LiquidPL commented 5 months ago

I'm trying to deploy democratic-csi using ArgoCD and sealed-secrets, and I'd like to avoid having to seal the entire driver config as a secret. I was wondering if it could be possible to somehow inject values from the environment variables into the config, for example:

driver:
  config:
    driver: freenas-api-nfs
    instance_id:
    httpConnection:
      protocol: http
      host: 10.0.0.1
      port: 80
      apiKey: '{{ env "TRUENAS_API_KEY" }}' # or any other sort of marker that would be picked up by the driver

The value of the apiKey field would then be replaced with the api key pulled from the env vars.

LiquidPL commented 5 months ago

I found out that this can be accomplished directly in the YAML parser using YAML tags: https://github.com/nodeca/js-yaml/blob/master/examples/custom_types.js. it's now handled differently - see PR

I will try sending in a PR to add this.

rouke-broersma commented 4 months ago

This would be great, I have the same setup and the same issue :)

drewburr commented 3 months ago

Would be great to manage sensitive values in a separate config so it's easier to manage. Let me know if a tester is needed for #401