serverless-openwhisk icon indicating copy to clipboard operation
serverless-openwhisk copied to clipboard

Use packages to implement "services"?

Open jthomas opened this issue 7 years ago • 6 comments

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.

jthomas avatar Feb 03 '17 13:02 jthomas

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

mbehrendt avatar Feb 03 '17 13:02 mbehrendt

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.

jthomas avatar Feb 08 '17 12:02 jthomas

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).

cjelger avatar Apr 11 '17 11:04 cjelger

@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...

allen-servedio avatar Feb 08 '18 14:02 allen-servedio

@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 avatar Feb 08 '18 16:02 jthomas

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

jthomas avatar Feb 08 '18 16:02 jthomas