openfaas / connector-sdk

SDK for connecting events to functions
MIT License
54 stars 25 forks source link

[Feature Request] Filter functions based on its namespace #56

Open flusflas opened 3 years ago

flusflas commented 3 years ago

My actions before raising this issue

It seems that the connector-sdk maps all functions ignoring the namespace they are in. This is a problem, specially in multi-tenant environments.

Expected Behaviour

Configuration should accept a namespace in order to get only the functions deployed in that namespace.

Current Behaviour

At this moment, all functions are mapped without taking the function's namespace into account.

Possible Solution

Adding a Namespace attribute to ControllerConfig would allow to filter functions by namespace. If the namespace is not set, the namespace value would be empty (by default) and everything would work as usual, so it wouldn't be a breaking change but a feature. Connectors (mqtt-connector, rabbitmq-connector...) will need to add support to set a namespace, e.g. using an environment variable.

I added a pull request to add support for namespace filtering that shows how I've tried to solve this problem.

Context

I'm working in a multi-tenant platform that allows users to deploy their own functions. In order to group functions by users, they are deployed in different namespaces. The same way, users should be able to deploy connectors that must only invoke the functions deployed in the user's namespace.

Your Environment

mathieuforest commented 2 years ago

Is it supported yet?