openfaas / connector-sdk

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

Add multiple namespaces support #36

Closed viveksyngh closed 4 years ago

viveksyngh commented 4 years ago

This commit adds multiple namespaces support for the functions.

Closes: #34

Signed-off-by: Vivek Singh vivekkmr45@yahoo.in

alexellis commented 4 years ago

How have you tested it?

viveksyngh commented 4 years ago

Yes I have tested it on local using tester helper.

go run cmd/tester/main.go
Handling connection for 8080
2019/09/25 14:02:53 Syncing topic map
2019/09/25 14:02:54 Invoke function: nodeinfo.fn
Handling connection for 8080
Handling connection for 8080
2019/09/25 14:02:54 Syncing topic map
2019/09/25 14:02:54 Invoke function: cows.openfaas-fn
2019/09/25 14:02:54 connector-sdk got result: [200] vm.powered.on => nodeinfo.fn (89) bytes
[200] vm.powered.on => nodeinfo.fn
Hostname: nodeinfo-6df94d649d-46cfl

Platform: linux
Arch: x64
CPU count: 4
Uptime: 9757

2019/09/25 14:02:54 tester got result: [200] vm.powered.on => nodeinfo.fn (89) bytes
2019/09/25 14:02:54 connector-sdk got result: [200] vm.powered.on => cows.openfaas-fn (105) bytes
[200] vm.powered.on => cows.openfaas-fn
          (__)
          (oo)
   /-------\/ 5+2=?
  / !     !!
 *  !!----!!
    ^^    ^^
cow who cow'nts

2019/09/25 14:02:54 tester got result: [200] vm.powered.on => cows.openfaas-fn (105) bytes
Handling connection for 8080
2019/09/25 14:02:55 Syncing topic map
Handling connection for 8080
2019/09/25 14:02:56 Syncing topic map
2019/09/25 14:02:56 Invoke function: nodeinfo.fn
Handling connection for 8080
2019/09/25 14:02:56 Invoke function: cows.openfaas-fn
2019/09/25 14:02:56 connector-sdk got result: [200] vm.powered.on => nodeinfo.fn (89) bytes
[200] vm.powered.on => nodeinfo.fn
Hostname: nodeinfo-6df94d649d-46cfl

Platform: linux
Arch: x64
CPU count: 4
Uptime: 9760

2019/09/25 14:02:56 tester got result: [200] vm.powered.on => nodeinfo.fn (89) bytes
2019/09/25 14:02:57 connector-sdk got result: [200] vm.powered.on => cows.openfaas-fn (134) bytes
[200] vm.powered.on => cows.openfaas-fn
               (__)
(__)           (oo)
(oo)      ______\/
-\/    /|      |
| |   * |______|
| |        ||
---        --
Cow Computer

2019/09/25 14:02:57 tester got result: [200] vm.powered.on => cows.openfaas-fn (134) bytes
Handling connection for 8080
2019/09/25 14:02:57 Syncing topic map
Handling connection for 8080
2019/09/25 14:02:58 Syncing topic map
2019/09/25 14:02:59 Invoke function: nodeinfo.fn
Handling connection for 8080
2019/09/25 14:02:59 Invoke function: cows.openfaas-fn
2019/09/25 14:02:59 connector-sdk got result: [200] vm.powered.on => nodeinfo.fn (89) bytes
[200] vm.powered.on => nodeinfo.fn
Hostname: nodeinfo-6df94d649d-46cfl

Platform: linux
Arch: x64
CPU count: 4
Uptime: 9762

2019/09/25 14:02:59 tester got result: [200] vm.powered.on => nodeinfo.fn (89) bytes
2019/09/25 14:02:59 connector-sdk got result: [200] vm.powered.on => cows.openfaas-fn (283) bytes
[200] vm.powered.on => cows.openfaas-fn
   ___________________________
| |                (__)       \
| |                (oo)        |
| |         /-------\/          \____
| |        / |     ||            ____)   Cow'ndom
| |       *  ||----||           /
| |          ~~    ~~          |
| |___________________________/

2019/09/25 14:02:59 tester got result: [200] vm.powered.on => cows.openfaas-fn (283) bytes
Handling connection for 8080
2019/09/25 14:02:59 Syncing topic map
Handling connection for 8080
2019/09/25 14:03:00 Syncing topic map
2019/09/25 14:03:01 Invoke function: nodeinfo.fn
Handling connection for 8080
2019/09/25 14:03:01 Invoke function: cows.openfaas-fn
2019/09/25 14:03:01 connector-sdk got result: [200] vm.powered.on => nodeinfo.fn (89) bytes
[200] vm.powered.on => nodeinfo.fn
Hostname: nodeinfo-6df94d649d-46cfl

Platform: linux
Arch: x64
CPU count: 4
Uptime: 9764

2019/09/25 14:03:01 tester got result: [200] vm.powered.on => nodeinfo.fn (89) bytes
2019/09/25 14:03:01 connector-sdk got result: [200] vm.powered.on => cows.openfaas-fn (91) bytes
[200] vm.powered.on => cows.openfaas-fn
         (__)
         (oo)
   __[_]__\/
 / |     ||
*  ||----||
   ^^    ^^
 Portable Cow

2019/09/25 14:03:01 tester got result: [200] vm.powered.on => cows.openfaas-fn (91) bytes
Handling connection for 8080
2019/09/25 14:03:01 Syncing topic map
alexellis commented 4 years ago

Thank you. Is it still WIP, or ready to merge/test?

viveksyngh commented 4 years ago

This is almost ready and tested but I have not added unit test for this. Will add unit test and push it.

Thanks @alexellis @martindekov

viveksyngh commented 4 years ago

I have added unit test and updated the existing unit tests.

alexellis commented 4 years ago

@martindekov WDYT?

martindekov commented 4 years ago

Thanks for the added unit tests @viveksyngh, @alexellis I think the implementation is good, I will vendor the change in the kafka-connector and possibly the vcenter-connector and try to test them also :+1:

alexellis commented 4 years ago

Thank you 👍 there is a new release ready.

alexellis commented 4 years ago

@embano1