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-functions-func-yaml-fields.adoc
+47-7Lines changed: 47 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,33 @@ Many of the fields in `func.yaml` are generated automatically when you create, b
5
5
6
6
== builder
7
7
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.
9
9
10
-
== builderMap
10
+
== builders
11
11
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
+
----
13
35
14
36
== envs
15
37
@@ -120,6 +142,28 @@ The `image` field sets the image name for your function after it has been built.
120
142
121
143
The `imageDigest` field contains the SHA256 hash of the image manifest when the function is deployed. Do not modify this value.
122
144
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
+
123
167
== name
124
168
125
169
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
131
175
== runtime
132
176
133
177
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