Skip to content

Commit fdb6182

Browse files
authored
Merge pull request #34553 from abrennan89/SRVKS-657
SRVKS-657: Add module for custom route labels and annotations
2 parents 45d8514 + cf1e7f7 commit fdb6182

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[id="serverless-customize-labels-annotations-routes_{context}"]
2+
= Customizing labels and annotations for {product-title} routes
3+
4+
{product-title} routes support the use of custom labels and annotations, which you can configure by modifying the `metadata` spec of a Knative service. Custom labels and annotations are propagated from the service to the Knative route, then to the Knative ingress, and finally to the {product-title} route.
5+
6+
.Prerequisites
7+
8+
* You must have the {ServerlessOperatorName} and Knative Serving installed on your {product-title} cluster.
9+
10+
.Procedure
11+
12+
. Create a Knative service that contains the label or annotation that you want to propagate to the {product-title} route:
13+
** To create a service by using YAML:
14+
+
15+
.Example service created by using YAML
16+
[source,yaml]
17+
----
18+
apiVersion: serving.knative.dev/v1
19+
kind: Service
20+
metadata:
21+
name: <service_name>
22+
labels:
23+
<label_name>: <label_value>
24+
annotations:
25+
<annotation_name>: <annotation_value>
26+
...
27+
----
28+
** To create a service by using the `kn` CLI, enter:
29+
+
30+
.Example service created by using a `kn` command
31+
[source,terminal]
32+
----
33+
$ kn service create <service_name> \
34+
--image=<image> \
35+
--annotation <annotation_name>=<annotation_value> \
36+
--label <label_value>=<label_value>
37+
----
38+
39+
. Verify that the {product-title} route has been created with the annotation or label that you added by inspecting the output from the following command:
40+
+
41+
.Example command for verification
42+
[source,terminal]
43+
----
44+
$ oc get routes.route.openshift.io \
45+
-l serving.knative.openshift.io/ingressName=<service_name> \ <1>
46+
-l serving.knative.openshift.io/ingressNamespace=<service_namespace> \ <2>
47+
-n knative-serving-ingress -o yaml \
48+
| grep -e "<label_name>: \"<label_value>\"" -e "<annotation_name>: <annotation_value>" <3>
49+
----
50+
<1> Use the name of your service.
51+
<2> Use the namespace where your service was created.
52+
<3> Use your values for the label and annotation names and values.

serverless/knative_serving/serverless-configuring-routes.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,11 @@ You can disable Operator control of {product-title} routing so that you can conf
1212

1313
Knative routes can also be used alongside the {product-title} route to provide additional fine-grained routing capabilities, such as traffic splitting.
1414

15+
include::modules/serverless-customize-labels-annotations-routes.adoc[leveloffset=+1]
1516
include::modules/serverless-openshift-routes.adoc[leveloffset=+1]
1617
include::modules/knative-service-cluster-local.adoc[leveloffset=+1]
18+
19+
[id="additional-resources_serverless-configuring-routes"]
20+
== Additional resources
21+
22+
* For more information about supported {product-title} route annotations, see xref:../..//networking/routes/route-configuration.adoc#nw-route-specific-annotations_route-configuration[Route-specific annotations].

0 commit comments

Comments
 (0)