Add config option [secrets]backends_order#45931
Add config option [secrets]backends_order#45931moiseenkov wants to merge 1 commit intoapache:mainfrom
Conversation
61b5ab6 to
4489808
Compare
4489808 to
58d80f3
Compare
|
@eladkal , please take a look at the updates. |
|
I was initially against making it configurable, but seeing the simplicity and flexibility, I am in. |
|
@eladkal ? |
|
hi there! |
|
We are on feature freeze for Airflow 3. |
|
Yeah. I think that might be 3.1 |
8c516f8 to
347e2f1
Compare
eladkal
left a comment
There was a problem hiding this comment.
prevent accidental merge. We are on feature freeze for Airflow 3.
PR can not be merged till main branch is for 3.1
| backends_order: | ||
| description: | | ||
| Comma-separated list of secret backends. These backends will be used in the order they are specified. | ||
| Please note that the `environment_variable` and `metastore` are required values and cannot be removed | ||
| from the list. Supported values are: | ||
|
|
||
| * ``custom``: Custom secret backend specified in the ``secrets[backend]`` configuration option. | ||
| * ``environment_variable``: Standard environment variable backend | ||
| ``airflow.secrets.environment_variables.EnvironmentVariablesBackend``. | ||
| * ``metastore``: Standard metastore backend ``airflow.secrets.metastore.MetastoreBackend``. | ||
| version_added: 3.0.0 | ||
| type: string | ||
| example: ~ | ||
| default: "custom,environment_variable,metastore" |
There was a problem hiding this comment.
i am a bit concerned making it just a "hidden" setting.
I think we better to come up with a way to expose the chosen order in the UI. that way DAG authors can verify and use it for debug for questions like (why I see wrong value in variable).
Also, correct me if I am wrong the order affect only read, not write. maybe the setting should be backends_read_order?
There was a problem hiding this comment.
Hello @eladkal ! I don't see any info regarding the secrets section the UI is using right now. So maybe we could skip it for now? What do you think?
Regarding the naming. As stated in the doc it is responsible for secrets backends search ordering. So maybe backends_search_order is more convenient?
There was a problem hiding this comment.
right now it's not configurable so the Airflow docs is good enough but after this PR is accepted the Airflow docs can't help you... You'll need to check the deployment to understand the priority order.
In many deployments dag authors don't have access to the deployment code.
My thoughts on the UI is an improvement (I think crucial but that is just my own perspective) I welcome others to share their thoughts. This feature is already targeting 3.1+ so regardless if we do the UI part or not we can't merge it now. We need to wait for main branch to become 3.1 (probably only after we cut RC1 for Airflow 3(
There was a problem hiding this comment.
Hi there!
I see that we are close to release Af3.1, so maybe we can merge this change?
Thanks :)
347e2f1 to
2b750de
Compare
2b750de to
4c0d958
Compare
|
This looks good to me - but I think it might be worth to raise a devlist discussion for it @VladaZakharova -> there were past discussions about changing the sequence of resolving configurations, and I know people have strong opinion about "fixed" vs. "confifurable" sequence - and there are arguments pro / against each of those options. I think it would be good to raise a discussion asking what peopel think about it and try to reach consensus. |
I agree. I am not comfortable with making this change without the UI indication / other mechanisem that allows dag authors to see the cluster admin setup for backend order |
|
@VladaZakharova @moiseenkov @Crowiant I will take a look at this one soon. |
|
I wonder if this should just be called |
| secrets_backend = | ||
| secrets_backend_kwargs = | ||
|
|
||
| backends_order = |
There was a problem hiding this comment.
This doesn’t read right? The key implemented here is not under [workders].
There was a problem hiding this comment.
Hello @uranusjr ! Thank you for your review and comments!
No, actually it should be under both sections: [secrets] and [workers]. Because after talking with @amoghrajesh We agreed that implementation should be extended on workers too.
| execution_args = ( | ||
| "airflow.sdk.execution_time.secrets.execution_api.ExecutionAPISecretsBackend" | ||
| if "airflow.sdk.execution_time.secrets.execution_api.ExecutionAPISecretsBackend" | ||
| in default_backends | ||
| else None | ||
| ) |
There was a problem hiding this comment.
We are trying to avoid importing sdk in airflow core when possible
There was a problem hiding this comment.
Could you expand a little bit on this? ExecutionAPISecretsBackend exists only in task-sdk and applies for the workers. Where else could it be imported?
64d53e7 to
437208f
Compare
785af81 to
2015d8b
Compare
2015d8b to
a5092ed
Compare
a5092ed to
41b4d5d
Compare
|
Hello @amoghrajesh @uranusjr I responded to your comments in the PR. Could you please help with the review? |
|
@amoghrajesh @uranusjr -> any comments here? I think there were some important questions/comments from you and I would love to merge that one to make sure it makes it for 3.2 (it looks good in general). |
|
I don't have time to re-review but I still have some concerns. I advise to tag this as experimental feature so community will use this feature with judgment. |
Good idea @eladkal |
41b4d5d to
4ff5632
Compare
|
Can you please resolve conflicts and fix the remaining static check? |
fee065b to
9a7803e
Compare
|
Hello @potiuk I updated the PR. Since checks are passing, can we merge if there are no objections? |
|
Sorry for that - I've been a bit busy - can you please rebase one more time as it needs more conflict resolution - also the UI part is somethign maybe @jason810496 can you re-review? |
c1085eb to
903e4fb
Compare
|
@eladkal - looks like your concerns are alleviated - can you please remove "request changes"? |


Introduce a new configuration option for specifying secret backends load order:
The default value represents current behavior, thus nothing will change for existing users.