Apache Airflow version
main (development)
What happened
When airflow is loading its configuration, it creates a new secrets backend instance for each configuration backend it loads from secrets and then additionally creates a global secrets backend instance that is used in ensure_secrets_loaded which code outside of the configuration file uses. This can cause issues with the vault backend (and possibly others, not sure) since logging in to vault can be an expensive operation server-side and each instance of the vault secrets backend needs to re-login to use its internal client.
What you think should happen instead
Ideally, airflow would attempt to create a single secrets backend instance and re-use this. This can possibly be patched in the vault secrets backend, but instead I think updating the configuration module to cache the secrets backend would be preferable since it would then apply to any secrets backend.
How to reproduce
Use the hashicorp vault secrets backend and store some configuration in X_secret values. See that it logs in more than you'd expect.
Operating System
Ubuntu 18.04
Versions of Apache Airflow Providers
apache-airflow==2.3.0
apache-airflow-providers-hashicorp==2.2.0
hvac==0.11.2
Deployment
Official Apache Airflow Helm Chart
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct
Apache Airflow version
main (development)
What happened
When airflow is loading its configuration, it creates a new secrets backend instance for each configuration backend it loads from secrets and then additionally creates a global secrets backend instance that is used in
ensure_secrets_loadedwhich code outside of the configuration file uses. This can cause issues with the vault backend (and possibly others, not sure) since logging in to vault can be an expensive operation server-side and each instance of the vault secrets backend needs to re-login to use its internal client.What you think should happen instead
Ideally, airflow would attempt to create a single secrets backend instance and re-use this. This can possibly be patched in the vault secrets backend, but instead I think updating the
configurationmodule to cache the secrets backend would be preferable since it would then apply to any secrets backend.How to reproduce
Use the hashicorp vault secrets backend and store some configuration in
X_secretvalues. See that it logs in more than you'd expect.Operating System
Ubuntu 18.04
Versions of Apache Airflow Providers
Deployment
Official Apache Airflow Helm Chart
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct