mirror of https://github.com/knative/func.git
feat!: rename faas to function (#210)
* rename faas to function Signed-off-by: Zbynek Roubalik <zroubali@redhat.com> * function.yaml -> func.yaml Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
This commit is contained in:
parent
57e12362af
commit
cd57692c9d
|
@ -1 +1 @@
|
|||
/faas
|
||||
/function
|
||||
|
|
|
@ -29,21 +29,21 @@ jobs:
|
|||
- name: Lint
|
||||
run: make check
|
||||
- name: Permissions
|
||||
run: chmod a+x faas_*amd*
|
||||
run: chmod a+x function_*amd*
|
||||
|
||||
# Upload all build artifacts whether it's a release or not
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: OSX Binary
|
||||
path: faas_darwin_amd64
|
||||
path: function_darwin_amd64
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Linux Binary
|
||||
path: faas_linux_amd64
|
||||
path: function_linux_amd64
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Windows Binary
|
||||
path: faas_windows_amd64.exe
|
||||
path: function_windows_amd64.exe
|
||||
|
||||
# Build and push a latest image with each commit
|
||||
- name: Image
|
||||
|
@ -59,7 +59,7 @@ jobs:
|
|||
# The following steps are only executed if this is a release
|
||||
- name: Compress Binaries
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
run: gzip faas_darwin_amd64 faas_linux_amd64 faas_windows_amd64.exe
|
||||
run: gzip function_darwin_amd64 function_linux_amd64 function_windows_amd64.exe
|
||||
|
||||
# Upload all binaries
|
||||
- name: Upload Darwin Binary
|
||||
|
@ -69,8 +69,8 @@ jobs:
|
|||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||
asset_path: ./faas_darwin_amd64.gz
|
||||
asset_name: faas_darwin_amd64.gz
|
||||
asset_path: ./function_darwin_amd64.gz
|
||||
asset_name: function_darwin_amd64.gz
|
||||
asset_content_type: application/x-gzip
|
||||
- name: Upload Linux Binary
|
||||
uses: actions/upload-release-asset@v1
|
||||
|
@ -79,8 +79,8 @@ jobs:
|
|||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||
asset_path: ./faas_linux_amd64.gz
|
||||
asset_name: faas_linux_amd64.gz
|
||||
asset_path: ./functionlinux_amd64.gz
|
||||
asset_name: function_linux_amd64.gz
|
||||
asset_content_type: application/x-gzip
|
||||
- name: Upload Windows Binary
|
||||
uses: actions/upload-release-asset@v1
|
||||
|
@ -89,6 +89,6 @@ jobs:
|
|||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||
asset_path: ./faas_windows_amd64.exe.gz
|
||||
asset_name: faas_windows_amd64.exe.gz
|
||||
asset_path: ./function_windows_amd64.exe.gz
|
||||
asset_name: function_windows_amd64.exe.gz
|
||||
asset_content_type: application/x-gzip
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/faas
|
||||
/faas_*
|
||||
/function
|
||||
/function_*
|
||||
/templates/go/events/go.sum
|
||||
/templates/go/http/go.sum
|
||||
/coverage.out
|
||||
|
|
|
@ -6,5 +6,5 @@ RUN make
|
|||
|
||||
FROM alpine:latest
|
||||
RUN apk add --no-cache ca-certificates
|
||||
COPY --from=build /src/faas /bin/
|
||||
ENTRYPOINT ["faas"]
|
||||
COPY --from=build /src/function /bin/
|
||||
ENTRYPOINT ["function"]
|
||||
|
|
4
Makefile
4
Makefile
|
@ -1,5 +1,5 @@
|
|||
REPO := quay.io/boson/faas
|
||||
BIN := faas
|
||||
REPO := quay.io/boson/function
|
||||
BIN := function
|
||||
|
||||
DARWIN=$(BIN)_darwin_amd64
|
||||
LINUX=$(BIN)_linux_amd64
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# faas
|
||||
# Boson Function CLI
|
||||
|
||||
[](https://github.com/boson-project/faas/actions?query=workflow%3AMain+branch%3Amain)
|
||||
[](https://github.com/boson-project/faas/actions?query=workflow%3ADevelop+branch%3Adevelop)
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
[Demo Screencast]
|
||||
|
||||
faas is a "Function as a Service" Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
|
||||
`function` is a Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
|
||||
|
||||
[Read the Documentation](docs/README.md)
|
||||
|
||||
|
|
|
@ -161,9 +161,9 @@ func TestDefaultTrigger(t *testing.T) {
|
|||
// using a custom path to a template repository on disk. Custom repository
|
||||
// location is not defined herein but expected to be provided because, for
|
||||
// example, a CLI may want to use XDG_CONFIG_HOME. Assuming a repository path
|
||||
// $FAAS_TEMPLATES, a Go template named 'json' which is provided in the
|
||||
// $FUNCTIONTEMPLATES, a Go template named 'json' which is provided in the
|
||||
// repository 'boson-experimental', would be expected to be in the location:
|
||||
// $FAAS_TEMPLATES/boson-experimental/go/json
|
||||
// $FUNCTION_TEMPLATES/boson-experimental/go/json
|
||||
// See the CLI for full details, but a standard default location is
|
||||
// $HOME/.config/templates/boson-experimental/go/json
|
||||
func TestExtensibleTemplates(t *testing.T) {
|
||||
|
|
12
cmd/build.go
12
cmd/build.go
|
@ -14,10 +14,10 @@ import (
|
|||
func init() {
|
||||
root.AddCommand(buildCmd)
|
||||
buildCmd.Flags().StringP("builder", "b", "default", "Buildpacks builder")
|
||||
buildCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
|
||||
buildCmd.Flags().StringP("image", "i", "", "Optional full image name, in form [registry]/[namespace]/[name]:[tag] for example quay.io/myrepo/project.name:latest (overrides --registry) - $FAAS_IMAGE")
|
||||
buildCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FAAS_PATH")
|
||||
buildCmd.Flags().StringP("registry", "r", "", "Registry for built images, ex 'docker.io/myuser' or just 'myuser'. Optional if --image provided. - $FAAS_REGISTRY")
|
||||
buildCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
|
||||
buildCmd.Flags().StringP("image", "i", "", "Optional full image name, in form [registry]/[namespace]/[name]:[tag] for example quay.io/myrepo/project.name:latest (overrides --registry) - $FUNCTION_IMAGE")
|
||||
buildCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FUNCTION_PATH")
|
||||
buildCmd.Flags().StringP("registry", "r", "", "Registry for built images, ex 'docker.io/myuser' or just 'myuser'. Optional if --image provided. - $FUNCTION_REGISTRY")
|
||||
|
||||
err := buildCmd.RegisterFlagCompletionFunc("builder", CompleteBuilderList)
|
||||
if err != nil {
|
||||
|
@ -31,12 +31,12 @@ var buildCmd = &cobra.Command{
|
|||
Long: `Build an existing Function project as an OCI image
|
||||
|
||||
Builds the Function project in the current directory or in the directory
|
||||
specified by the --path flag. The faas.yaml file is read to determine the
|
||||
specified by the --path flag. The func.yaml file is read to determine the
|
||||
image name and registry. If both of these values are unset in the
|
||||
configuration file the --registry or -r flag should be provided and an image
|
||||
name will be derived from the project name.
|
||||
|
||||
Any value provided for the --image flag will be persisted in the faas.yaml
|
||||
Any value provided for the --image flag will be persisted in the func.yaml
|
||||
configuration file. On subsequent invocations of the "build" command
|
||||
these values will be read from the configuration file.
|
||||
|
||||
|
|
|
@ -18,14 +18,14 @@ var completionCmd = &cobra.Command{
|
|||
Long: `To load completion run
|
||||
|
||||
For zsh:
|
||||
source <(faas completion zsh)
|
||||
source <(function completion zsh)
|
||||
|
||||
If you would like to use alias:
|
||||
alias f=faas
|
||||
compdef _faas f
|
||||
alias f=function
|
||||
compdef _function f
|
||||
|
||||
For bash:
|
||||
source <(faas completion bash)
|
||||
source <(function completion bash)
|
||||
|
||||
`,
|
||||
ValidArgs: []string{"bash", "zsh", "fish"},
|
||||
|
|
|
@ -13,10 +13,10 @@ import (
|
|||
|
||||
func init() {
|
||||
root.AddCommand(createCmd)
|
||||
createCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
|
||||
createCmd.Flags().StringP("runtime", "l", faas.DefaultRuntime, "Function runtime language/framework. Default runtime is 'node'. Available runtimes: 'node', 'quarkus' and 'go'. - $FAAS_RUNTIME")
|
||||
createCmd.Flags().StringP("templates", "", filepath.Join(configPath(), "templates"), "Extensible templates path. - $FAAS_TEMPLATES")
|
||||
createCmd.Flags().StringP("trigger", "t", faas.DefaultTrigger, "Function trigger. Default trigger is 'http'. Available triggers: 'http' and 'events' - $FAAS_TRIGGER")
|
||||
createCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FFUNCTION_CONFIRM")
|
||||
createCmd.Flags().StringP("runtime", "l", faas.DefaultRuntime, "Function runtime language/framework. Default runtime is 'node'. Available runtimes: 'node', 'quarkus' and 'go'. - $FUNCTION_RUNTIME")
|
||||
createCmd.Flags().StringP("templates", "", filepath.Join(configPath(), "templates"), "Extensible templates path. - $FUNCTION_TEMPLATES")
|
||||
createCmd.Flags().StringP("trigger", "t", faas.DefaultTrigger, "Function trigger. Default trigger is 'http'. Available triggers: 'http' and 'events' - $FUNCTION_TRIGGER")
|
||||
|
||||
if err := createCmd.RegisterFlagCompletionFunc("runtime", CompleteRuntimeList); err != nil {
|
||||
fmt.Println("Error while calling RegisterFlagCompletionFunc: ", err)
|
||||
|
|
|
@ -13,8 +13,8 @@ import (
|
|||
|
||||
func init() {
|
||||
root.AddCommand(deleteCmd)
|
||||
deleteCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
|
||||
deleteCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be deleted - $FAAS_PATH")
|
||||
deleteCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
|
||||
deleteCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be deleted - $FUNCTION_PATH")
|
||||
deleteCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FAAS_NAMESPACE")
|
||||
}
|
||||
|
||||
|
@ -25,13 +25,13 @@ var deleteCmd = &cobra.Command{
|
|||
|
||||
Removes a deployed function from the cluster. The user may specify a function
|
||||
by name, path using the --path or -p flag, or if neither of those are provided,
|
||||
the current directory will be searched for a faas.yaml configuration file to
|
||||
the current directory will be searched for a func.yaml configuration file to
|
||||
determine the function to be removed.
|
||||
|
||||
The namespace defaults to the value in faas.yaml or the namespace currently
|
||||
The namespace defaults to the value in func.yaml or the namespace currently
|
||||
active in the user's Kubernetes configuration. The namespace may be specified
|
||||
on the command line using the --namespace or -n flag, and if so this will
|
||||
overwrite the value in faas.yaml.
|
||||
overwrite the value in func.yaml.
|
||||
`,
|
||||
SuggestFor: []string{"remove", "rm", "del"},
|
||||
ValidArgsFunction: CompleteFunctionList,
|
||||
|
|
|
@ -15,12 +15,12 @@ import (
|
|||
|
||||
func init() {
|
||||
root.AddCommand(deployCmd)
|
||||
deployCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
|
||||
deployCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
|
||||
deployCmd.Flags().StringArrayP("env", "e", []string{}, "Sets environment variables for the Function.")
|
||||
deployCmd.Flags().StringP("image", "i", "", "Optional full image name, in form [registry]/[namespace]/[name]:[tag] for example quay.io/myrepo/project.name:latest (overrides --registry) - $FAAS_IMAGE")
|
||||
deployCmd.Flags().StringP("namespace", "n", "", "Override namespace into which the Function is deployed (on supported platforms). Default is to use currently active underlying platform setting - $FAAS_NAMESPACE")
|
||||
deployCmd.Flags().StringP("path", "p", cwd(), "Path to the function project directory - $FAAS_PATH")
|
||||
deployCmd.Flags().StringP("registry", "r", "", "Image registry for built images, ex 'docker.io/myuser' or just 'myuser'. - $FAAS_REGISTRY")
|
||||
deployCmd.Flags().StringP("image", "i", "", "Optional full image name, in form [registry]/[namespace]/[name]:[tag] for example quay.io/myrepo/project.name:latest (overrides --registry) - $FUNCTION_IMAGE")
|
||||
deployCmd.Flags().StringP("namespace", "n", "", "Override namespace into which the Function is deployed (on supported platforms). Default is to use currently active underlying platform setting - $FUNCTION_NAMESPACE")
|
||||
deployCmd.Flags().StringP("path", "p", cwd(), "Path to the function project directory - $FUNCTION_PATH")
|
||||
deployCmd.Flags().StringP("registry", "r", "", "Image registry for built images, ex 'docker.io/myuser' or just 'myuser'. - $FUNCTION_REGISTRY")
|
||||
}
|
||||
|
||||
var deployCmd = &cobra.Command{
|
||||
|
@ -30,7 +30,7 @@ var deployCmd = &cobra.Command{
|
|||
|
||||
Builds and Deploys the Function project in the current directory.
|
||||
A path to the project directory may be provided using the --path or -p flag.
|
||||
Reads the faas.yaml configuration file to determine the image name.
|
||||
Reads the func.yaml configuration file to determine the image name.
|
||||
An image and registry may be specified on the command line using
|
||||
the --image or -i and --registry or -r flag.
|
||||
|
||||
|
@ -38,10 +38,10 @@ If the Function is already deployed, it is updated with a new container image
|
|||
that is pushed to an image registry, and the Knative Service is updated.
|
||||
|
||||
The namespace into which the project is deployed defaults to the value in the
|
||||
faas.yaml configuration file. If NAMESPACE is not set in the configuration,
|
||||
func.yaml configuration file. If NAMESPACE is not set in the configuration,
|
||||
the namespace currently active in the Kubernetes configuration file will be
|
||||
used. The namespace may be specified on the command line using the --namespace
|
||||
or -n flag, and if so this will overwrite the value in the faas.yaml file.
|
||||
or -n flag, and if so this will overwrite the value in the func.yaml file.
|
||||
|
||||
|
||||
`,
|
||||
|
|
|
@ -17,9 +17,9 @@ import (
|
|||
|
||||
func init() {
|
||||
root.AddCommand(describeCmd)
|
||||
describeCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for the Function. Default is to use currently active underlying platform setting - $FAAS_NAMESPACE")
|
||||
describeCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FAAS_FORMAT")
|
||||
describeCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be described - $FAAS_PATH")
|
||||
describeCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for the Function. Default is to use currently active underlying platform setting - $FUNCTION_NAMESPACE")
|
||||
describeCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNCTION_FORMAT")
|
||||
describeCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be described - $FUNCTION_PATH")
|
||||
|
||||
err := describeCmd.RegisterFlagCompletionFunc("format", CompleteOutputFormatList)
|
||||
if err != nil {
|
||||
|
@ -36,9 +36,9 @@ Prints the name, route and any event subscriptions for a deployed Function in
|
|||
the current directory. A path to a Function project directory may be supplied
|
||||
using the --path or -p flag.
|
||||
|
||||
The namespace defaults to the value in faas.yaml or the namespace currently
|
||||
The namespace defaults to the value in func.yaml or the namespace currently
|
||||
active in the user's Kubernetes configuration. The namespace may be specified
|
||||
using the --namespace or -n flag, and if so this will overwrite the value in faas.yaml.
|
||||
using the --namespace or -n flag, and if so this will overwrite the value in func.yaml.
|
||||
`,
|
||||
SuggestFor: []string{"desc", "get"},
|
||||
ValidArgsFunction: CompleteFunctionList,
|
||||
|
|
|
@ -18,8 +18,8 @@ import (
|
|||
|
||||
func init() {
|
||||
root.AddCommand(listCmd)
|
||||
listCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FAAS_NAMESPACE")
|
||||
listCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FAAS_FORMAT")
|
||||
listCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FUNCTION_NAMESPACE")
|
||||
listCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNCTION_FORMAT")
|
||||
|
||||
err := listCmd.RegisterFlagCompletionFunc("format", CompleteOutputFormatList)
|
||||
if err != nil {
|
||||
|
@ -32,10 +32,10 @@ var listCmd = &cobra.Command{
|
|||
Short: "Lists deployed Functions",
|
||||
Long: `Lists deployed Functions
|
||||
|
||||
Lists all deployed functions. The namespace defaults to the value in faas.yaml
|
||||
Lists all deployed functions. The namespace defaults to the value in func.yaml
|
||||
or the namespace currently active in the user's Kubernetes configuration. The
|
||||
namespace may be specified on the command line using the --namespace or -n flag.
|
||||
If specified this will overwrite the value in faas.yaml.
|
||||
If specified this will overwrite the value in func.yaml.
|
||||
`,
|
||||
SuggestFor: []string{"ls", "lsit"},
|
||||
PreRunE: bindEnv("namespace", "format"),
|
||||
|
|
20
cmd/root.go
20
cmd/root.go
|
@ -17,13 +17,13 @@ import (
|
|||
// available flags, etc. It has no action of its own, such that running the
|
||||
// resultant binary with no arguments prints the help/usage text.
|
||||
var root = &cobra.Command{
|
||||
Use: "faas",
|
||||
Short: "Function as a Service",
|
||||
Use: "function",
|
||||
Short: "Manage function projects",
|
||||
SilenceErrors: true, // we explicitly handle errors in Execute()
|
||||
SilenceUsage: true, // no usage dump on error
|
||||
Long: `Function as a Service
|
||||
Long: `Manage function projects.
|
||||
|
||||
Create and run Functions as a Service.`,
|
||||
Create, build and deploy functions as Knative Services.`,
|
||||
}
|
||||
|
||||
// NewRootCmd is used to initialize faas as kn plugin
|
||||
|
@ -53,8 +53,8 @@ func init() {
|
|||
// version subcommand: nothing but the version.
|
||||
root.SetVersionTemplate(`{{printf "%s\n" .Version}}`)
|
||||
|
||||
// Prefix all environment variables with "FAAS_" to avoid collisions with other apps.
|
||||
viper.SetEnvPrefix("faas")
|
||||
// Prefix all environment variables with "FUNCTION_" to avoid collisions with other apps.
|
||||
viper.SetEnvPrefix("function")
|
||||
}
|
||||
|
||||
// Execute the command tree by executing the root command, which runs
|
||||
|
@ -97,15 +97,15 @@ func cwd() (cwd string) {
|
|||
// function defaults and extensible templates.
|
||||
func configPath() (path string) {
|
||||
if path = os.Getenv("XDG_CONFIG_HOME"); path != "" {
|
||||
path = filepath.Join(path, "faas")
|
||||
path = filepath.Join(path, "function")
|
||||
return
|
||||
}
|
||||
home, err := homedir.Expand("~")
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "could not derive home directory for use as default templates path: %v", err)
|
||||
path = filepath.Join(".config", "faas")
|
||||
path = filepath.Join(".config", "function")
|
||||
} else {
|
||||
path = filepath.Join(home, ".config", "faas")
|
||||
path = filepath.Join(home, ".config", "function")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ func deriveNameAndAbsolutePathFromPath(path string) (string, string) {
|
|||
// will be prepended.
|
||||
//
|
||||
// If the image flag is provided, this value is used directly (the user supplied
|
||||
// --image or $FAAS_IMAGE). Otherwise, the Function at 'path' is loaded, and
|
||||
// --image or $FUNCTION_IMAGE). Otherwise, the Function at 'path' is loaded, and
|
||||
// the Image name therein is used (i.e. it was previously calculated).
|
||||
// Finally, the default registry is used, which is prepended to the Function
|
||||
// name, and appended with ':latest':
|
||||
|
|
|
@ -14,7 +14,7 @@ func init() {
|
|||
// Add the run command as a subcommand of root.
|
||||
root.AddCommand(runCmd)
|
||||
runCmd.Flags().StringArrayP("env", "e", []string{}, "Sets environment variables for the Function.")
|
||||
runCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FAAS_PATH")
|
||||
runCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FUNCTION_PATH")
|
||||
}
|
||||
|
||||
var runCmd = &cobra.Command{
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
// ConfigFile is the name of the config's serialized form.
|
||||
const ConfigFile = "faas.yaml"
|
||||
const ConfigFile = "func.yaml"
|
||||
|
||||
// Config represents the serialized state of a Function's metadata.
|
||||
// See the Function struct for attribute documentation.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# FAAS Documentation
|
||||
# Function Documentation
|
||||
|
||||
[Demo Screencast]
|
||||
|
||||
`faas` is a "Function as a Service" Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
|
||||
`function` is a Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
|
||||
|
||||
For examples of what's possible, see the [Screencast Series](getting_started_screencast.md) or the [Functions Cookbook](functions_cookbook.md).
|
||||
|
||||
|
|
|
@ -7,116 +7,116 @@ Creates a new Function project at _`path`_. If _`path`_ is unspecified, assumes
|
|||
Similar `kn` command: none.
|
||||
|
||||
```console
|
||||
faas create <path> [-l <runtime> -t <trigger>]
|
||||
function create <path> [-l <runtime> -t <trigger>]
|
||||
```
|
||||
|
||||
When run as a `kn` plugin.
|
||||
|
||||
```console
|
||||
kn faas create <path> [-l <runtime> -t <trigger>]
|
||||
kn function create <path> [-l <runtime> -t <trigger>]
|
||||
```
|
||||
|
||||
## `build`
|
||||
|
||||
Builds the Function project in the current directory. Reads the `faas.yaml` file to determine image name and registry. If both of these values are unset in the configuration file, the user is prompted to provide a registry, from there an image name can be derived. The image name and registry may also be specified as flags, as can the path to the project.
|
||||
Builds the Function project in the current directory. Reads the `func.yaml` file to determine image name and registry. If both of these values are unset in the configuration file, the user is prompted to provide a registry, from there an image name can be derived. The image name and registry may also be specified as flags, as can the path to the project.
|
||||
|
||||
The value(s) provided for image and registry are persisted to the `faas.yaml` file so that subsequent invocations do not require the user to specify these again.
|
||||
The value(s) provided for image and registry are persisted to the `func.yaml` file so that subsequent invocations do not require the user to specify these again.
|
||||
|
||||
Similar `kn` command: none.
|
||||
|
||||
```console
|
||||
faas build [-i <image> -r <registry> -p <path>]
|
||||
function build [-i <image> -r <registry> -p <path>]
|
||||
```
|
||||
|
||||
When run as a `kn` plugin.
|
||||
|
||||
```console
|
||||
kn faas build [-i <image> -r <registry> -p <path>]
|
||||
kn function build [-i <image> -r <registry> -p <path>]
|
||||
```
|
||||
|
||||
## `run`
|
||||
|
||||
Runs the Function project locally in the container. If a container has not yet been created, prompts the user to run `faas build`. The user may specify a path to the project directory using the `--path` or `-p` flag.
|
||||
Runs the Function project locally in the container. If a container has not yet been created, prompts the user to run `function build`. The user may specify a path to the project directory using the `--path` or `-p` flag.
|
||||
|
||||
Similar `kn` command: none.
|
||||
|
||||
```console
|
||||
faas run
|
||||
function run
|
||||
```
|
||||
|
||||
When run as a `kn` plugin.
|
||||
|
||||
```console
|
||||
kn faas run [-p <path>]
|
||||
kn function run [-p <path>]
|
||||
```
|
||||
|
||||
## `deploy`
|
||||
|
||||
Builds and deploys the Function project in the current directory. The user may specify a path to the project directory using the `--path` or `-p` flag. Reads the `faas.yaml` configuration file to determine the image name. An image and registry may be specified on the command line using the `--image` or `-i` and `--registry` or `-r` flag.
|
||||
Builds and deploys the Function project in the current directory. The user may specify a path to the project directory using the `--path` or `-p` flag. Reads the `func.yaml` configuration file to determine the image name. An image and registry may be specified on the command line using the `--image` or `-i` and `--registry` or `-r` flag.
|
||||
|
||||
Derives the service name from the project name. There is no mechanism by which the user can specify the service name. The user must have already initialized the function using `faas create` or they will encounter an error.
|
||||
Derives the service name from the project name. There is no mechanism by which the user can specify the service name. The user must have already initialized the function using `function create` or they will encounter an error.
|
||||
|
||||
If the Function is already deployed, it is updated with a new container image that is pushed to a
|
||||
container image registry, and the Knative Service is updated.
|
||||
|
||||
The namespace into which the project is deployed defaults to the value in the `faas.yaml` configuration file. If `NAMESPACE` is not set in the configuration, the namespace currently active in the Kubernetes configuration file will be used. The namespace may be specified on the command line using the `--namespace` or `-n` flag, and if so this will overwrite the value in the `faas.yaml` file.
|
||||
The namespace into which the project is deployed defaults to the value in the `func.yaml` configuration file. If `NAMESPACE` is not set in the configuration, the namespace currently active in the Kubernetes configuration file will be used. The namespace may be specified on the command line using the `--namespace` or `-n` flag, and if so this will overwrite the value in the `func.yaml` file.
|
||||
|
||||
Similar `kn` command: `kn service create NAME --image IMAGE [flags]`. This command allows a user to deploy a Knative Service by specifying an image, typically one hosted on a public container registry such as docker.io. The deployment options which the `kn` command affords the user are quite broad. The `kn` command in this case is quite effective for a power user. The `faas deploy` command has a similar end result, but is definitely easier for a user just getting started to be successful with.
|
||||
Similar `kn` command: `kn service create NAME --image IMAGE [flags]`. This command allows a user to deploy a Knative Service by specifying an image, typically one hosted on a public container registry such as docker.io. The deployment options which the `kn` command affords the user are quite broad. The `kn` command in this case is quite effective for a power user. The `function deploy` command has a similar end result, but is definitely easier for a user just getting started to be successful with.
|
||||
|
||||
```console
|
||||
faas deploy [-n <namespace> -p <path> -i <image> -r <registry>]
|
||||
function deploy [-n <namespace> -p <path> -i <image> -r <registry>]
|
||||
```
|
||||
|
||||
When run as a `kn` plugin.
|
||||
|
||||
```console
|
||||
kn faas deploy [-n <namespace> -p <path> -i <image> -r <registry>]
|
||||
kn function deploy [-n <namespace> -p <path> -i <image> -r <registry>]
|
||||
```
|
||||
|
||||
## `describe`
|
||||
|
||||
Prints the name, route and any event subscriptions for a deployed Function. The user may also specify the name of the function to describe. The namespace defaults to the value in `faas.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace may be specified on the command line, and if so this will overwrite the value in `faas.yaml`.
|
||||
Prints the name, route and any event subscriptions for a deployed Function. The user may also specify the name of the function to describe. The namespace defaults to the value in `func.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace may be specified on the command line, and if so this will overwrite the value in `func.yaml`.
|
||||
|
||||
Similar `kn` command: `kn service describe NAME [flags]`. This flag provides a lot of nice information not available in `faas describe`, such as revisions, age, annotations and labels. This command should be renamed to make it distinct from `kn` - e.g. `faas status`.
|
||||
Similar `kn` command: `kn service describe NAME [flags]`. This flag provides a lot of nice information not available in `function describe`, such as revisions, age, annotations and labels. This command should be renamed to make it distinct from `kn` - e.g. `function status`.
|
||||
|
||||
```console
|
||||
faas describe [-f <format> -n <namespace> -p <path>]
|
||||
function describe [-f <format> -n <namespace> -p <path>]
|
||||
```
|
||||
|
||||
When run as a `kn` plugin.
|
||||
|
||||
```console
|
||||
kn faas describe [-f <format> -n <namespace> -p <path>]
|
||||
kn function describe [-f <format> -n <namespace> -p <path>]
|
||||
```
|
||||
|
||||
## `list`
|
||||
|
||||
Lists all deployed functions. The namespace defaults to the value in `faas.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace defaults to the value in `faas.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace may be specified on the command line, and if so this will overwrite the value in `faas.yaml`.
|
||||
Lists all deployed functions. The namespace defaults to the value in `func.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace defaults to the value in `func.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace may be specified on the command line, and if so this will overwrite the value in `func.yaml`.
|
||||
|
||||
Similar `kn` command: `kn service list [name] [flags]`. This command lists all deployed Knative `Services`. As with other `kn` commands that have similar functionality, there is more information and flexibilty in the `kn` command. However, `kn` will return _all_ `Services`, while `faas list` will only display the boson Functions that have been deployed. Consider improving the output of the `faas list` command so that it is at least as informative as `kn service list`.
|
||||
Similar `kn` command: `kn service list [name] [flags]`. This command lists all deployed Knative `Services`. As with other `kn` commands that have similar functionality, there is more information and flexibilty in the `kn` command. However, `kn` will return _all_ `Services`, while `function list` will only display the boson Functions that have been deployed. Consider improving the output of the `function list` command so that it is at least as informative as `kn service list`.
|
||||
|
||||
```console
|
||||
faas list [-n <namespace> -p <path>]
|
||||
function list [-n <namespace> -p <path>]
|
||||
```
|
||||
|
||||
When run as a `kn` plugin.
|
||||
|
||||
```console
|
||||
kn faas list [-n <namespace> -p <path>]
|
||||
kn function list [-n <namespace> -p <path>]
|
||||
```
|
||||
|
||||
## `delete`
|
||||
|
||||
Removes a deployed function from the cluster. The user may specify a function by name, path or if neither of those are provided, the current directory will be searched for a `faas.yaml` configuration file to determine the function to be removed. The namespace defaults to the value in `faas.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace may be specified on the command line, and if so this will overwrite the value in `faas.yaml`.
|
||||
Removes a deployed function from the cluster. The user may specify a function by name, path or if neither of those are provided, the current directory will be searched for a `func.yaml` configuration file to determine the function to be removed. The namespace defaults to the value in `func.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace may be specified on the command line, and if so this will overwrite the value in `func.yaml`.
|
||||
|
||||
Similar `kn` command: `kn service delete NAME [flags]`.
|
||||
|
||||
```console
|
||||
faas delete <name> [-n namespace, -p path]
|
||||
function delete <name> [-n namespace, -p path]
|
||||
```
|
||||
|
||||
When run as a `kn` plugin.
|
||||
|
||||
```console
|
||||
kn faas delete <name> [-n namespace, -p path]
|
||||
kn function delete <name> [-n namespace, -p path]
|
||||
```
|
||||
|
|
|
@ -10,8 +10,8 @@ of a new function.
|
|||
It is recommended to set your preferred image registry for publishing Functions
|
||||
by setting the following environment variables:
|
||||
```
|
||||
export FAAS_REGISTRY=quay.io
|
||||
export FAAS_NAMESPACE=alice
|
||||
export FUNCTION_REGISTRY=quay.io
|
||||
export FUNCTION_NAMESPACE=alice
|
||||
```
|
||||
Alternately, when using the CLI these values can be provided using the --namespace and --registry
|
||||
flags.
|
||||
|
@ -23,7 +23,7 @@ flags.
|
|||
```shell
|
||||
> mkdir -p example.com/www
|
||||
> cd example.com/www
|
||||
> faas create go
|
||||
> function create go
|
||||
https://www.example.com
|
||||
> curl https://www.example.com
|
||||
OK
|
||||
|
|
|
@ -18,11 +18,11 @@ Once access to a kubernetes-compatible cluster has been established, it will nee
|
|||
|
||||
Create a namespace for your Functions:
|
||||
```
|
||||
kubectl create namespace faas
|
||||
kubectl create namespace function
|
||||
```
|
||||
Set the default namespace for subsequent commands:
|
||||
```
|
||||
kubectl config set-context --current --namespace=faas
|
||||
kubectl config set-context --current --namespace=function
|
||||
```
|
||||
|
||||
### Serving
|
||||
|
@ -39,7 +39,7 @@ Update the networking layer to
|
|||
- Use Kourier
|
||||
- use TLS
|
||||
- Redirect HTTP requests to HTTPS
|
||||
- Add faas subdomain annotations
|
||||
- Add function subdomain annotations
|
||||
```
|
||||
kubectl apply -f knative/config-network.yaml
|
||||
```
|
||||
|
@ -109,7 +109,7 @@ kubectl edit configmap config-certmanager --namespace knative-serving
|
|||
|
||||
### Eventing
|
||||
|
||||
Eventing with In-memory channels, a Channel broker, and enable the default broker in the faas namespace.
|
||||
Eventing with In-memory channels, a Channel broker, and enable the default broker in the function namespace.
|
||||
```
|
||||
kubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-crds.yaml
|
||||
kubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-core.yaml
|
||||
|
@ -122,9 +122,9 @@ kubectl apply --filename https://github.com/knative/eventing-contrib/releases/do
|
|||
```
|
||||
Learn more about the GitHub source at https://knative.dev/docs/eventing/samples/github-source/index.html
|
||||
|
||||
Enable Broker for faas namespace:
|
||||
Enable Broker for function namespace:
|
||||
```
|
||||
kubectl label namespace faas knative-eventing-injection=enabled
|
||||
kubectl label namespace function knative-eventing-injection=enabled
|
||||
```
|
||||
|
||||
### Monitoring
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
# Installing the CLI
|
||||
|
||||
The CLI can be used to invoke most features of the FaaS system. One can choose to run the container, install one of the pre-built binaries, or compile from source.
|
||||
The CLI can be used to invoke most features of the function system. One can choose to run the container, install one of the pre-built binaries, or compile from source.
|
||||
|
||||
### Container
|
||||
|
||||
The latest release can be run as a container:
|
||||
```
|
||||
docker run quay.io/boson/faas
|
||||
docker run quay.io/boson/function
|
||||
```
|
||||
To run a specific version of the CLI, use the version desired as the image tag:
|
||||
```
|
||||
docker run quay.io/boson/faas:v0.5.0
|
||||
docker run quay.io/boson/function:v0.9.0
|
||||
```
|
||||
|
||||
### Prebuilt Binary
|
||||
|
@ -25,6 +25,6 @@ Each version is built and made available as a prebuilt binary. See [All Release
|
|||
To build and install from source check out the repository, run `make`, and install the resultant binary:
|
||||
```
|
||||
make
|
||||
mv faas /usr/local/bin/
|
||||
mv function /usr/local/bin/
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Integrator's Guide
|
||||
|
||||
Developer's can integrate directly with the Function system using the client library upon which the `faas` CLI is based. Before beginning this section, you should have a configured provider and be familiar with the topics covered in the [developer's guide](docs/developers_guide.md).
|
||||
Developer's can integrate directly with the Function system using the client library upon which the `function` CLI is based. Before beginning this section, you should have a configured provider and be familiar with the topics covered in the [developer's guide](docs/developers_guide.md).
|
||||
|
||||
## Using the Client Library
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ data:
|
|||
# one entry per TLD+1. Example:
|
||||
boson-project.com: |
|
||||
selector:
|
||||
faas.domain: "boson-project.com"
|
||||
function.domain: "boson-project.com"
|
||||
boson-project.org: |
|
||||
selector:
|
||||
faas.domain: "boson-project.org"
|
||||
function.domain: "boson-project.org"
|
||||
# Default is local only.
|
||||
svc.cluster.local: ""
|
||||
|
|
|
@ -10,11 +10,11 @@ data:
|
|||
autoTLS: Enabled
|
||||
# Redirect HTTP requests to HTTPS
|
||||
httpProtocol: Redirected
|
||||
# If there exists an annotation `faas.subdomain` on the service,
|
||||
# If there exists an annotation `function.subdomain` on the service,
|
||||
# use it instead of the default name.namespace
|
||||
domainTemplate: |-
|
||||
{{if index .Annotations "faas.subdomain" -}}
|
||||
{{- index .Annotations "faas.subdomain" -}}
|
||||
{{if index .Annotations "function.subdomain" -}}
|
||||
{{- index .Annotations "function.subdomain" -}}
|
||||
{{else -}}
|
||||
{{- .Name}}.{{.Namespace -}}
|
||||
{{end -}}
|
||||
|
|
|
@ -13,7 +13,7 @@ func init() {
|
|||
type faasPlugin struct {}
|
||||
|
||||
func (f *faasPlugin) Name() string {
|
||||
return "kn-faas"
|
||||
return "kn-function"
|
||||
}
|
||||
|
||||
func (f *faasPlugin) Execute(args []string) error {
|
||||
|
@ -22,17 +22,17 @@ func (f *faasPlugin) Execute(args []string) error {
|
|||
defer (func() {
|
||||
os.Args = oldArgs
|
||||
})()
|
||||
os.Args = append([]string { "kn-faas" }, args...)
|
||||
os.Args = append([]string { "kn-function" }, args...)
|
||||
return rootCmd.Execute()
|
||||
}
|
||||
|
||||
// Description for faas subcommand visible in 'kn --help'
|
||||
// Description for function subcommand visible in 'kn --help'
|
||||
func (f *faasPlugin) Description() (string, error) {
|
||||
return "Function as a Service plugin", nil
|
||||
return "Function plugin", nil
|
||||
}
|
||||
|
||||
func (f *faasPlugin) CommandParts() []string {
|
||||
return []string{ "faas"}
|
||||
return []string{ "function"}
|
||||
}
|
||||
|
||||
// Path is empty because its an internal plugins
|
||||
|
|
|
@ -82,7 +82,7 @@ func copyFilesystem(templatesPath, runtime, templateFullName, dest string) error
|
|||
template := cc[1]
|
||||
|
||||
// Example FileSystem path:
|
||||
// /home/alice/.config/faas/templates/boson-experimental/go/json
|
||||
// /home/alice/.config/function/templates/boson-experimental/go/json
|
||||
src := filepath.Join(templatesPath, repo, runtime, template)
|
||||
return copy(src, dest, filesystemAccessor{})
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ Welcome to your new Go Function! The boilerplate function code can be found in [
|
|||
|
||||
Develop new features by adding a test to [`handle_test.go`](handle_test.go) for each feature, and confirm it works with `go test`.
|
||||
|
||||
Update the running analog of the funciton using the `faas` CLI or client library, and it can be invoked using a manually-created CloudEvent:
|
||||
Update the running analog of the funciton using the `function` CLI or client library, and it can be invoked using a manually-created CloudEvent:
|
||||
|
||||
```console
|
||||
curl -X POST -d '{"hello": "world"}' \
|
||||
|
|
|
@ -8,7 +8,7 @@ Welcome to your new Go Function! The boilerplate function code can be found in
|
|||
Develop new features by adding a test to [`handle_test.go`](handle_test.go) for
|
||||
each feature, and confirm it works with `go test`.
|
||||
|
||||
Update the running analog of the funciton using the `faas` CLI or client
|
||||
Update the running analog of the function using the `function` CLI or client
|
||||
library, and it can be invoked from your browser or from the command line:
|
||||
|
||||
```console
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -15,14 +15,14 @@ so debugger can be attached if needed.
|
|||
|
||||
To run test locally run `./mvnw test`.
|
||||
|
||||
## The `faas` CLI
|
||||
## The `function` CLI
|
||||
|
||||
It's recommended to set `FAAS_REGISTRY` environment variable.
|
||||
It's recommended to set `FUNCTION_REGISTRY` environment variable.
|
||||
```shell script
|
||||
# replace ~/.bashrc by your shell rc file
|
||||
# replace docker.io/johndoe with your registry
|
||||
export FAAS_REGISTRY=docker.io/johndoe
|
||||
echo "export FAAS_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
||||
export FUNCTION_REGISTRY=docker.io/johndoe
|
||||
echo "export FUNCTION_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
||||
```
|
||||
|
||||
### Building
|
||||
|
@ -30,8 +30,8 @@ echo "export FAAS_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
|||
This command builds OCI image for the function.
|
||||
|
||||
```shell script
|
||||
faas build # build jar
|
||||
faas build --builder native # build native binary
|
||||
function build # build jar
|
||||
function build --builder native # build native binary
|
||||
```
|
||||
|
||||
### Running
|
||||
|
@ -39,7 +39,7 @@ faas build --builder native # build native binary
|
|||
This command runs the function locally in a container
|
||||
using the image created above.
|
||||
```shell script
|
||||
faas run
|
||||
function run
|
||||
```
|
||||
|
||||
### Deploying
|
||||
|
@ -47,7 +47,7 @@ faas run
|
|||
This commands will build and deploy the function into cluster.
|
||||
|
||||
```shell script
|
||||
faas deploy # also triggers build
|
||||
function deploy # also triggers build
|
||||
```
|
||||
|
||||
## Function invocation
|
||||
|
@ -56,7 +56,7 @@ Do not forget to set `URL` variable to the route of your function.
|
|||
|
||||
You get the route by following command.
|
||||
```shell script
|
||||
faas describe
|
||||
function describe
|
||||
```
|
||||
|
||||
### cURL
|
||||
|
|
|
@ -15,14 +15,14 @@ so debugger can be attached if needed.
|
|||
|
||||
To run test locally run `./mvnw test`.
|
||||
|
||||
## The `faas` CLI
|
||||
## The `function` CLI
|
||||
|
||||
It's recommended to set `FAAS_REGISTRY` environment variable.
|
||||
It's recommended to set `FUNCTION_REGISTRY` environment variable.
|
||||
```shell script
|
||||
# replace ~/.bashrc by your shell rc file
|
||||
# replace docker.io/johndoe with your registry
|
||||
export FAAS_REGISTRY=docker.io/johndoe
|
||||
echo "export FAAS_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
||||
export FUNCTION_REGISTRY=docker.io/johndoe
|
||||
echo "export FUNCTION_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
||||
```
|
||||
|
||||
### Building
|
||||
|
@ -30,8 +30,8 @@ echo "export FAAS_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
|||
This command builds OCI image for the function.
|
||||
|
||||
```shell script
|
||||
faas build # build jar
|
||||
faas build --builder native # build native binary
|
||||
function build # build jar
|
||||
function build --builder native # build native binary
|
||||
```
|
||||
|
||||
### Running
|
||||
|
@ -39,7 +39,7 @@ faas build --builder native # build native binary
|
|||
This command runs the function locally in a container
|
||||
using the image created above.
|
||||
```shell script
|
||||
faas run
|
||||
function run
|
||||
```
|
||||
|
||||
### Deploying
|
||||
|
@ -47,7 +47,7 @@ faas run
|
|||
This commands will build and deploy the function into cluster.
|
||||
|
||||
```shell script
|
||||
faas deploy # also triggers build
|
||||
function deploy # also triggers build
|
||||
```
|
||||
|
||||
## Function invocation
|
||||
|
@ -56,7 +56,7 @@ Do not forget to set `URL` variable to the route of your function.
|
|||
|
||||
You get the route by following command.
|
||||
```shell script
|
||||
faas describe
|
||||
function describe
|
||||
```
|
||||
|
||||
### cURL
|
||||
|
|
Loading…
Reference in New Issue