$ go get github.com/jwendell/fnkube
# Runs the perl image and prints π with 100 places
$ fnkube -image perl -- perl "-Mbignum=bpi" -wle "print bpi(100)"
3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068
Run fnkube -help
for more options and examples.
What fnkube
does it really simple: It just spawns a Kubernetes Job that runs the specified image in a container and grabs its output. After that it deletes the Job
and pods
created for this task, unless it's told to not do this (-cleanup=false
option).
All you need is a kubernetes (or openshift) instance available and permissions to access it.
You can incorporate fnkube
into a bigger application just by importing "github.com/jwendell/fnkube/pkg/fnkube"
and calling the function fnkube.Run(options)
whereas options
is the struct fnkube.Options
. Take a look at how main.go uses it.