Skip to content

Commit cd57692

Browse files
authored
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>
1 parent 57e1236 commit cd57692

35 files changed

+5924
-238
lines changed

.dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/faas
1+
/function

.github/workflows/ci.yaml

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ jobs:
2929
- name: Lint
3030
run: make check
3131
- name: Permissions
32-
run: chmod a+x faas_*amd*
32+
run: chmod a+x function_*amd*
3333

3434
# Upload all build artifacts whether it's a release or not
3535
- uses: actions/upload-artifact@v2
3636
with:
3737
name: OSX Binary
38-
path: faas_darwin_amd64
38+
path: function_darwin_amd64
3939
- uses: actions/upload-artifact@v2
4040
with:
4141
name: Linux Binary
42-
path: faas_linux_amd64
42+
path: function_linux_amd64
4343
- uses: actions/upload-artifact@v2
4444
with:
4545
name: Windows Binary
46-
path: faas_windows_amd64.exe
46+
path: function_windows_amd64.exe
4747

4848
# Build and push a latest image with each commit
4949
- name: Image
@@ -59,7 +59,7 @@ jobs:
5959
# The following steps are only executed if this is a release
6060
- name: Compress Binaries
6161
if: ${{ steps.release.outputs.release_created }}
62-
run: gzip faas_darwin_amd64 faas_linux_amd64 faas_windows_amd64.exe
62+
run: gzip function_darwin_amd64 function_linux_amd64 function_windows_amd64.exe
6363

6464
# Upload all binaries
6565
- name: Upload Darwin Binary
@@ -69,8 +69,8 @@ jobs:
6969
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7070
with:
7171
upload_url: ${{ steps.release.outputs.upload_url }}
72-
asset_path: ./faas_darwin_amd64.gz
73-
asset_name: faas_darwin_amd64.gz
72+
asset_path: ./function_darwin_amd64.gz
73+
asset_name: function_darwin_amd64.gz
7474
asset_content_type: application/x-gzip
7575
- name: Upload Linux Binary
7676
uses: actions/upload-release-asset@v1
@@ -79,8 +79,8 @@ jobs:
7979
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8080
with:
8181
upload_url: ${{ steps.release.outputs.upload_url }}
82-
asset_path: ./faas_linux_amd64.gz
83-
asset_name: faas_linux_amd64.gz
82+
asset_path: ./functionlinux_amd64.gz
83+
asset_name: function_linux_amd64.gz
8484
asset_content_type: application/x-gzip
8585
- name: Upload Windows Binary
8686
uses: actions/upload-release-asset@v1
@@ -89,6 +89,6 @@ jobs:
8989
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9090
with:
9191
upload_url: ${{ steps.release.outputs.upload_url }}
92-
asset_path: ./faas_windows_amd64.exe.gz
93-
asset_name: faas_windows_amd64.exe.gz
92+
asset_path: ./function_windows_amd64.exe.gz
93+
asset_name: function_windows_amd64.exe.gz
9494
asset_content_type: application/x-gzip

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/faas
2-
/faas_*
1+
/function
2+
/function_*
33
/templates/go/events/go.sum
44
/templates/go/http/go.sum
55
/coverage.out

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ RUN make
66

77
FROM alpine:latest
88
RUN apk add --no-cache ca-certificates
9-
COPY --from=build /src/faas /bin/
10-
ENTRYPOINT ["faas"]
9+
COPY --from=build /src/function /bin/
10+
ENTRYPOINT ["function"]

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
REPO := quay.io/boson/faas
2-
BIN := faas
1+
REPO := quay.io/boson/function
2+
BIN := function
33

44
DARWIN=$(BIN)_darwin_amd64
55
LINUX=$(BIN)_linux_amd64

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# faas
1+
# Boson Function CLI
22

33
[![Main Build Status](https://github.com/boson-project/faas/workflows/Main/badge.svg?branch=main)](https://github.com/boson-project/faas/actions?query=workflow%3AMain+branch%3Amain)
44
[![Develop Build Status](https://github.com/boson-project/faas/workflows/Develop/badge.svg?branch=develop&label=develop)](https://github.com/boson-project/faas/actions?query=workflow%3ADevelop+branch%3Adevelop)
@@ -9,7 +9,7 @@
99

1010
[Demo Screencast]
1111

12-
faas is a "Function as a Service" Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
12+
`function` is a Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
1313

1414
[Read the Documentation](docs/README.md)
1515

client_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ func TestDefaultTrigger(t *testing.T) {
161161
// using a custom path to a template repository on disk. Custom repository
162162
// location is not defined herein but expected to be provided because, for
163163
// example, a CLI may want to use XDG_CONFIG_HOME. Assuming a repository path
164-
// $FAAS_TEMPLATES, a Go template named 'json' which is provided in the
164+
// $FUNCTIONTEMPLATES, a Go template named 'json' which is provided in the
165165
// repository 'boson-experimental', would be expected to be in the location:
166-
// $FAAS_TEMPLATES/boson-experimental/go/json
166+
// $FUNCTION_TEMPLATES/boson-experimental/go/json
167167
// See the CLI for full details, but a standard default location is
168168
// $HOME/.config/templates/boson-experimental/go/json
169169
func TestExtensibleTemplates(t *testing.T) {

cmd/build.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import (
1414
func init() {
1515
root.AddCommand(buildCmd)
1616
buildCmd.Flags().StringP("builder", "b", "default", "Buildpacks builder")
17-
buildCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
18-
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")
19-
buildCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FAAS_PATH")
20-
buildCmd.Flags().StringP("registry", "r", "", "Registry for built images, ex 'docker.io/myuser' or just 'myuser'. Optional if --image provided. - $FAAS_REGISTRY")
17+
buildCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
18+
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")
19+
buildCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FUNCTION_PATH")
20+
buildCmd.Flags().StringP("registry", "r", "", "Registry for built images, ex 'docker.io/myuser' or just 'myuser'. Optional if --image provided. - $FUNCTION_REGISTRY")
2121

2222
err := buildCmd.RegisterFlagCompletionFunc("builder", CompleteBuilderList)
2323
if err != nil {
@@ -31,12 +31,12 @@ var buildCmd = &cobra.Command{
3131
Long: `Build an existing Function project as an OCI image
3232
3333
Builds the Function project in the current directory or in the directory
34-
specified by the --path flag. The faas.yaml file is read to determine the
34+
specified by the --path flag. The func.yaml file is read to determine the
3535
image name and registry. If both of these values are unset in the
3636
configuration file the --registry or -r flag should be provided and an image
3737
name will be derived from the project name.
3838
39-
Any value provided for the --image flag will be persisted in the faas.yaml
39+
Any value provided for the --image flag will be persisted in the func.yaml
4040
configuration file. On subsequent invocations of the "build" command
4141
these values will be read from the configuration file.
4242

cmd/completion.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ var completionCmd = &cobra.Command{
1818
Long: `To load completion run
1919
2020
For zsh:
21-
source <(faas completion zsh)
21+
source <(function completion zsh)
2222
2323
If you would like to use alias:
24-
alias f=faas
25-
compdef _faas f
24+
alias f=function
25+
compdef _function f
2626
2727
For bash:
28-
source <(faas completion bash)
28+
source <(function completion bash)
2929
3030
`,
3131
ValidArgs: []string{"bash", "zsh", "fish"},

cmd/create.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import (
1313

1414
func init() {
1515
root.AddCommand(createCmd)
16-
createCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
17-
createCmd.Flags().StringP("runtime", "l", faas.DefaultRuntime, "Function runtime language/framework. Default runtime is 'node'. Available runtimes: 'node', 'quarkus' and 'go'. - $FAAS_RUNTIME")
18-
createCmd.Flags().StringP("templates", "", filepath.Join(configPath(), "templates"), "Extensible templates path. - $FAAS_TEMPLATES")
19-
createCmd.Flags().StringP("trigger", "t", faas.DefaultTrigger, "Function trigger. Default trigger is 'http'. Available triggers: 'http' and 'events' - $FAAS_TRIGGER")
16+
createCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FFUNCTION_CONFIRM")
17+
createCmd.Flags().StringP("runtime", "l", faas.DefaultRuntime, "Function runtime language/framework. Default runtime is 'node'. Available runtimes: 'node', 'quarkus' and 'go'. - $FUNCTION_RUNTIME")
18+
createCmd.Flags().StringP("templates", "", filepath.Join(configPath(), "templates"), "Extensible templates path. - $FUNCTION_TEMPLATES")
19+
createCmd.Flags().StringP("trigger", "t", faas.DefaultTrigger, "Function trigger. Default trigger is 'http'. Available triggers: 'http' and 'events' - $FUNCTION_TRIGGER")
2020

2121
if err := createCmd.RegisterFlagCompletionFunc("runtime", CompleteRuntimeList); err != nil {
2222
fmt.Println("Error while calling RegisterFlagCompletionFunc: ", err)

cmd/delete.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313

1414
func init() {
1515
root.AddCommand(deleteCmd)
16-
deleteCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
17-
deleteCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be deleted - $FAAS_PATH")
16+
deleteCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
17+
deleteCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be deleted - $FUNCTION_PATH")
1818
deleteCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FAAS_NAMESPACE")
1919
}
2020

@@ -25,13 +25,13 @@ var deleteCmd = &cobra.Command{
2525
2626
Removes a deployed function from the cluster. The user may specify a function
2727
by name, path using the --path or -p flag, or if neither of those are provided,
28-
the current directory will be searched for a faas.yaml configuration file to
28+
the current directory will be searched for a func.yaml configuration file to
2929
determine the function to be removed.
3030
31-
The namespace defaults to the value in faas.yaml or the namespace currently
31+
The namespace defaults to the value in func.yaml or the namespace currently
3232
active in the user's Kubernetes configuration. The namespace may be specified
3333
on the command line using the --namespace or -n flag, and if so this will
34-
overwrite the value in faas.yaml.
34+
overwrite the value in func.yaml.
3535
`,
3636
SuggestFor: []string{"remove", "rm", "del"},
3737
ValidArgsFunction: CompleteFunctionList,

cmd/deploy.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import (
1515

1616
func init() {
1717
root.AddCommand(deployCmd)
18-
deployCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
18+
deployCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
1919
deployCmd.Flags().StringArrayP("env", "e", []string{}, "Sets environment variables for the Function.")
20-
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")
21-
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")
22-
deployCmd.Flags().StringP("path", "p", cwd(), "Path to the function project directory - $FAAS_PATH")
23-
deployCmd.Flags().StringP("registry", "r", "", "Image registry for built images, ex 'docker.io/myuser' or just 'myuser'. - $FAAS_REGISTRY")
20+
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")
21+
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")
22+
deployCmd.Flags().StringP("path", "p", cwd(), "Path to the function project directory - $FUNCTION_PATH")
23+
deployCmd.Flags().StringP("registry", "r", "", "Image registry for built images, ex 'docker.io/myuser' or just 'myuser'. - $FUNCTION_REGISTRY")
2424
}
2525

2626
var deployCmd = &cobra.Command{
@@ -30,18 +30,18 @@ var deployCmd = &cobra.Command{
3030
3131
Builds and Deploys the Function project in the current directory.
3232
A path to the project directory may be provided using the --path or -p flag.
33-
Reads the faas.yaml configuration file to determine the image name.
33+
Reads the func.yaml configuration file to determine the image name.
3434
An image and registry may be specified on the command line using
3535
the --image or -i and --registry or -r flag.
3636
3737
If the Function is already deployed, it is updated with a new container image
3838
that is pushed to an image registry, and the Knative Service is updated.
3939
4040
The namespace into which the project is deployed defaults to the value in the
41-
faas.yaml configuration file. If NAMESPACE is not set in the configuration,
41+
func.yaml configuration file. If NAMESPACE is not set in the configuration,
4242
the namespace currently active in the Kubernetes configuration file will be
4343
used. The namespace may be specified on the command line using the --namespace
44-
or -n flag, and if so this will overwrite the value in the faas.yaml file.
44+
or -n flag, and if so this will overwrite the value in the func.yaml file.
4545
4646
4747
`,

cmd/describe.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import (
1717

1818
func init() {
1919
root.AddCommand(describeCmd)
20-
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")
21-
describeCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FAAS_FORMAT")
22-
describeCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be described - $FAAS_PATH")
20+
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")
21+
describeCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNCTION_FORMAT")
22+
describeCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be described - $FUNCTION_PATH")
2323

2424
err := describeCmd.RegisterFlagCompletionFunc("format", CompleteOutputFormatList)
2525
if err != nil {
@@ -36,9 +36,9 @@ Prints the name, route and any event subscriptions for a deployed Function in
3636
the current directory. A path to a Function project directory may be supplied
3737
using the --path or -p flag.
3838
39-
The namespace defaults to the value in faas.yaml or the namespace currently
39+
The namespace defaults to the value in func.yaml or the namespace currently
4040
active in the user's Kubernetes configuration. The namespace may be specified
41-
using the --namespace or -n flag, and if so this will overwrite the value in faas.yaml.
41+
using the --namespace or -n flag, and if so this will overwrite the value in func.yaml.
4242
`,
4343
SuggestFor: []string{"desc", "get"},
4444
ValidArgsFunction: CompleteFunctionList,
File renamed without changes.

cmd/list.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818

1919
func init() {
2020
root.AddCommand(listCmd)
21-
listCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FAAS_NAMESPACE")
22-
listCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FAAS_FORMAT")
21+
listCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FUNCTION_NAMESPACE")
22+
listCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNCTION_FORMAT")
2323

2424
err := listCmd.RegisterFlagCompletionFunc("format", CompleteOutputFormatList)
2525
if err != nil {
@@ -32,10 +32,10 @@ var listCmd = &cobra.Command{
3232
Short: "Lists deployed Functions",
3333
Long: `Lists deployed Functions
3434
35-
Lists all deployed functions. The namespace defaults to the value in faas.yaml
35+
Lists all deployed functions. The namespace defaults to the value in func.yaml
3636
or the namespace currently active in the user's Kubernetes configuration. The
3737
namespace may be specified on the command line using the --namespace or -n flag.
38-
If specified this will overwrite the value in faas.yaml.
38+
If specified this will overwrite the value in func.yaml.
3939
`,
4040
SuggestFor: []string{"ls", "lsit"},
4141
PreRunE: bindEnv("namespace", "format"),

cmd/root.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ import (
1717
// available flags, etc. It has no action of its own, such that running the
1818
// resultant binary with no arguments prints the help/usage text.
1919
var root = &cobra.Command{
20-
Use: "faas",
21-
Short: "Function as a Service",
20+
Use: "function",
21+
Short: "Manage function projects",
2222
SilenceErrors: true, // we explicitly handle errors in Execute()
2323
SilenceUsage: true, // no usage dump on error
24-
Long: `Function as a Service
24+
Long: `Manage function projects.
2525
26-
Create and run Functions as a Service.`,
26+
Create, build and deploy functions as Knative Services.`,
2727
}
2828

2929
// NewRootCmd is used to initialize faas as kn plugin
@@ -53,8 +53,8 @@ func init() {
5353
// version subcommand: nothing but the version.
5454
root.SetVersionTemplate(`{{printf "%s\n" .Version}}`)
5555

56-
// Prefix all environment variables with "FAAS_" to avoid collisions with other apps.
57-
viper.SetEnvPrefix("faas")
56+
// Prefix all environment variables with "FUNCTION_" to avoid collisions with other apps.
57+
viper.SetEnvPrefix("function")
5858
}
5959

6060
// Execute the command tree by executing the root command, which runs
@@ -97,15 +97,15 @@ func cwd() (cwd string) {
9797
// function defaults and extensible templates.
9898
func configPath() (path string) {
9999
if path = os.Getenv("XDG_CONFIG_HOME"); path != "" {
100-
path = filepath.Join(path, "faas")
100+
path = filepath.Join(path, "function")
101101
return
102102
}
103103
home, err := homedir.Expand("~")
104104
if err != nil {
105105
fmt.Fprintf(os.Stderr, "could not derive home directory for use as default templates path: %v", err)
106-
path = filepath.Join(".config", "faas")
106+
path = filepath.Join(".config", "function")
107107
} else {
108-
path = filepath.Join(home, ".config", "faas")
108+
path = filepath.Join(home, ".config", "function")
109109
}
110110
return
111111
}
@@ -217,7 +217,7 @@ func deriveNameAndAbsolutePathFromPath(path string) (string, string) {
217217
// will be prepended.
218218
//
219219
// If the image flag is provided, this value is used directly (the user supplied
220-
// --image or $FAAS_IMAGE). Otherwise, the Function at 'path' is loaded, and
220+
// --image or $FUNCTION_IMAGE). Otherwise, the Function at 'path' is loaded, and
221221
// the Image name therein is used (i.e. it was previously calculated).
222222
// Finally, the default registry is used, which is prepended to the Function
223223
// name, and appended with ':latest':

cmd/run.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func init() {
1414
// Add the run command as a subcommand of root.
1515
root.AddCommand(runCmd)
1616
runCmd.Flags().StringArrayP("env", "e", []string{}, "Sets environment variables for the Function.")
17-
runCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FAAS_PATH")
17+
runCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FUNCTION_PATH")
1818
}
1919

2020
var runCmd = &cobra.Command{

config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
// ConfigFile is the name of the config's serialized form.
12-
const ConfigFile = "faas.yaml"
12+
const ConfigFile = "func.yaml"
1313

1414
// Config represents the serialized state of a Function's metadata.
1515
// See the Function struct for attribute documentation.

docs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# FAAS Documentation
1+
# Function Documentation
22

33
[Demo Screencast]
44

5-
`faas` is a "Function as a Service" Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
5+
`function` is a Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
66

77
For examples of what's possible, see the [Screencast Series](getting_started_screencast.md) or the [Functions Cookbook](functions_cookbook.md).
88

0 commit comments

Comments
 (0)