Skip to content

Commit e9fd163

Browse files
committed
add page for Serving with OCP ingress sharding
1 parent 9b83905 commit e9fd163

8 files changed

+129
-5
lines changed

modules/ROOT/nav.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
* xref:index.adoc[Overview]
22
* Serverless
33
** Using OpenShift Serverless with OpenShift Service Mesh
4-
*** xref:serverless-common:service-mesh/common-service-mesh-setup.adoc[Setup Serverless with OpenShift Service Mesh]
5-
*** xref:serverless-common:service-mesh/common-service-mesh-network-isolation.adoc[Use Service Mesh to isolate network-traffic]
6-
*** xref:serverless-common:service-mesh/eventing-service-mesh-containersource.adoc[Eventing: Using ContainerSource with OpenShift Service Mesh]
7-
*** xref:serverless-common:service-mesh/eventing-service-mesh-sinkbinding.adoc[Eventing: Using SinkBinding with OpenShift Service Mesh]
4+
*** xref:serverless:service-mesh/common-service-mesh-setup.adoc[Setup Serverless with OpenShift Service Mesh]
5+
*** xref:serverless:service-mesh/common-service-mesh-network-isolation.adoc[Use Service Mesh to isolate network-traffic]
6+
*** xref:serverless:service-mesh/eventing-service-mesh-containersource.adoc[Eventing: Using ContainerSource with OpenShift Service Mesh]
7+
*** xref:serverless:service-mesh/eventing-service-mesh-sinkbinding.adoc[Eventing: Using SinkBinding with OpenShift Service Mesh]
8+
** Serving
9+
*** xref:serverless:serving/serving-with-ingress-sharding.adoc[Use Serving with OpenShift ingress sharding]
810
* Serverless Logic
911
** xref:serverless-logic:about.adoc[About OpenShift Serverless Logic]
1012
** User Guides

modules/serverless-common/pages/service-mesh/common-service-mesh-setup.adoc renamed to modules/serverless/pages/service-mesh/common-service-mesh-setup.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ istio-system istio-ingressgateway ClusterIP 172.30.46.146 none> 15021/TCP,
4242
This command should not return a `Service` of type `NodePort` or `LoadBalancer`.
4343

4444

45-
4645
.Prerequisites
4746

4847
* You have access to an {product-title} account with cluster administrator access.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
= Use Serving with {product-title} ingress sharding
2+
:compat-mode!:
3+
// Metadata:
4+
:description: Use Serving with {product-title} ingress sharding
5+
6+
This page describes how {serverless} Serving can be used with {product-title} ingress sharding.
7+
8+
.Prerequisites
9+
10+
* You have access to an {product-title} account with cluster administrator access.
11+
12+
* You have an existing {product-title} routing setup that uses ingress shards
13+
14+
15+
.Setting up {product-title} ingress shards
16+
17+
{serverless} can be configured to match specific ingress shards with different domains with a label selector.
18+
The following is an example of how your ingress shard could be configured.
19+
The relevant fields are marked:
20+
21+
[source,yaml]
22+
----
23+
apiVersion: operator.openshift.io/v1
24+
kind: IngressController
25+
metadata:
26+
name: ingress-dev <1>
27+
namespace: openshift-ingress-operator
28+
spec:
29+
routeSelector:
30+
matchLabels:
31+
router: dev <2>
32+
domain: "dev.serverless.cluster.example.com" <3>
33+
#... other settings ...
34+
---
35+
apiVersion: operator.openshift.io/v1
36+
kind: IngressController
37+
metadata:
38+
name: ingress-prod <1>
39+
namespace: openshift-ingress-operator
40+
spec:
41+
routeSelector:
42+
matchLabels:
43+
router: prod <2>
44+
domain: "prod.serverless.cluster.example.com" <3>
45+
#... other settings ...
46+
----
47+
<1> The names of your ingress shard, here as an example `dev` and `prod` for different stages
48+
<2> A label selector to match the ingress shard
49+
<3> A custom domain for the ingress shard
50+
51+
Replace these values with your own configuration.
52+
53+
.Configuring custom domains in the `KnativeServing` CustomResource
54+
55+
To match the ingress shards, you need to configure `KnativeServing` to use the same domains and labels as your ingress shards.
56+
For this you need to create or edit your `KnativeServing` resource and add the `spec.config.domain` field:
57+
[source,yaml]
58+
----
59+
spec:
60+
config:
61+
domain: <1>
62+
dev.serverless.cluster.example.com: |
63+
selector:
64+
router: dev
65+
prod.serverless.cluster.example.com: |
66+
selector:
67+
router: prod
68+
----
69+
<1> These values have to match to the ones in the ingress shard configuration.
70+
71+
.Targeting a specific ingress shard in the Knative Service
72+
73+
You can now target a specific ingress shard in your Knative `Service` resources using a label:
74+
[source,yaml]
75+
----
76+
apiVersion: serving.knative.dev/v1
77+
kind: Service
78+
metadata:
79+
name: hello-dev
80+
labels:
81+
router: dev <1>
82+
spec:
83+
template:
84+
spec:
85+
containers:
86+
- image: docker.io/openshift/hello-openshift
87+
---
88+
apiVersion: serving.knative.dev/v1
89+
kind: Service
90+
metadata:
91+
name: hello-prod
92+
labels:
93+
router: prod <1>
94+
spec:
95+
template:
96+
spec:
97+
containers:
98+
- image: docker.io/openshift/hello-openshift
99+
----
100+
<1> This have to match the configuration in `KnativeServing`
101+
102+
.Verification
103+
104+
With this setup, your Knative Services should use the correct route and the selected ingress shard:
105+
[source,terminal]
106+
----
107+
$ oc get ksvc
108+
NAME URL LATESTCREATED LATESTREADY READY REASON
109+
hello-dev https://hello-dev-default.dev.serverless.cluster.example.com hello-dev-00001 hello-dev-00001 True
110+
hello-prod https://hello-prod-default.prod.serverless.cluster.example.com hello-prod-00001 hello-prod-00001 True
111+
----
112+
[source,terminal]
113+
----
114+
$ oc get route -n knative-serving-ingress -o jsonpath='{range .items[*]}{@.metadata.name}{" "}{@.spec.host}{" "}{@.status.ingress[*].routerName}{"\n"}{end}'
115+
route-19e6628b-77af-4da0-9b4c-1224934b2250-323461616533 hello-prod-default.prod.serverless.cluster.example.com ingress-prod
116+
route-cb5085d9-b7da-4741-9a56-96c88c6adaaa-373065343266 hello-dev-default.dev.serverless.cluster.example.com ingress-dev
117+
----
118+
119+
[NOTE]
120+
====
121+
Please be aware that even with OpenShift ingress sharding in place, the {serverless} traffic is still routed through a single Knative Ingress Gateway and the activator component in the `knative-serving` project.
122+
Please also take a look at xref:./../service-mesh/common-service-mesh-network-isolation.adoc[] for more information about isolating the network traffic.
123+
====

0 commit comments

Comments
 (0)