Jvm runtime for Kubeless based on Spark.
- kubeless installed
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()
}
kubeless function call hello-kotlin
kubeless function call hello-kotlin --data '{"hello":"world"}'
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();
}
}
kubeless function call hello-java
kubeless function call hello-java --data '{"hello":"world"}'