Dealing with secrets in MongoDB helm chart

Morning all, hope this is the right forum!

Currently dealing with the creation of several users and after checking the bitnami chart available options, just seen this two:

  #initdbScripts:
  #    initDB.js: |

  ## Existing ConfigMap with custom init scripts
  ##
  # initdbScriptsConfigMap:

However, I’m facing how to hide user passwords away from those scripts and serve them as an environment variable which is provided by a config map. How is that linkage?

      init_db_script.js: |
        use admin

        sample_user={
          user: "sample-user",
          pwd: ???, # How can I link this to a cm envvar incoming from a secret?
          roles: [
              {role: "readWriteAnyDatabase",db:"admin"}]
        }

Is there an easy way to do so? Thanks a lot!

Hello @eddy_turbox
Welcome to the community!!

There are ways when you can set the environment variable with the username and password and let the secrets apply the same variable. A reference for this is support for environment variables · Issue #944 · helm/helm · GitHub

However, would strongly recommend you to to visit Helm community for more assistance.

Let us know if you need any further assistance.

Thanks
Aasawari

3 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.