Skip to content

Commit 467fda4

Browse files
authored
Merge pull request #34413 from rh-max/srvls-functions-annotations
SRVOCF-303: Add docs on the function annotations feature
2 parents 5b070b8 + 085a3b9 commit 467fda4

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3132,6 +3132,8 @@ Topics:
31323132
File: serverless-functions-eventing
31333133
- Name: Accessing secrets and config maps from Serverless functions
31343134
File: serverless-functions-accessing-secrets-configmaps
3135+
- Name: Adding annotations to functions
3136+
File: serverless-functions-annotations
31353137
- Name: Functions development reference guide
31363138
File: serverless-functions-reference-guide
31373139
# Integrations
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[id="serverless-functions-adding-annotations_{context}"]
2+
= Adding annotations to a function
3+
4+
.Procedure
5+
6+
. Open the `func.yaml` file for your function.
7+
8+
. For every annotation that you want to add, add the following YAML to the `annotations` section:
9+
+
10+
[source,yaml]
11+
----
12+
name: test
13+
namespace: ""
14+
runtime: go
15+
...
16+
annotations:
17+
<annotation_name>: "<annotation_value>" <1>
18+
----
19+
<1> Substitute `<annotation_name>: "<annotation_value>"` with your annotation.
20+
+
21+
For example, to indicate that a function was authored by Alice, you might include the following annotation:
22+
+
23+
[source,yaml]
24+
----
25+
name: test
26+
namespace: ""
27+
runtime: go
28+
...
29+
annotations:
30+
31+
----
32+
33+
. Save the configuration.
34+
35+
The next time you deploy your function to the cluster, the annotations are added to the corresponding Knative service.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
include::modules/serverless-document-attributes.adoc[]
2+
[id="serverless-functions-attributes"]
3+
= Adding annotations to functions
4+
include::modules/common-attributes.adoc[]
5+
:context: serverless-functions-annotations
6+
7+
toc::[]
8+
9+
You can add Kubernetes annotations to a deployed Serverless function by adding them to the `annotations` section in the `func.yaml` configuration file.
10+
11+
[IMPORTANT]
12+
====
13+
There are two limitations of the function annotation feature:
14+
15+
* Once a function annotation propagates to the corresponding Knative service on the cluster, it cannot be removed from the service by deleting it from the `func.yaml` file. You can remove the annotation from the Knative service by modifying the YAML file of the service directly, or by using the Developer Console.
16+
* You cannot set annotations that are set by Knative, for example, the `autoscaling` annotations.
17+
====
18+
19+
include::modules/serverless-functions-adding-annotations.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)