Skip to content

boson-attic/kfn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kfn

POC of a FaaS build tool to create knative services starting from functions

Building

Look at https://github.com/containers/buildah/blob/master/install.md for dep dependency installation

make build

Install

make install

Example

Try to deploy example-fn.js

./kfn run fn.js

Kfn image

To build the image, run:

make image

To run kfn image (assuming in your workdir you have a directory mycontainer and the function in the directory fn):

podman run --net=host --security-opt label=disable --security-opt seccomp=unconfined --privileged --device /dev/fuse:rw -v $(pwd)/mycontainer:/var/lib/containers:Z -v "./fn:/home" kfn --verbose run /home/example-fn.js

Commands available

  • kfn init: Init a function in the working directory
  • kfn clean [function] or kfn clean --global: Clean target directory of specified function or all .kfn directory
  • kfn edit [function] [editor]: Edit the function with the specified editor
  • kfn build: Build the specified function and push to the specified registry
  • kfn run: Build, push and run the specified function

Functions documentation

Dependencies

To add dependencies, add a comment:

// kfn:dependency primal 0.2.3

Kfn will add the dependency in the specific build manifest

Rust

Requirements

For Rust, you'll need musl libc and the corresponding target for rustc. This target is required to static link the libc, reducing the effective image size to just the required libraries.

You can install the target with rustup:

rustup target add x86_64-unknown-linux-musl

Build profile

To speedup during the development the cargo profile from release to debug, add this comment in your function:

// kfn:build-dev true

Compilation cache

If you want to speedup the compilation across various functions, you can use sccache. To enable it when you compile your functions, add the comment:

// kfn:build-env RUSTC_WRAPPER=sccache

About

Kfn: A POC cli to investigate FaaS UX on KNative

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages