Skip to content

Latest commit

 

History

History
98 lines (59 loc) · 3.42 KB

CONTRIBUTING.md

File metadata and controls

98 lines (59 loc) · 3.42 KB

Contributing

This project follows the contributing guide for OpenFaaS.

The project-level contributing guide contains instructions specifically relating to faas-netes.

Update the version

Helm

Any changes to the helm chart will also need a corresponding change in the Chart.yml file to bump up the version.

  • How to generate new charts

    This step should only be run by a maintainer, and not by contributors because it causes merge conflicts which are hard to unpick.

    This currently requires helm3 to be in your PATH. The arkade tool can download helm, if you need it via arkade get helm.

    Run: make charts

  • Plain YAML files

    The plain YAML files are generated by make charts, this includes ARMHF/ARM64.

  • Picking a version

    For version updates please review the Semantic Versioning guidelines.

ARM builds

ARM builds are provided on a best effort basis by OpenFaaS Ltd. If you need an updated ARM build or have run into an issue, then please contact the project team via Slack or by creating an Issue.

Local development of faas-netes

A Makefile and a series of scripts automates the creation of a local Kubernetes cluster with OpenFaaS preinstalled. Kubernetes in Docker (KinD) is used to create a single-node cluster and install the latest version of OpenFaaS via the Helm chart.

make start-kind

This environment has two goals:

  1. match the environment we use in CI for integration tests and validating the Helm chart. We use the same scripts in CI to setup and test function deployments in faas-netes.
  2. as much as is possible, enable completely offline and cost-free development, i.e. Airplane mode. If you have the latest base images for Go, you should not require an internet connection.

You can use OF_DEV_ENV to set a custom name for the cluster. The default value is kind.

Load a custom image into the KinD cluster

As you are developing on faas-netes, you will want to build and test your own local images. This can easily be done using the following commands

export KUBECONFIG="$(kind get kubeconfig-path --name="${OF_DEV_ENV:-kind}")"

make build

kind load docker-image --name="${OF_DEV_ENV:-kind}" openfaas/faas-netes:latest

helm upgrade openfaas --install openfaas/openfaas \
    --namespace openfaas  \
    --set basic_auth=true \
    --set openfaasImagePullPolicy=IfNotPresent \
    --set faasnetes.imagePullPolicy=IfNotPresent \
    --set faasnetes.image=openfaas/faas-netes:latest \
    --set functionNamespace=openfaas-fn

Note that this technique can also be used to test locally built functions, thus avoiding the need to push the image to a remote registry.

Port Forwarding

This command will port-forward the OpenFaaS Gateway to your local port 31112.

You can stop the forwarding with:

kill $(<"of_${OF_DEV_ENV:-kind}_portforward.pid")

To manually restart the port-forward, use:

kubectl port-forward deploy/gateway -n openfaas 31112:8080 &>/dev/null & echo -n "$!" > "of_${OF_DEV_ENV:-kind}_portforward.pid"

For simplicity, a restart script is provided in contrib

./contrib/restart_port_forward.sh

Tear down your local KinD cluster

Or stop the entire environment and cleanup using

make stop-kind