Skip to content

Commit 8225720

Browse files
committed
Route docs for serverless
1 parent 74fb7d1 commit 8225720

File tree

4 files changed

+116
-3
lines changed

4 files changed

+116
-3
lines changed

_topic_map.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2871,8 +2871,10 @@ Topics:
28712871
- Name: Networking
28722872
Dir: networking
28732873
Topics:
2874-
- Name: Mapping a custom domain name to a service
2874+
- Name: Mapping a custom domain name to a Knative service
28752875
File: serverless-domain-mapping
2876+
- Name: Configuring routes for Knative services
2877+
File: serverless-configuring-routes
28762878
- Name: Using Service Mesh with OpenShift Serverless
28772879
File: serverless-ossm
28782880
- Name: Using JSON Web Token authentication with Service Mesh and OpenShift Serverless
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Module included in the following assemblies:
2+
// * serverless/networking/serverless-configuring-routes.adoc
3+
4+
[id="serverless-openshift-routes_{context}"]
5+
= Configuring {product-title} routes for Knative services
6+
7+
If you want to configure a Knative service to use your TLS certificate on {product-title}, you must disable the automatic creation of a route for the service by the {ServerlessOperatorName}, and instead manually create a `Route` resource for the service.
8+
9+
.Prerequisites
10+
11+
* The {ServerlessOperatorName} and Knative Serving component must be installed on your {product-title} cluster.
12+
13+
.Procedure
14+
15+
. Create a Knative service that includes the `serving.knative.openshift.io/disableRoute=true` annotation:
16+
+
17+
.Example YAML
18+
[source,yaml]
19+
----
20+
apiVersion: serving.knative.dev/v1
21+
kind: Service
22+
metadata:
23+
name: <service_name>
24+
annotations:
25+
serving.knative.openshift.io/disableRoute: true
26+
spec:
27+
template:
28+
spec:
29+
containers:
30+
- image: <image>
31+
----
32+
+
33+
.Example `kn` command
34+
[source,terminal]
35+
----
36+
$ kn service create hello-example \
37+
--image=gcr.io/knative-samples/helloworld-go \
38+
--annotation serving.knative.openshift.io/disableRoute=true
39+
----
40+
41+
. Verify that no {product-title} route has been created for the service:
42+
+
43+
.Example command
44+
[source,terminal]
45+
----
46+
$ oc get routes.route.openshift.io -l serving.knative.openshift.io/ingressName=$KSERVICE_NAME -l serving.knative.openshift.io/ingressNamespace=$KSERVICE_NAMESPACE -n knative-serving-ingress
47+
----
48+
+
49+
You should see the following output:
50+
+
51+
[source,terminal]
52+
----
53+
No resources found in knative-serving-ingress namespace.
54+
----
55+
56+
. Create a `Route` object in the `knative-serving-ingress` namespace by copying the following sample YAML and modifying the replaceable values:
57+
+
58+
[source,yaml]
59+
----
60+
apiVersion: route.openshift.io/v1
61+
kind: Route
62+
metadata:
63+
annotations:
64+
haproxy.router.openshift.io/timeout: 600s <1>
65+
name: <route_name> <2>
66+
namespace: knative-serving-ingress <3>
67+
spec:
68+
host: <service_host> <4>
69+
port:
70+
targetPort: http2
71+
to:
72+
kind: Service
73+
name: kourier
74+
weight: 100
75+
tls:
76+
insecureEdgeTerminationPolicy: Allow
77+
termination: edge <5>
78+
key: |-
79+
-----BEGIN PRIVATE KEY-----
80+
[...]
81+
-----END PRIVATE KEY-----
82+
certificate: |-
83+
-----BEGIN CERTIFICATE-----
84+
[...]
85+
-----END CERTIFICATE-----
86+
caCertificate: |-
87+
-----BEGIN CERTIFICATE-----
88+
[...]
89+
-----END CERTIFICATE----
90+
wildcardPolicy: None
91+
----
92+
<1> The timeout value for the {product-title} route. You must set the same value as the `max-revision-timeout-seconds` setting (`600s` by default).
93+
<2> The name of the {product-title} route.
94+
<3> The namespace for the {product-title} route. This must be `knative-serving-ingress`.
95+
<4> The hostname for external access. You can set this to `<service_name>-<service_namespace>.<domain>`.
96+
<5> The certificates you want to use. Currently, only `edge` termination is supported.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
include::modules/serverless-document-attributes.adoc[]
2+
[id="serverless-configuring-routes"]
3+
= Configuring routes for Knative services
4+
:context: serverless-configuring-routes
5+
include::modules/common-attributes.adoc[]
6+
7+
toc::[]
8+
9+
Knative leverages {product-title} TLS termination to provide routing for Knative services. When a Knative service is created, a {product-title} route is automatically created for the service. This route is managed by the {ServerlessOperatorName}. The {product-title} route exposes the Knative service through the same domain as the {product-title} cluster.
10+
11+
You can disable Operator control of {product-title} routing so that you can configure a Knative route to directly use your TLS certificates instead.
12+
13+
Knative routes can also be used alongside the {product-title} route to provide additional fine-grained routing capabilities, such as traffic splitting.
14+
15+
include::modules/serverless-openshift-routes.adoc[leveloffset=+1]

serverless/networking/serverless-domain-mapping.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
include::modules/serverless-document-attributes.adoc[]
22
[id="serverless-domain-mapping"]
3-
= Mapping a custom domain name to a service
3+
= Mapping a custom domain name to a Knative service
44
:context: serverless-domain-mapping
55
include::modules/common-attributes.adoc[]
66

77
toc::[]
88

9-
Knative Services are automatically assigned a default domain name based on your cluster configuration. For example, `<service_name>.<namespace>.example.com`.
9+
Knative services are automatically assigned a default domain name based on your cluster configuration. For example, `<service_name>.<namespace>.example.com`.
1010
You can map a custom domain name that you own to a Knative service by creating a `DomainMapping` custom resource (CR) for the service.
1111
You can also create multiple CRs to map multiple domains and subdomains to a single service.
1212

0 commit comments

Comments
 (0)