Skip to content

Commit 8ddb6a6

Browse files
committed
[srvls] Add kn func CLI docs
1 parent 558fc36 commit 8ddb6a6

File tree

8 files changed

+124
-7
lines changed

8 files changed

+124
-7
lines changed

_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,3 +3005,5 @@ Topics:
30053005
File: kn-flags-reference
30063006
- Name: kn service
30073007
File: kn-services-ref
3008+
# - Name: kn func
3009+
# File: kn-func-ref

modules/delete-function-kn.adoc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Module included in the following assemblies
2+
3+
// * /serverless/cli_reference/kn-func-ref.adoc
4+
5+
[id="delete-function-kn_{context}"]
6+
= Deleting a function
7+
8+
You can delete a function from your cluster by using the `kn func delete` command.
9+
10+
.Procedure
11+
12+
* Delete a function:
13+
+
14+
[source,terminal]
15+
----
16+
$ kn func delete [<function_name> -n <namespace> -p <path>]
17+
----
18+
** If the name or path of the function to delete is not specified, the current directory is searched for a `func.yaml` file that is used to determine the function to delete.
19+
** If the namespace is not specified, it defaults to the `namespace` value in the `func.yaml` file.

modules/describe-function-kn.adoc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Module included in the following assemblies
2+
3+
// * /serverless/cli_reference/kn-func-ref.adoc
4+
5+
[id="describe-function-kn_{context}"]
6+
= Describing a function
7+
8+
The `kn func describe` command prints information about a deployed function, such as the function name, image, namespace, information about the Knative service, route information, and event subscriptions.
9+
10+
.Procedure
11+
12+
* Describe a function:
13+
+
14+
[source,termnal]
15+
----
16+
$ kn func describe [-f <format> -n <namespace> -p <path>]
17+
----
18+
+
19+
.Example command
20+
[source,terminal]
21+
----
22+
$ kn func describe -p function/example-function
23+
----
24+
+
25+
.Example output
26+
[source,terminal]
27+
----
28+
Function name:
29+
example-function
30+
Function is built in image:
31+
docker.io/user/example-function:latest
32+
Function is deployed as Knative Service:
33+
example-function
34+
Function is deployed in namespace:
35+
default
36+
Routes:
37+
http://example-function.default.apps.ci-ln-g9f36hb-d5d6b.origin-ci-int-aws.dev.rhcloud.com
38+
----

modules/functions-list-kn.adoc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Module included in the following assemblies
2+
3+
// * /serverless/cli_reference/kn-func-ref.adoc
4+
5+
[id="functions-list-kn_{context}"]
6+
= Listing existing functions
7+
8+
You can list existing functions by using `kn func list`. If you want to list functions that have been deployed as Knative services, you can also use `kn service list`.
9+
10+
.Procedure
11+
12+
* List existing functions:
13+
+
14+
[source,terminal]
15+
----
16+
$ kn func list [-n <namespace> -p <path>]
17+
----
18+
+
19+
.Example output
20+
[source,terminal]
21+
----
22+
NAME NAMESPACE RUNTIME URL READY
23+
example-function default node http://example-function.default.apps.ci-ln-g9f36hb-d5d6b.origin-ci-int-aws.dev.rhcloud.com True
24+
25+
----
26+
27+
* List functions deployed as Knative services:
28+
+
29+
[source,terminal]
30+
----
31+
$ kn service list -n <namespace>
32+
----
33+
+
34+
.Example output
35+
[source,terminal]
36+
----
37+
NAME URL LATEST AGE CONDITIONS READY REASON
38+
example-function http://example-function.default.apps.ci-ln-g9f36hb-d5d6b.origin-ci-int-aws.dev.rhcloud.com example-function-gzl4c 16m 3 OK / 3 True
39+
----

modules/serverless-build-func-kn.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Before you can run a function, you must build the function project by using the
1010
.Example `func.yaml`
1111
[source,yaml]
1212
----
13-
name: fn.example.io
13+
name: example-function
1414
namespace: default
1515
runtime: node
1616
image: <image_from_registry>
@@ -34,7 +34,7 @@ $ kn func build [-i <image> -r <registry> -p <path>]
3434
[source,terminal]
3535
----
3636
Building function image
37-
Function image has been built, image: quay.io/username/fn.example.io:latest
37+
Function image has been built, image: quay.io/username/example-function:latest
3838
----
3939

4040
This command creates an OCI container image that can be run locally on your computer, or on a Kubernetes cluster.
@@ -47,7 +47,7 @@ A registry for function images is required (e.g. 'quay.io/boson').
4747
4848
Registry for function images: quay.io/username
4949
Building function image
50-
Function image has been built, image: quay.io/username/fn.example.io:latest
50+
Function image has been built, image: quay.io/username/example-function:latest
5151
----
5252

5353
The values for image and registry are persisted to the `func.yaml` file, so that subsequent invocations do not require the user to specify these again.

modules/serverless-create-func-kn.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The values provided for image and registry are persisted to the `func.yaml` file
1414
.Example `func.yaml`
1515
[source,yaml]
1616
----
17-
name: fn.example.io
17+
name: example-function
1818
namespace: default
1919
runtime: node
2020
image: <image_from_registry>
@@ -40,14 +40,14 @@ $ kn func create <path> -r <registry> -l <runtime> -t <trigger> -i <image> -n <n
4040
.Example command
4141
[source,terminal]
4242
----
43-
$ kn func create functions/fn.example.io
43+
$ kn func create functions/example-function
4444
----
4545
+
4646
.Example output
4747
[source,terminal]
4848
----
49-
Project path: /home/user/functions/fn.example.io
50-
Function name: fn.example.io
49+
Project path: /home/user/functions/example-function
50+
Function name: example-function
5151
Runtime: node
5252
Trigger: http
5353
----
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
include::modules/serverless-document-attributes.adoc[]
2+
[id="kn-func-ref"]
3+
= kn func
4+
:context: kn-func-ref
5+
include::modules/common-attributes.adoc[]
6+
7+
toc::[]
8+
9+
include::modules/serverless-create-func-kn.adoc[leveloffset=+1]
10+
include::modules/serverless-build-func-kn.adoc[leveloffset=+1]
11+
include::modules/serverless-deploy-func-kn.adoc[leveloffset=+1]
12+
include::modules/functions-list-kn.adoc[leveloffset=+1]
13+
include::modules/describe-function-kn.adoc[leveloffset=+1]
14+
include::modules/delete-function-kn.adoc[leveloffset=+1]

serverless/functions/serverless-functions-getting-started.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ Before you can complete the following procedures, you must ensure that you have
2020
include::modules/serverless-create-func-kn.adoc[leveloffset=+1]
2121
include::modules/serverless-build-func-kn.adoc[leveloffset=+1]
2222
include::modules/serverless-deploy-func-kn.adoc[leveloffset=+1]
23+
24+
[id="additional-resources_serverless-functions-getting-started"]
25+
== Additional resources
26+
27+
* See the reference documentation for xref:../../serverless/cli_reference/kn-func-ref.adoc#kn-func-ref[`kn func`].

0 commit comments

Comments
 (0)