OpenFunction CLI

Learn how to use the CLI of OpenFunction.

This document describes how to use the CLI of OpenFunction.

Overview

ofn is the command-line interface for OpenFunction. It helps you install and manage OpenFuntion.

The following table describes the main commands supported by ofn.

CommandDescription
initProvides management for the framework of OpenFunction.
installInstalls OpenFunction and its dependencies.
uninstallUninstalls OpenFunction and its dependencies.
createCreates a function from a file or stdin.
applyApplies a function from a file or stdin.
demoCreates a kind cluster to install OpenFunction and run its demo.
getPrints a table of the most important information about the specified function.
get builderPrints important information about the Builder.
get servingPrints important information about the Serving.
deleteDeletes the specified function.

Use ofn to Install and Uninstall OpenFunction

  1. Run the following command to download ofn.

    1. wget -c https://github.com/OpenFunction/cli/releases/latest/download/ofn_linux_amd64.tar.gz -O - | tar -xz
  2. Run un the following commands to make ofn executable and move it to /usr/local/bin/.

    1. chmod +x ofn && mv ofn /usr/local/bin/

    Note

    If you download ofn from the release page, make sure you put ofn in the correct directory.

  3. Run the following command to install OpenFunction.

    1. ofn install --all
  4. Run the following command to uninstall OpenFunction and its dependencies.

    1. ofn uninstall --all

    Note

    You can also remove the --all parameter to just uninstall OpenFunction.

ofn install Parameters

The following table describes parameters available for the ofn install command.

ParameterDescription
–allFor installing all dependencies.
–asyncFor installing OpenFunction Async runtime (Dapr & KEDA).
–cert-managerFor installing Cert Manager.
–daprFor installing Dapr.
–dry-runFor previewing the components and their versions to be installed.
–ingressFor installing Ingress Nginx.
–kedaFor installing KEDA.
–knativeFor installing Knative Serving (with Kourier as the default gateway).
–region-cnFor users who have limited access to gcr.io or github.com. If you add this parameter in the ofn install command, you have to add it again in the ofn uninstall command.
–shipwrightFor installing Shipwright.
–syncFor installing OpenFunction Sync runtime (to be supported).
–upgradeFor upgrading components to target versions during installation.
–yesFor automatically passing yes to prompts. (-y for short)
–verboseFor displaying detailed information.
–version < version number>For specifying any stable version or the latest version of OpenFunction for installation. (default “v0.4.0”) If not specified, the latest stable version will be installed.
–timeout < duration >For specifying the timeout duration, which defaults to 5 minutes.

ofn uninstall Parameters

The following table describes parameters available for the ofn uninstall command.

ParameterDescription
–allFor uninstalling all dependencies.
–asyncFor uninstalling OpenFunction Async runtime (Dapr & KEDA).
–cert-managerFor uninstalling Cert Manager.
–daprFor uninstalling Dapr.
–dry-runFor previewing the components and their versions to be uninstalled.
–ingressFor uninstalling Ingress Nginx.
–kedaFor uninstalling KEDA.
–knativeFor uninstalling Knative Serving (with Kourier as the default gateway).
–region-cnFor users who have limited access to gcr.io or github.com. If you add this parameter in the ofn install command, you have to add it again in the ofn uninstall command.
–shipwrightFor uninstalling Shipwright.
–syncFor uninstalling OpenFunction Sync runtime (to be supported).
–verboseFor displaying detailed information.
–yesFor automatically passing yes to prompts. (-y for short)
–version < version number>For specifying any stable version or the latest version of OpenFunction to be uninstalled. If not specified, the currently installed version will be uninstalled.
–waitFor awaiting the results of the uninstallation until namespaces are cleaned up.
–timeout < duration >For specifying the timeout duration, which defaults to 5 minutes.

Inventory

During installation, the OpenFunction CLI keeps the installed component details in $home/.ofn/<cluster name>-inventory.yaml. Therefore, during uninstallation, the OpenFunction CLI removes the installed components based on the contents of $home/.ofn/<cluster name>-inventory.yaml.

In addition, the OpenFunction CLI supports obtaining component versions and paths to the component YAML files from environment variables.

ofn demo Parameters

The following table describes parameters available for the ofn demo command.

ParameterDescription
–auto-pruneFor removing the demo kind cluster. To keep the demo kind cluster, run ofn demo —auto-prune=false, and you can delete the demo kind cluster by running kind delete cluster —name openfunction.
–verboseFor displaying detailed information.
–region-cnFor users who have limited access to gcr.io or github.com.