Secrets Backend Search Path Ordering/Priority
See original GitHub issueDescription
A way to set a custom secrets backend to be lower priority than the built-in airflow.secrets.environment_variables.EnvironmentVariablesBackend
and airflow.secrets.metastore.MetastoreBackend
.
Use case / motivation When creating a our own secrets backend utilizing Secret Server, our team noticed you cannot configure the the custom backend to be a lower priority than the default secrets backends. In certain cases, we have DAGs that write to different sets of external systems and being able to change one of those external systems easily via environment variable to test certain conditions is a very simple way to validate things, and we also have several variables that have no need of security and checking the env vars first eliminates that network call/load to a busy system.
Now as a workaround, I do realize we can have our own secrets backend check available env vars first, but this does seem a bit clunky given the current design.
The goal would be to be able to toggle a custom backend to be lower priority such that the metastore and env vars are checked first.
Are you willing to submit a PR?
Yes, definitely.
Related Issues
You could argue #16404 is slightly related.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:10 (8 by maintainers)
Top GitHub Comments
Maybe we should ship a secret backend implementation that allows the user to pass multiple secret backends and search them in that order? Something like:
This way the user can do something like
We could even introduce some shorthands like
airflow.EnvironmentVariablesBackend
.I think the priority is correct and will cause confusion if changed later on. And with customer Secrets Backend, you can mix and match however you like. We intentionally did this (same fox XCom Backend) so that companies can create one for their own needs as ONE SIZE DOES NOT FEEL ALL.
That being said, something I had planned earlier, was to allow DAG Authors to pick a single backend to choose the variable or connections from ( Not getting configurations from Secrets Backend though ).
For Example the following will only check Environment Variables to get Airflow Variables.:
Only changes required:
cc @fhoda