Skip to content

Make auth managers provide their own airflow CLI commands #33481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 23, 2023

Conversation

vandonr-amz
Copy link
Contributor

@vandonr-amz vandonr-amz commented Aug 17, 2023

closes #32206
closes #32208
closes #32348

taking a lot of inspiration from #29055
Since auth managers are going to be configurable, we don't want their specific commands to be defined in airflow core.
Thus, this PR moves (almost) everything auth manager-related to the fab corner, and adds a mechanism so that auth managers can provide their own CLI commands.

On my computer, running this with the FAB auth manager makes the commands take 10 to 15 extra milliseconds, which seems reasonable.

@@ -182,7 +182,7 @@ def initialize_database(self):
# server. Thus, we make a random password and store it in AIRFLOW_HOME,
# with the reasoning that if you can read that directory, you can see
# the database credentials anyway.
from airflow.utils.cli_app_builder import get_application_builder
from airflow.auth.managers.fab.cli_commands.utils import get_application_builder
Copy link
Contributor

@vincbeck vincbeck Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not good. We do not want Airflow to have a dependency on FAB auth manager. People might use another Auth manager and not even have FAB auth manager installed (this is assuming FAB auth manager is moved to a separate provider)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I know, we talked a bit about it on Thursday when we looked at the code together :)
I moved the "easy" commands in the PR, this one will need to move (at least partially) too, but the situation is a little bit more complex, I suggest dealing with it in a separate PR, where I'd introduce an init_airflow method in auth managers for instance.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am okay with that but we definitely do not want to forget it. This is something we really dont want

@vincbeck
Copy link
Contributor

Does it resolve #32348 as well?

@vincbeck vincbeck added the AIP-56 Extensible user management label Aug 18, 2023
@vandonr-amz
Copy link
Contributor Author

Does it resolve #32348 as well?

ah yes indeed, I didn't see there was a separate ticket for this

@vandonr-amz
Copy link
Contributor Author

@vincbeck you left a "requesting changes" review, I think your concerns have been addressed ?

@vincbeck
Copy link
Contributor

@vincbeck you left a "requesting changes" review, I think your concerns have been addressed ?

Approved

@o-nikolas o-nikolas merged commit b1a3b42 into apache:main Aug 23, 2023
@vandonr-amz vandonr-amz deleted the vandonr/fab branch August 23, 2023 21:58
@ephraimbuddy ephraimbuddy added the changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) label Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AIP-56 Extensible user management area:CLI area:providers changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) provider:celery
Projects
None yet
4 participants