Skip to content

Commit 96d08d5

Browse files
skrthomasahardin-rh
authored andcommitted
OSDOCS-3628: Adding ability to create an ingress route with a custom certificate
1 parent 719bc89 commit 96d08d5

File tree

3 files changed

+72
-5
lines changed

3 files changed

+72
-5
lines changed

modules/nw-ingress-creating-a-route-via-an-ingress.adoc

+12-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[id="nw-ingress-creating-a-route-via-an-ingress_{context}"]
77
= Creating a route through an Ingress object
88

9-
Some ecosystem components have an integration with `Ingress` resources but not with `Route` resources. To cover this case, {product-title} automatically creates managed route objects when an Ingress object is created. These route objects are deleted when the corresponding `Ingress` objects are deleted.
9+
Some ecosystem components have an integration with Ingress resources but not with route resources. To cover this case, {product-title} automatically creates managed route objects when an Ingress object is created. These route objects are deleted when the corresponding Ingress objects are deleted.
1010

1111
.Procedure
1212

@@ -21,6 +21,7 @@ metadata:
2121
name: frontend
2222
annotations:
2323
route.openshift.io/termination: "reencrypt" <1>
24+
route.openshift.io/destination-ca-certificate-secret: secret-ca-cert <3>
2425
spec:
2526
rules:
2627
- host: www.example.com <2>
@@ -39,9 +40,8 @@ spec:
3940
secretName: example-com-tls-certificate
4041
----
4142
+
42-
<1> The `route.openshift.io/termination` annotation can be used to configure the `spec.tls.termination` field of the `Route` as `Ingress` has no field for this. The accepted values are `edge`, `passthrough` and `reencrypt`. All other values are silently ignored. When the annotation value is unset, `edge` is the default route. The TLS certificate details must be defined in the template file to implement the default edge route and to prevent producing an insecure route.
43-
<2> When working with an `Ingress` object, you must specify an explicit host name, unlike when working with routes. You can use the `<host_name>.<cluster_ingress_domain>` syntax, for example `apps.openshiftdemos.com`, to take advantage of the `*.<cluster_ingress_domain>` wildcard DNS record and serving certificate for the cluster. Otherwise, you must ensure that there is a DNS record for the chosen hostname.
44-
43+
<1> The `route.openshift.io/termination` annotation can be used to configure the `spec.tls.termination` field of the `Route` as `Ingress` has no field for this. The accepted values are `edge`, `passthrough` and `reencrypt`. All other values are silently ignored. When the annotation value is unset, `edge` is the default route. The TLS certificate details must be defined in the template file to implement the default edge route.
44+
<2> When working with an `Ingress` object, you must specify an explicit hostname, unlike when working with routes. You can use the `<host_name>.<cluster_ingress_domain>` syntax, for example `apps.openshiftdemos.com`, to take advantage of the `*.<cluster_ingress_domain>` wildcard DNS record and serving certificate for the cluster. Otherwise, you must ensure that there is a DNS record for the chosen hostname.
4545

4646
.. If you specify the `passthrough` value in the `route.openshift.io/termination` annotation, set `path` to `''` and `pathType` to `ImplementationSpecific` in the spec:
4747
+
@@ -60,14 +60,17 @@ spec:
6060
port:
6161
number: 443
6262
----
63-
6463
+
6564
[source,terminal]
6665
----
6766
$ oc apply -f ingress.yaml
6867
----
6968
+
69+
<3> The `route.openshift.io/destination-ca-certificate-secret` can be used on an Ingress object to define a route with a custom destination certificate (CA). The annotation references a kubernetes secret, `secret-ca-cert` that will be inserted into the generated route.
7070

71+
.. To specify a route object with a destination CA from an ingress object, you must create a `kubernetes.io/tls` or `Opaque` type secret with a certificate in PEM-encoded format in the `data.tls.crt` specifier of the secret.
72+
73+
+
7174
. List your routes:
7275
+
7376
[source,terminal]
@@ -114,6 +117,10 @@ spec:
114117
[...]
115118
-----END RSA PRIVATE KEY-----
116119
termination: reencrypt
120+
destinationCACertificate: |
121+
-----BEGIN CERTIFICATE-----
122+
[...]
123+
-----END CERTIFICATE-----
117124
to:
118125
kind: Service
119126
name: frontend
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// This is included in the following assemblies:
2+
//
3+
// networking/routes/route-configuration.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="creating-re-encrypt-route-with-custom-certificate_{context}"]
7+
= Creating a route using the destination CA certificate in the Ingress annotation
8+
9+
The `route.openshift.io/destination-ca-certificate-secret` annotation can be used on an Ingress object to define an route with a custom certificate (CA).
10+
11+
.Prerequisites
12+
* You must have a certificate/key pair in PEM-encoded files, where the certificate is valid for the route host.
13+
* You may have a separate CA certificate in a PEM-encoded file that completes the certificate chain.
14+
* You must have a separate destination CA certificate in a PEM-encoded file.
15+
* You must have a service that you want to expose.
16+
17+
18+
.Procedure
19+
20+
. Add the `route.openshift.io/destination-ca-certificate-secret` to the Ingress annotations:
21+
+
22+
[source,yaml]
23+
----
24+
apiVersion: networking.k8s.io/v1
25+
kind: Ingress
26+
metadata:
27+
name: frontend
28+
annotations:
29+
route.openshift.io/termination: "reencrypt"
30+
route.openshift.io/destination-ca-certificate-secret: secret-ca-cert <1>
31+
...
32+
----
33+
<1> The annotation references a kubernetes secret.
34+
35+
+
36+
. The secret referenced in this annotation will be inserted into the generated route.
37+
+
38+
.Example output
39+
[source,yaml]
40+
----
41+
apiVersion: route.openshift.io/v1
42+
kind: Route
43+
metadata:
44+
name: frontend
45+
Annotations:
46+
route.openshift.io/termination: reencrypt
47+
route.openshift.io/destination-ca-certificate-secret: secret-ca-cert
48+
spec:
49+
...
50+
tls:
51+
insecureEdgeTerminationPolicy: Redirect
52+
termination: reencrypt
53+
destinationCACertificate: |
54+
-----BEGIN CERTIFICATE-----
55+
[...]
56+
-----END CERTIFICATE-----
57+
...
58+
----

networking/routes/route-configuration.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ include::modules/nw-route-admission-policy.adoc[leveloffset=+1]
4343

4444
include::modules/nw-ingress-creating-a-route-via-an-ingress.adoc[leveloffset=+1]
4545

46+
include::modules/nw-ingress-reencrypt-route-custom-cert.adoc[leveloffset=+1]
47+
4648
include::modules/nw-router-configuring-dual-stack.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)