Skip to content

Commit f186d46

Browse files
authored
Merge pull request #51183 from rh-max/srvls-functions-on-cluster-builds
[SRVOCF-442] Move on-cluster function building to separate assembly; add the section on specifying which function to build
2 parents 12981eb + 4e4cea8 commit f186d46

5 files changed

+62
-3
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,6 +3638,8 @@ Topics:
36383638
File: serverless-functions-setup
36393639
- Name: Getting started with functions
36403640
File: serverless-functions-getting-started
3641+
- Name: On-cluster function building and deploying
3642+
File: serverless-functions-on-cluster-builds
36413643
- Name: Developing Node.js functions
36423644
File: serverless-developing-nodejs-functions
36433645
- Name: Developing TypeScript functions

modules/serverless-functions-on-cluster-builds.adoc renamed to modules/serverless-functions-creating-on-cluster-builds.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ git:
6969
+
7070
[source,terminal]
7171
----
72-
$ kn func deploy
72+
$ kn func deploy --remote
7373
----
7474
+
7575
If you are not logged into the container registry referenced in your function configuration, you are prompted to provide credentials for the remote container registry that hosts the function image:
@@ -85,4 +85,4 @@ Please provide credentials for image registry used by Pipeline.
8585
Function deployed at URL: http://test-function.default.svc.cluster.local
8686
----
8787

88-
. To update your function, commit and push new changes by using Git, then run the `kn func deploy` command again.
88+
. To update your function, commit and push new changes by using Git, then run the `kn func deploy --remote` command again.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/functions/serverless-functions-on-cluster-builds.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="serverless-functions-specifying-function-revision_{context}"]
7+
= Specifying function revision
8+
9+
When building and deploying a function on the cluster, you must specify the location of the function code by specifying the Git repository, branch, and subdirectory within the repository. You do not need to specify the branch if you use the `main` branch. Similarly, you do not need to specify the subdirectory if your function is at the root of the repository. You can specify these parameters in the `func.yaml` configuration file, or by using flags with the `kn func deploy` command.
10+
11+
.Prerequisites
12+
13+
* {pipelines-title} must be installed on your cluster.
14+
15+
* You have installed the OpenShift (`oc`) CLI.
16+
17+
* You have installed the Knative (`kn`) CLI.
18+
19+
.Procedure
20+
21+
* Deploy your function:
22+
+
23+
[source,terminal]
24+
----
25+
$ kn func deploy --remote \ <1>
26+
--git-url <repo-url> \ <2>
27+
[--git-branch <branch>] \ <3>
28+
[--git-dir <function-dir>] <4>
29+
----
30+
+
31+
--
32+
<1> With the `--remote` flag, the build runs remotely.
33+
<2> Substitute `<repo-url>` with the URL of the Git repository.
34+
<3> Substitute `<branch>` with the Git branch, tag, or commit. If using the latest commit on the `main` branch, you can skip this flag.
35+
<4> Substitute `<function-dir>` with the directory containing the function if it is different than the repository root directory.
36+
--
37+
+
38+
For example:
39+
+
40+
[source,terminal]
41+
----
42+
$ kn func deploy --remote \
43+
--git-url https://example.com/alice/myfunc.git \
44+
--git-branch my-feature \
45+
--git-dir functions/example-func/
46+
----

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Before you can complete the following procedures, you must ensure that you have
1919
include::modules/serverless-create-func-kn.adoc[leveloffset=+1]
2020
include::modules/serverless-kn-func-run.adoc[leveloffset=+1]
2121
include::modules/serverless-build-func-kn.adoc[leveloffset=+1]
22-
include::modules/serverless-functions-on-cluster-builds.adoc[leveloffset=+1]
2322
include::modules/serverless-deploy-func-kn.adoc[leveloffset=+1]
2423
include::modules/serverless-kn-func-invoke.adoc[leveloffset=+1]
2524

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:_content-type: ASSEMBLY
2+
[id="serverless-functions-on-cluster-builds"]
3+
= On-cluster function building and deploying
4+
:context: serverless-functions-on-cluster-builds
5+
include::_attributes/common-attributes.adoc[]
6+
7+
toc::[]
8+
9+
Instead of building a function locally, you can build a function directly on the cluster. When using this workflow on a local development machine, you only need to work with the function source code. This is useful, for example, when you cannot install on-cluster function building tools, such as docker or podman.
10+
11+
include::modules/serverless-functions-creating-on-cluster-builds.adoc[leveloffset=+1]
12+
include::modules/serverless-functions-specifying-function-revision.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)