To implement custom RBAC middleware for Flyte control plane, you would typically fork the FlyteAdmin service and add a gRPC/HTTP middleware that inspects incoming requests, extracts user identity (from authentication tokens), and enforces project/domain access policies. Hereβs a step-by-step outline based on community discussions and private forks:
1.
Fork FlyteAdmin: Clone the Flyte repository and focus on the FlyteAdmin service, which handles all control plane API requests.
2.
Add Middleware: Implement a middleware/interceptor for gRPC and HTTP endpoints. This middleware should:
- Extract the userβs identity and claims from the authentication token (e.g., JWT).
- Map claims (such as group or project membership) to allowed Flyte projects/domains, using a configuration file.
- For each API request, check if the user is authorized to access the requested project/domain.
- Reject unauthorized requests with an appropriate error.
3.
Update All Endpoints: Ensure the middleware is invoked for all relevant endpoints (e.g., workflow/task registration, execution, listing). This may require explicitly listing endpoints, as there is no generic way to cover all request types.
4.
Maintain Configuration: Keep the claim-to-project mapping up to date as new projects or users are added. Optionally, implement a default mapping for new projects.
5.
Test and Deploy: Thoroughly test the middleware to ensure it blocks unauthorized access and does not break legitimate workflows. Deploy the custom FlyteAdmin in your environment.
Caveats:
- This approach is manual and brittle: new API endpoints must be added to the middleware, or they may bypass authorization.
- Upstream changes to FlyteAdmin may require you to rebase and update your fork.
- This is not officially supported and may not scale well for large organizations.
For more details and real-world experiences, see the
project isolation RFC and discussion and
project isolation issue.
Sources:
-
RFC: Project isolation custom fork
-
Flyte Project isolation π 0 button π 0 button π‘
Hint: Mention @runllm in the thread for followups.