serverless / serverless-kubeless

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

Is possible use serverless-kubeless with java ? #153

Open klebermagno opened 6 years ago

klebermagno commented 6 years ago

Kubeless work with java. I create a project with Serverless-kubeless with java

service: func

provider:
  name: kubeless
  runtime: java

plugins:
  - serverless-kubeless

functions:
  func:
    handler: com.example.FunctionApp

this error message:

Serverless: Packaging function: func...
Serverless: Excluding development dependencies...
Serverless: Redeploying func...
Serverless: Unable to find any running pod for func. Retrying...
Serverless: Unable to find any running pod for func. Retrying...
Serverless: Unable to find any running pod for func. Retrying...
Serverless: Unable to find any running pod for func. Retrying...
Serverless: Giving up, unable to retrieve the status of the func deployment.

Is possible use serverless-kubeless with java ?

andresmgot commented 6 years ago

It should be possible. I see a couple of issues with your serverless.yaml.

First you need to setup the version of java: runtime: java1.8.

Then you need to set the filename and the class name as the handler. For example for the file Foo.java with this content:

▶ cat Foo.java
package io.kubeless;

import io.kubeless.Event;
import io.kubeless.Context;

public class Foo {
    public String bar(io.kubeless.Event event, io.kubeless.Context context) {
        return "Hello world!";
    }
}

You will need to set the handler handler: Foo.bar.