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
Copy file name to clipboardExpand all lines: modules/serverless-build-func-kn.adoc
+8-29Lines changed: 8 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,30 +6,16 @@
6
6
[id="serverless-build-func-kn_{context}"]
7
7
= Building functions
8
8
9
-
Before you can run a function, you must build the function project by using the `kn func build` command. The build command reads the `func.yaml` file from the function project directory to determine the image name and registry.
9
+
Before you can run a function, you must build the function project by using the `kn func build` command. This command creates an OCI container image that can be run locally on your computer or on an {product-title} cluster. The build command uses the function project name and the image registry name to construct a fully qualified image name for your function.
10
10
11
-
.Example `func.yaml`
12
-
[source,yaml]
13
-
----
14
-
name: example-function
15
-
namespace: default
16
-
runtime: node
17
-
image: <image_from_registry>
18
-
imageDigest: ""
19
-
trigger: http
20
-
builder: default
21
-
builderMap:
22
-
default: quay.io/boson/faas-nodejs-builder
23
-
envs: {}
24
-
----
11
+
The OpenShift Container Registry is used by default as the image registry for storing function images. You can override this by using the `-r` flag:
25
12
26
-
If the image name and registry are not set in the `func.yaml` file, you must either specify the registry flag, `-r` when using the `kn func build` command, or you are prompted to provide a registry value in the terminal when building a function. An image name is then derived from the registry value that you have provided.
// removed mentioning the `FUNC_REGISTRY` environment variable because we didn't provide an example and it seems unnecessary - can add it in later if it's important
33
19
34
20
.Example output
35
21
[source,terminal]
@@ -38,17 +24,10 @@ Building function image
38
24
Function image has been built, image: quay.io/username/example-function:latest
39
25
----
40
26
41
-
This command creates an OCI container image that can be run locally on your computer, or on a Kubernetes cluster.
27
+
To learn more about `kn func build` command options, you can use the help command:
42
28
43
-
.Example using the registy prompt
29
+
.Build help command
44
30
[source,terminal]
45
31
----
46
-
$ kn func build
47
-
A registry for function images is required (e.g. 'quay.io/boson').
48
-
49
-
Registry for function images: quay.io/username
50
-
Building function image
51
-
Function image has been built, image: quay.io/username/example-function:latest
32
+
$ kn func help build
52
33
----
53
-
54
-
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.
Copy file name to clipboardExpand all lines: modules/serverless-deploy-func-kn.adoc
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,12 @@
6
6
[id="serverless-deploy-func-kn_{context}"]
7
7
= Deploying functions
8
8
9
-
You can deploy a function to your cluster as a Knative service by using the `kn func deploy` command.
10
-
11
-
If the targeted 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.
9
+
You can deploy a function to your cluster as a Knative service by using the `kn func deploy` command. If the targeted 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.
12
10
13
11
.Prerequisites
14
12
15
13
* The {ServerlessOperatorName} and Knative Serving are installed on the cluster.
16
-
* You have installed the `kn` CLI.
14
+
* You have installed the Knative (`kn`) CLI.
17
15
* You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in {product-title}.
18
16
* You must have already created and initialized the function that you want to deploy.
19
17
@@ -23,7 +21,7 @@ If the targeted function is already deployed, it is updated with a new container
This guide explains how you can get started with creating, building, and deploying a function on an {ServerlessProductName} installation. When building and deploying functions, the resulting container image is stored in an image registry.
0 commit comments