probuilder

by Helm

Helm chartv0.2.0

Build OpenFaaS functions via a REST API

About this chart

OpenFaaS Pro Function Builder Chart

Build OpenFaaS functions via a REST API

The pro-builder allows you to build functions from within your cluster using a REST API.

Prerequisites

  • Obtain a license or trial

    You will need a license for OpenFaaS Pro, contact us at: openfaas.com/support

  • Install OpenFaaS

    You must have a working OpenFaaS installed.

Pre-reqs

Create a registry push secret for the Pro Builder to use to push images to your registry. This can be generated through docker login.

kubectl create secret generic registry-secret \
    --from-file config.json=$HOME/.docker/config.json -n openfaas

Create a HMAC signing secret for use between the Pro Builder and your client:

PAYLOAD=$(head -c 32 /dev/urandom |shasum | cut -d ' ' -f 1)
kubectl create secret generic payload-secret \
  --from-file payload-secret=payload.txt -n openfaas

# Save a copy for later use
echo $PAYLOAD > payload.txt

Generate mTLS certificates for BuildKit and the Pro Builder which are used to encrypt messages between the builder component and buildkit.

docker run -v `pwd`/out:/tmp/ -ti ghcr.io/openfaas/certgen:0.1.0-rc2

# Reset the permissions of the files to your own user:
sudo chown -R $USER:$USER out

Then create two secrets, one for the BuildKit daemon and one for the builder component.

kubectl create secret generic -n openfaas \
  buildkit-daemon-certs \
  --from-file ./out/certs/ca.crt \
  --from-file ./out/certs/server.crt \
  --from-file ./out/certs/server.key

kubectl create secret generic -n openfaas \
  buildkit-client-certs \
  --from-file ./out/certs/ca.crt \
  --from-file ./out/certs/client.crt \
  --from-file ./out/certs/client.key

Install the Chart

  • Create the required secret with your OpenFaaS Pro license code:
$ kubectl create secret generic \
    -n openfaas \
    openfaas-license \
    --from-file license=$HOME/.openfaas/LICENSE
  • Add the OpenFaaS chart repo and deploy the pro-builder Pro chart. We recommend installing it in the same namespace as the rest of OpenFaaS
$ helm repo add openfaas https://openfaas.github.io/faas-netes/
$ helm upgrade pro-builder openfaas/pro-builder \
    --install \
    --namespace openfaas

The above command will also update your helm repo to pull in any new releases.

Check the status of the Pro Builder with:

kubectl logs -n openfaas \
    deploy/pro-builder pro-builder

# Check events
kubectl get events -n openfaas

For end to end testing instructions, see: Docs: Function Builder

Configuration

Additional pro-builder options in values.yaml.

ParameterDescriptionDefault
imageContainer image to use for the pro-builderSee values.yaml

Specify each parameter using the --set key=value[,key=value] argument to helm install. See values.yaml for the default configuration.

Removing the pro-builder

All control plane components can be cleaned up with helm:

$ helm delete --purge pro-builder

Deploy probuilder with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has probuilder on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartprobuilder is pinned at v0.2.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply