Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _topic_map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2841,6 +2841,8 @@ Topics:
- Name: Networking
Dir: networking
Topics:
- Name: Mapping a custom domain name to a service
File: serverless-domain-mapping
- Name: Using Service Mesh with OpenShift Serverless
File: serverless-ossm
- Name: Using JSON Web Token authentication with Service Mesh and OpenShift Serverless
Expand Down
46 changes: 46 additions & 0 deletions modules/serverless-create-domain-mapping.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Module included in the following assemblies:
//
// * serverless/networking/serverless-domain-mapping.adoc

[id="serverless-create-domain-mapping_{context}"]
= Creating custom domain mapping for a service

To map a custom domain name to a service you must create a `DomainMapping` custom resource (CR).

.Prerequisites

* The {ServerlessOperatorName} and Knative Serving are installed on your cluster.
* You have created a Knative service and control a custom domain that you want to map to that service.
+
[NOTE]
====
Your custom domain must point to the DNS of the {product-title} cluster.
====

.Procedure

. Create a YAML file containing the `DomainMapping` CR in the same namespace as the Knative service you want to map to:
+
[source,yaml]
----
apiVersion: serving.knative.dev/v1alpha1
kind: DomainMapping
metadata:
name: <domain_name> <1>
namespace: <namespace> <2>
spec:
ref:
name: <service_name> <3>
kind: Service
apiVersion: serving.knative.dev/v1
----
<1> The custom domain name that you want to map to the service.
<2> The namespace of both the `DomainMapping` CR and the Knative service.
<3> The name of the service to map to the custom domain.

. Apply the `DomainMapping` CR as a YAML file:
+
[source,terminal]
----
$ oc apply -f <filename>
----
13 changes: 13 additions & 0 deletions serverless/networking/serverless-domain-mapping.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
include::modules/serverless-document-attributes.adoc[]
[id="serverless-domain-mapping"]
= Mapping a custom domain name to a service
:context: serverless-domain-mapping
include::modules/common-attributes.adoc[]

toc::[]

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

include::modules/serverless-create-domain-mapping.adoc[leveloffset=+1]