Skip to content

Commit 5738213

Browse files
authored
Merge pull request #38798 from rh-max/srvls-func-yaml-updates
SRVOCF-361: Updates to the func.yaml reference documentation
2 parents 4066175 + 1c32060 commit 5738213

File tree

1 file changed

+47
-7
lines changed

1 file changed

+47
-7
lines changed

modules/serverless-functions-func-yaml-fields.adoc

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,33 @@ Many of the fields in `func.yaml` are generated automatically when you create, b
55

66
== builder
77

8-
The `builder` field specifies the Buildpack builder image to use when building the function. In most cases, this value should not be changed. When you do change it, use a value that is listed in the `builderMap` field.
8+
The `builder` field specifies the Buildpack builder image to use when building the function. In most cases, this value should not be changed. When you do change it, use a value that is listed in the `builders` field.
99

10-
== builderMap
10+
== builders
1111

12-
Some function runtimes can be built in multiple ways. For example, a Quarkus function can be built for the JVM or as a native binary. The `builderMap` field contains all of the builders available for a given runtime.
12+
Some function runtimes can be built in multiple ways. For example, a Quarkus function can be built for the JVM or as a native binary. The `builders` field contains all of the builders available for a given runtime.
13+
14+
== buildEnvs
15+
16+
The `buildEnvs` field enables you to set environment variables to be available to the environment that builds your function. Unlike variables set using `envs`, a variable set using `buildEnv` is not available during function runtime.
17+
18+
You can set a `buildEnv` variable directly from a value. In the following example, the `buildEnv` variable named `EXAMPLE1` is directly assigned the `one` value:
19+
20+
[source,yaml]
21+
----
22+
buildEnvs:
23+
- name: EXAMPLE1
24+
value: one
25+
----
26+
27+
You can also set a `buildEnv` variable from a local environment variable. In the following example, the `buildEnv` variable named `EXAMPLE2` is assigned the value of the `LOCAL_ENV_VAR` local environment variable:
28+
29+
[source,yaml]
30+
----
31+
buildEnvs:
32+
- name: EXAMPLE1
33+
value: '{{ env:LOCAL_ENV_VAR }}'
34+
----
1335

1436
== envs
1537

@@ -120,6 +142,28 @@ The `image` field sets the image name for your function after it has been built.
120142

121143
The `imageDigest` field contains the SHA256 hash of the image manifest when the function is deployed. Do not modify this value.
122144

145+
== labels
146+
147+
The `labels` field enables you to set labels on a deployed function.
148+
149+
You can set a label directly from a value. In the following example, the label with the `role` key is directly assigned the value of `backend`:
150+
151+
[source,yaml]
152+
----
153+
labels:
154+
- key: role
155+
value: backend
156+
----
157+
158+
You can also set a label from a local environment variable. In the following example, the label with the `author` key is assigned the value of the `USER` local environment variable:
159+
160+
[source,yaml]
161+
----
162+
labels:
163+
- key: author
164+
value: '{{ env:USER }}'
165+
----
166+
123167
== name
124168

125169
The `name` field defines the name of your function. This value is used as the name of your Knative service when it is deployed. You can change this field to rename the function on subsequent deployments.
@@ -131,7 +175,3 @@ The `namespace` field specifies the namespace in which your function is deployed
131175
== runtime
132176

133177
The `runtime` field specifies the language runtime for your function, for example, `python`.
134-
135-
== template
136-
137-
The `template` field specifies the type of the invocation event that triggers your function. You can set it to `http` for triggering with plain HTTP requests or to `events` for triggering with cloud events.

0 commit comments

Comments
 (0)