Skip to content

Add team_name attribute to plugins for multi-team#69502

Open
o-nikolas wants to merge 2 commits into
apache:mainfrom
aws-mwaa:onikolas/multi-team-plugins/foundation
Open

Add team_name attribute to plugins for multi-team#69502
o-nikolas wants to merge 2 commits into
apache:mainfrom
aws-mwaa:onikolas/multi-team-plugins/foundation

Conversation

@o-nikolas

Copy link
Copy Markdown
Contributor

First step for Plugin team awareness. This adds a team_name attribute to AirflowPlugin so a plugin can be scoped to a team, exposes it through the plugins API, and filters the /api/v2/plugins listing so users only see global plugins and plugins for teams they are authorized for when multi-team mode is enabled. The API server also validates at startup that every team-scoped plugin references an existing team.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

First step for Plugin team awareness. This adds a team_name attribute to
AirflowPlugin so a plugin can be scoped to a team, exposes it through the
plugins API, and filters the /api/v2/plugins listing so users only see
global plugins and plugins for teams they are authorized for when
multi-team mode is enabled. The API server also validates at startup that
every team-scoped plugin references an existing team.
return _get_plugins()[1]


def validate_plugin_teams() -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am only wondering if this is necessary to be honest. The person managing the environment might not be the same as the one managing the plugins? If a team gets deleted (I know, rare event), then all the plugins mentioning this team must be updated as well. In the API server we had this check and some users were complaining about it, thus we converted to warning instead of exception because it is too aggressive

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm interesting, is this any different than all the other checks we do in the Scheduler and Dag Processor for team existence?
Also the plugins are installed by the global admin and teams are created by them as well, so I think on that front it should be well synchronized.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Alright :) Hard to know anyway so we can go with that and adjust if needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, let's proceed with the most cautious approach and then we can roll it back from there if users are not liking it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:airflow-ctl area:API Airflow's REST/HTTP API area:plugins area:UI Related to UI/UX. For Frontend Developers. backport-to-airflow-ctl/v0-1-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants