Scripts for a couple of simple fission demos

This commit is contained in:
Soam Vasani
2017-08-16 15:18:31 -07:00
parent 00a8430a24
commit b5e3e4e625
9 changed files with 244 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
fission fn delete --name hello
fission route delete --name $(fission route list|grep hello|cut -f1 -d' ')
+7
View File
@@ -0,0 +1,7 @@
module.exports = async function(context) {
return {
status: 200,
body: "Hello, world!\n"
};
}
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
DEMO_RUN_FAST=1
ROOT_DIR=$(dirname $0)/..
. $ROOT_DIR/util.sh
desc "Kubernetes cluster"
run "kubectl get nodes"
desc "Fission installed"
run "kubectl --namespace fission get deployment"
clear
desc "Hello world function"
run "cat hello.js"
desc "Add NodeJS environment to fission"
run "fission env create --name nodejs --image fission/node-env"
desc "NodeJS environment pods"
run "kubectl --namespace fission-function get pod -l environmentName=nodejs"
desc "Upload a function to fission"
run "fission function create --name hello --env nodejs --code hello.js"
desc "Set up a route \(HTTP trigger\) for the function"
run "fission route create --method GET --url /hello --function hello"
sleep 2
desc "Finally, run the function"
run "time -p curl http://$FISSION_ROUTER/hello"
desc "Run the function again"
run "time -p curl http://$FISSION_ROUTER/hello"
run "time -p curl http://$FISSION_ROUTER/hello"
desc "The pod is now labeled by the function name"
run "kubectl --namespace fission-function get pod -l functionName=hello"