Add support for META_PASSWORD_FILE #6438
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Support for
META_PASSWORD_FILEas an alternative toMETA_PASSWORD. When set,META_PASSWORD_FILEshould point to a file containing the password for the metadata engine. It should work exactly asMETA_PASSWORDdoes today, but just file oriented instead of environment variable oriented.Currently, JuiceFS supports passing the metadata engine password via environment variable. In the context of Kubernetes, this typically means storing the password in a Kubernetes secret and then injecting into a pod via environment variable.
However many organizations discourage the use of Kubernetes secrets (due to lack of encryption, no native rotation capability, limited auditing, etc.) and instead use external secrets system such as Hashicorp Vault.
Moreover, some organizations use systems like consul-template, which only expose secrets as files.
The purpose of
META_PASSWORD_FILEis expose the secret as a file to support systems that expose secrets as files instead of environment variables such as consul-template.Testing
I used docker-compose to test this feature for both postgres and redis.
Postgres
docker-compose-postgres.yaml
From the
juicefs-testcontainer.Setup
With
META_PASSWORD_FILEsetWithout anything set (fails)
With
META_PASSWORDenvironment variableMETA_PASSWORDtakes precedence overMETA_PASSWORD_FILERedis
docker-compose-redis.yaml
Setup
With
META_PASSWORD_FILEsetWith nothing set (fails)
With
META_PASSWORDsetMETA_PASSWORDtakes precedence overMETA_PASSWORD_FILE