serverless / serverless-openwhisk

Adds Apache OpenWhisk support to the Serverless Framework!
http://openwhisk.org/
MIT License
143 stars 47 forks source link

Use packages to implement "services"? #29

Open jthomas opened 7 years ago

jthomas commented 7 years ago

The Serverless Framework uses the concept of services to logically group serverless functions running on the serverless platform.

On AWS, this corresponds to a separate cloudformation template and service definition for each service.

OpenWhisk has a different model (packages) for managing related serverless resources (actions, triggers, rules).

The current provider implementation uses service and stage identifiers within the resource name to group resources for a service. It does not deploy these resources into a custom package.

This leads to a large number of resources being deployed under the root namespace package. I can see this being challenging as the number of services grows.

One option would be to use the service identifer as a package identifier for each deployment. This would also make it easier to check which resources were deployed for a service.

mbehrendt commented 7 years ago

sounds very reasonable to me.

From a user experience PoV we just have to make sure it's clear to users that then they'll have to invoke actions with a pkg prefix, so they don't get confused

jthomas commented 7 years ago

OpenWhisk does not currently support triggers and rules being located within package. https://github.com/openwhisk/openwhisk/issues/1825

I'm going to put this in the backlog until there's a resolution on whether this will be possible in future.

cjelger commented 7 years ago

Actually it's already possible to deploy actions into an existing package by simply specifying a function name like package-name/function-name. But it would be nice to be able to deploy the service as a package and automatically assign functions to packages without having to always add the package prefix to the function name. However it would be nice to have some parameters to switch these features off, and also have the possibility to add parameters and bindings. Something like:

service: my-package
  parameters:
    name: value
  bindings:
    - another-package
  deploy: true | false (false by default?)
functions:
  my-function:
    name: my-function
    add-to-package: true | false (= service.deploy by default?)

(by the way, the actions listed in serverless info do not include any package in their name even if an action is deployed in a package, so this should also be fixed).

allen-servedio commented 6 years ago

@jthomas - am I correct that there is not currently a way to create a package using serverless deploy? I can see via #87 that you can add an action to an existing package, but I am not seeing a way to create that package in the first place through serverless. It appears that it has to already exist...

jthomas commented 6 years ago

@allen-servedio I've just tested this and you're correct - it does not support this. It shouldn't be too dificcult to add. I'll open an issue to look at this.

jthomas commented 6 years ago

https://github.com/serverless/serverless-openwhisk/issues/95