Skip to content

kkurczewski/kubeless-jvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubeless-jvm

Jvm runtime for Kubeless based on Spark.

Prerequisite

  • kubeless installed

Kotlin script

Deploy

kubeless function deploy --runtime-image kurczews/kubeless-kotlin:1.0 --from-file Test.kts --handler Test.run --trigger-http hello-kotlin

Test.kts

import spark.Request

fun run(request: Request): String {
    if (request.requestMethod() == "GET") {
        return "Send me POST"
    }
    return request.body()
}

Execute

kubeless function call hello-kotlin

kubeless function call hello-kotlin --data '{"hello":"world"}'

Java class

Deploy

kubeless function deploy --runtime-image kurczews/kubeless-java:1.0 --from-file Test.java --handler Test.run --trigger-http hello-java

Test.java

import spark.Request;

public class Test {

    public String run(Request request) {
        if(request.requestMethod().equals("GET")) {
            return "Send me POST";
        }
        return request.body();
    }
}

Execute

kubeless function call hello-java

kubeless function call hello-java --data '{"hello":"world"}'

Releases

No releases published

Packages

No packages published