You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: Update help messages and adding examples. (#218)
* chore: Update help messages and adding examples.
This commit introduces fixes for the top-level help message as described in #187.
It does not address:
* #216 - Use `kn function` in help message when run as a plugin to kn
* #215 - Group main help message to put important commands to the top
* #214 - Make examples in usage message parameterizable
buildCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNC_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) - $FUNC_IMAGE")
19
-
buildCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FUNC_PATH")
20
-
buildCmd.Flags().StringP("registry", "r", "", "Registry for built images, ex 'docker.io/myuser' or just 'myuser'. Optional if --image provided. - $FUNC_REGISTRY")
16
+
buildCmd.Flags().StringP("builder", "b", "default", "Buildpack builder, either an as a an image name or a mapping name as defined in func.yaml")
17
+
buildCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options (Env: $FUNC_CONFIRM)")
18
+
buildCmd.Flags().StringP("image", "i", "", "Full image name in the orm [registry]/[namespace]/[name]:[tag] (optional). This option takes precedence over --registry (Env: $FUNC_IMAGE")
19
+
buildCmd.Flags().StringP("path", "p", cwd(), "Path to the project directory (Env: $FUNC_PATH)")
20
+
buildCmd.Flags().StringP("registry", "r", "", "Registry + namespace part of the image to build, ex 'quay.io/myuser'. The full image name is automatically determined based on the local directory name. If not provided the registry will be taken from func.yaml (Env: $FUNC_REGISTRY)")
Copy file name to clipboardExpand all lines: cmd/delete.go
+20-17
Original file line number
Diff line number
Diff line change
@@ -13,25 +13,28 @@ import (
13
13
14
14
funcinit() {
15
15
root.AddCommand(deleteCmd)
16
-
deleteCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNC_CONFIRM")
17
-
deleteCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be deleted - $FUNC_PATH")
18
-
deleteCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FAAS_NAMESPACE")
16
+
deleteCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options (Env: $FUNC_CONFIRM)")
17
+
deleteCmd.Flags().StringP("path", "p", cwd(), "Path to the function project that should be undeployed (Env: $FUNC_PATH)")
18
+
deleteCmd.Flags().StringP("namespace", "n", "", "Namespace of the function to undeploy. By default, the namespace in func.yaml is used or the actual active namespace if not set in the configuration. (Env: $FUNC_NAMESPACE)")
19
19
}
20
20
21
21
vardeleteCmd=&cobra.Command{
22
-
Use: "delete <name>",
23
-
Short: "Delete a Function deployment",
24
-
Long: `Delete a Function deployment
25
-
26
-
Removes a deployed function from the cluster. The user may specify a function
27
-
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 func.yaml configuration file to
29
-
determine the function to be removed.
30
-
31
-
The namespace defaults to the value in func.yaml or the namespace currently
32
-
active in the user's Kubernetes configuration. The namespace may be specified
33
-
on the command line using the --namespace or -n flag, and if so this will
34
-
overwrite the value in func.yaml.
22
+
Use: "delete [NAME]",
23
+
Short: "Undeploy a function",
24
+
Long: `Undeploy a function
25
+
26
+
This command undeploys a function from the cluster. By default the function from
27
+
the project in the current directory is undeployed. Alternatively either the name
28
+
of the function can be given as argument or the project path provided with --path.
29
+
30
+
No local files are deleted.
31
+
`,
32
+
Example: `
33
+
# Undeploy the function defined in the local directory
34
+
kn func delete
35
+
36
+
# Undeploy the function 'myfunc' in namespace 'apps'
Copy file name to clipboardExpand all lines: cmd/deploy.go
+28-26
Original file line number
Diff line number
Diff line change
@@ -15,37 +15,39 @@ import (
15
15
16
16
funcinit() {
17
17
root.AddCommand(deployCmd)
18
-
deployCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNC_CONFIRM")
19
-
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) - $FUNC_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 - $FUNC_NAMESPACE")
22
-
deployCmd.Flags().StringP("path", "p", cwd(), "Path to the function project directory - $FUNC_PATH")
23
-
deployCmd.Flags().StringP("registry", "r", "", "Image registry for built images, ex 'docker.io/myuser' or just 'myuser'. - $FUNC_REGISTRY")
18
+
deployCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options (Env: $FUNC_CONFIRM)")
19
+
deployCmd.Flags().StringArrayP("env", "e", []string{}, "Environment variable to set in the form NAME=VALUE. You may provide this flag multiple times for setting multiple environment variables.")
20
+
deployCmd.Flags().StringP("image", "i", "", "Full image name in the orm [registry]/[namespace]/[name]:[tag] (optional). This option takes precedence over --registry (Env: $FUNC_IMAGE")
21
+
deployCmd.Flags().StringP("namespace", "n", "", "Namespace of the function to undeploy. By default, the namespace in func.yaml is used or the actual active namespace if not set in the configuration. (Env: $FUNC_NAMESPACE)")
22
+
deployCmd.Flags().StringP("path", "p", cwd(), "Path to the project directory (Env: $FUNC_PATH)")
23
+
deployCmd.Flags().StringP("registry", "r", "", "Registry + namespace part of the image to build, ex 'quay.io/myuser'. The full image name is automatically determined based on the local directory name. If not provided the registry will be taken from func.yaml (Env: $FUNC_REGISTRY)")
24
24
}
25
25
26
26
vardeployCmd=&cobra.Command{
27
27
Use: "deploy",
28
-
Short: "Deploy an existing Function project to a cluster",
29
-
Long: `Deploy an existing Function project to a cluster
30
-
31
-
Builds and Deploys the Function project in the current directory.
32
-
A path to the project directory may be provided using the --path or -p flag.
33
-
Reads the func.yaml configuration file to determine the image name.
34
-
An image and registry may be specified on the command line using
35
-
the --image or -i and --registry or -r flag.
36
-
37
-
If the Function is already deployed, it is updated with a new container image
38
-
that is pushed to an image registry, and the Knative Service is updated.
39
-
40
-
The namespace into which the project is deployed defaults to the value in the
41
-
func.yaml configuration file. If NAMESPACE is not set in the configuration,
42
-
the namespace currently active in the Kubernetes configuration file will be
43
-
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 func.yaml file.
28
+
Short: "Deploy a function",
29
+
Long: `Deploy a function
45
30
31
+
Builds a container image for the function and deploys it to the connected Knative enabled cluster.
32
+
The function is picked up from the project in the current directory or from the path provided
33
+
with --path.
34
+
If not already configured, either --registry or --image has to be provided and is then stored
35
+
in the configuration file.
46
36
37
+
If the function is already deployed, it is updated with a new container image
38
+
that is pushed to an image registry, and finally the function's Knative service is updated.
39
+
`,
40
+
Example: `
41
+
# Build and deploy the function from the current directory's project. The image will be
42
+
# pushed to "quay.io/myuser/<function name>" and deployed as Knative service with the
43
+
# same name as the function to the currently connected cluster.
44
+
kn func deploy --registry quay.io/myuser
45
+
46
+
# Same as above but using a full image name, that will create a Knative service "myfunc" in
Copy file name to clipboardExpand all lines: cmd/describe.go
+15-13
Original file line number
Diff line number
Diff line change
@@ -17,28 +17,30 @@ import (
17
17
18
18
funcinit() {
19
19
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 - $FUNC_NAMESPACE")
21
-
describeCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNC_FORMAT")
22
-
describeCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be described - $FUNC_PATH")
20
+
describeCmd.Flags().StringP("namespace", "n", "", "Namespace of the function to undeploy. By default, the namespace in func.yaml is used or the actual active namespace if not set in the configuration. (Env: $FUNC_NAMESPACE)")
21
+
describeCmd.Flags().StringP("format", "f", "human", "Output format (human|plain|json|xml|yaml) (Env: $FUNC_FORMAT)")
22
+
describeCmd.Flags().StringP("path", "p", cwd(), "Path to the project directory (Env: $FUNC_PATH)")
0 commit comments