serverless / serverless-kubeless

This plugin enables support for Kubeless within the Serverless Framework.
Apache License 2.0
303 stars 80 forks source link

Add support for memory limit and env vars #46

Closed andresmgot closed 7 years ago

andresmgot commented 7 years ago

This PR enable users to specify a memory limit and environment variables on its functions.

The memory limit can be set per service or per function. Environment variables are function specific.

Issue ref: #33

It depends on https://github.com/kubeless/kubeless/pull/217 so for testing this PR is necessary to build kubeless from master.

For a serverless.yaml:

service: hello

provider:
  name: google
  runtime: python2.7

plugins:
  - serverless-kubeless

functions:
  hello:
    handler: handler.hello
    environment:
      TEST: 1
    memorySize: 128Mi

it deploys a function:

spec:
  deps:
  function: |
    def hello():
        return "hello world"
  handler: handler.hello
  runtime: python2.7
  template:
    spec:
      containers:
      - env:
        - name: TEST
          value: "1"
        name: hello
        resources:
          limits:
            memory: 128Mi
          requests:
            memory: 128Mi
  type: HTTP
sebgoa commented 7 years ago

I don' think this was pushed in npm registry ? 0.1.8 does not seem to be able to do this.

andresmgot commented 7 years ago

Indeed, published 0.1.9