'variable substitution in helm values file

I'm deploying a chart where I can add freely-defined key-value pairs( the sonarqube helm chart specifically but that's not relevant I think).

My values file looks like this:

...
sonar.properties:
  ldap.user: "myuser"   
  ldap.password: "mypassword"  
...

Now, I don't want to write the password on the values file, but neither can I pass it directly to helm with --set ldap.password=mypassword , since it's not a parameter of the chart, and I really don't want to modify the chart.

The question is: Is there a way to have variable replacement on the values file itself?

I saw the helm --post-renderer flag but I feel like this problem is generic enough to have a simpler solution instead of sed/awk-ing around, maybe I missed something in the docs.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source