Skip to content
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

Distinguish between functions belonging to different gateways #55

Closed
kinghuang opened this issue Apr 19, 2017 · 12 comments
Closed

Distinguish between functions belonging to different gateways #55

kinghuang opened this issue Apr 19, 2017 · 12 comments

Comments

@kinghuang
Copy link
Contributor

Expected Behavior

If there are multiple gateways in the same swarm, it should be possible to configure the gateways to pick up specific sets of functions, perhaps by labels. Otherwise, each gateway picks up all function services in the swarm.

Current Behavior

Function services are currently denoted by the presence of a function label on the service. Gateways automatically pick up all services with this label.

Possible Solution

As an example, Traefik can be configured with constraints for which Traefik configured services it handles. Only services that match the constraint (via tags on labels) will be handled by the Traefik instance. This enables multiple instances of Traefik to be deployed on a swarm, each handling a different set of services.

Context

I'm trying out FaaS in a project. The repo branches for this project are automatically built and deployed on a Docker swarm for review as part of a CI/CD process. The FaaS gateways from the deployments are picking up the functions from all the deployments, not just the specific branch. There doesn't seem to be a way to limit each gateway to the services for a specific deployment.

Your Environment

  • Docker version docker version (e.g. Docker 17.0.03 ): 17.0.04
  • Operating System and version (e.g. Linux, Windows, MacOS): Development on macOS. CI/CD deployments on RHEL 7.3.
  • Link to your project: Not available (internal).
@alexellis
Copy link
Member

Hi @kinghuang,

Thanks for opening this issue. I'd like to understand your use-case a little more.

In terms of two making FaaS gateways available - have you tried deploying individual stacks on separate networks? Can you share your YAML file with me?

# docker stack deploy pipeline1 -c ./stack1.yml
# docker stack deploy pipeline2 -c ./stack2.yml

@alexellis alexellis self-assigned this May 12, 2017
@alexellis
Copy link
Member

I could reproduce the issue with the steps above. Both gateways saw the functions from either stack.

How would you propose injecting the unique network name / namespace into the gateway process/container?

@alexellis
Copy link
Member

You can use this test implementation - and provide a stack_namespace environmental variable to your gateways. This will filter your functions to only the gateway / stack they belong to.

https://github.com/alexellis/faas/compare/filter_networks?expand=1

@alexellis
Copy link
Member

@kinghuang please can you give feedback on above?

@kinghuang
Copy link
Contributor Author

@alexellis Will do! I've added this to my task list.

@kinghuang
Copy link
Contributor Author

@alexellis Sorry again to take so long. I'm finally ready to take a look at this, but it looks like the filter_networks branch is gone. Any chance you can push that back up and I'll review it right away? Thanks.

@alexellis
Copy link
Member

We're talking about an issue opened in April.. so I think I pruned it. The branch should be there again now thanks for looking 👍

@kinghuang
Copy link
Contributor Author

Thanks. I don't see it on GitHub, yet. Mind double-checking the branch?

@kinghuang
Copy link
Contributor Author

@alexellis I still don't see the branch. Considering how much development has happened since May, would it be better to just re-implement? If so, I will take that on.

@alexellis
Copy link
Member

Sure. Please join us on Slack to coordinate - message alex@openfaas.com

@alexellis
Copy link
Member

@kinghuang thanks for joining. Here is the branch - https://github.com/alexellis/faas/compare/filter_networks?expand=1

@alexellis
Copy link
Member

Derek add label: priority/low

@ghost ghost added the priority/low label Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants