nats-connector

by Helm

Helm chartv0.3.2

Trigger OpenFaaS Functions from NATS Pub/Sub

About this chart

Trigger OpenFaaS Functions from NATS Pub/Sub

The OpenFaaS nats-connector invokes functions in response to events published on a NATS pub/sub subject.

Prerequisites

  • Install OpenFaaS

    You must have a working OpenFaaS installation. You can find instructions in the docs, including instructions to also install OpenFaaS via Helm.

Install the Chart

  • Add the OpenFaaS chart repo and deploy the nats-connector 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 nats-connector openfaas/nats-connector \
    --install \
    --namespace openfaas

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

Configuration

Additional nats-connector options in values.yaml.

ParameterDescriptionDefault
gateway_urlOpenFaaS gateway URLhttp://gateway.openfaas:8080
basic_authEnable basic auth for the gatewaytrue
upstream_timeoutMaximum timeout for upstream function call, must be a Go formatted duration string.30s
rebuild_intervalInterval for rebuilding function to topic map, must be a Go formatted duration string.5s
topicsTopics to which the connector will bind, provide as a comma-separated list.nats-test,
topic_delimiterDelimiter for topics list.,
gateway_urlThe URL for the API gateway.http://gateway:8080"
broker_hostlocation of the nats brokers.nats
print_responseOutput the response of calling a function in the logs.true
print_response_bodyOutput to the logs the response body when calling a function.false
fullnameOverrideOverride the name value used for the Connector Deployment object.``
resourcesResources requests and limits configurationrequests.memory: "64Mi"

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

Removing the nats-connector

All control plane components can be cleaned up with helm:

$ helm uninstall nats-connector

Deploy nats-connector with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has nats-connector 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 chartnats-connector is pinned at v0.3.2 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