Add example for builder podspec (#1374)

This commit is contained in:
Vivek Singh
2019-11-04 16:02:30 +08:00
committed by Ta-Ching Chen
parent d1ed089c3e
commit e4f44ffa63
12 changed files with 98 additions and 0 deletions
@@ -0,0 +1,11 @@
This is the root directory of a declaratively specified fission "application". The app
contains source code for one function (a simple "hello world") in the hello/hello.py
file.
The `specs` directory contains YAML files that specify the Fission environment and
function.
You can create this app on your cluster by running `fission spec apply` from this
directory. See `fission spec --help` for other options.
After applying the spec, you can test the function with `fission fn test --name hello`.
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
set -e
# check syntax
python3 -m compileall -l ${SRC_PKG}
# install deps
pip3 install -r ${SRC_PKG}/requirements.txt -t ${SRC_PKG} && cp -r ${SRC_PKG} ${DEPLOY_PKG}
@@ -0,0 +1,4 @@
import yaml
def main():
return "hello, world!!\n"
@@ -0,0 +1 @@
pyyaml
@@ -0,0 +1,12 @@
apiVersion: fission.io/v1
kind: Environment
metadata:
name: python-27
namespace: default
spec:
version: 2
builder:
command: build
image: fission/python-builder
runtime:
image: fission/python-env
@@ -0,0 +1,3 @@
kind: DeploymentConfig
name: spec-example
uid: 27438a48-4191-4b5e-95b2-7793624317b9
@@ -0,0 +1,38 @@
apiVersion: fission.io/v1
kind: Function
metadata:
name: hello
namespace: default
spec:
environment:
name: python-27
namespace: default
package:
packageref:
name: hello-pkg
namespace: default
functionName: hello.main
---
apiVersion: fission.io/v1
kind: Package
metadata:
name: hello-pkg
namespace: default
spec:
source:
url: archive://hello-archive
buildcmd: "./build.sh"
environment:
name: python-27
namespace: default
status:
buildstatus: pending
---
kind: ArchiveUploadSpec
name: hello-archive
include:
- "hello/*.py"
- "hello/*.sh"
- "hello/requirements.txt"