openfaas / connector-sdk

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

Allow to filter functions based on its namespace #55

Closed flusflas closed 1 year ago

flusflas commented 3 years ago

Description

This pull request adds a Namespace field in the ControllerConfig struct to enable function filtering by namespace. This way, if a namespace is provided, only functions from that namespace will handled (mapped and, consequently, invoked).

I know contributing guidelines ask to raise a proposal before opening a pull request, but this is a needed feature for me, so I'm sorry for the rush.

Motivation and Context

In a multi-tenant environment, where there are many namespaces which are supposed to be isolated, the connector is not very useful because it ignores the namespaces the functions are in.

How Has This Been Tested?

A new test function with two sub-tests has been added to function_list_builder_test.go to cover filtering and non-filtering (default) use cases.

Types of changes

Checklist:

alexellis commented 3 years ago

Hi thanks for your interest in the project.

You will need to raise an issue for discussion before we can consider reviewing a PR or solution.

In the issue make sure you detail your openfaas usage and whether this is a real problem you've faced, and how many namespaces you have, or whether it's a hypothesis / nice to have.

Please read "I want to contribute on GitHub" carefully.

Alex

alexellis commented 3 years ago

/add label: design/not-approved

alexellis commented 3 years ago

/add label: no-proposal

mathieuforest commented 2 years ago

@flusflas any interest to complete this PR?

flusflas commented 2 years ago

Some conflicts have appeared since the time I made this PR. I just updated the branch.