From a5402ea304407067b17f30e92dead9b7beeb9e36 Mon Sep 17 00:00:00 2001 From: Ashleigh Brennan Date: Mon, 15 Feb 2021 12:00:05 -0600 Subject: [PATCH] Domain mapping for ksvcs --- _topic_map.yml | 2 + modules/serverless-create-domain-mapping.adoc | 46 +++++++++++++++++++ .../networking/serverless-domain-mapping.adoc | 13 ++++++ 3 files changed, 61 insertions(+) create mode 100644 modules/serverless-create-domain-mapping.adoc create mode 100644 serverless/networking/serverless-domain-mapping.adoc diff --git a/_topic_map.yml b/_topic_map.yml index 9be26537b2b8..2753970624d8 100644 --- a/_topic_map.yml +++ b/_topic_map.yml @@ -2855,6 +2855,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 diff --git a/modules/serverless-create-domain-mapping.adoc b/modules/serverless-create-domain-mapping.adoc new file mode 100644 index 000000000000..16f625bfa8f8 --- /dev/null +++ b/modules/serverless-create-domain-mapping.adoc @@ -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: <1> + namespace: <2> +spec: + ref: + 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 +---- diff --git a/serverless/networking/serverless-domain-mapping.adoc b/serverless/networking/serverless-domain-mapping.adoc new file mode 100644 index 000000000000..b0c733029622 --- /dev/null +++ b/serverless/networking/serverless-domain-mapping.adoc @@ -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, `..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]