From d51fff8d6af39efe2a3abe5d65089b58355e1532 Mon Sep 17 00:00:00 2001 From: pakotvan Date: Mon, 19 Feb 2024 09:40:16 +0100 Subject: [PATCH] Add route for CNAME records for frontend and backend services --- ocp-templates/mpp/backend.yaml | 24 +++++++++++++++++++++++- ocp-templates/mpp/frontend.yaml | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/ocp-templates/mpp/backend.yaml b/ocp-templates/mpp/backend.yaml index d69ff80e..b6cffbfe 100644 --- a/ocp-templates/mpp/backend.yaml +++ b/ocp-templates/mpp/backend.yaml @@ -25,7 +25,7 @@ objects: template: metadata: labels: - app: ibutsu-backend + app: ${APP_NAME} spec: containers: - env: @@ -174,6 +174,24 @@ objects: to: kind: Service name: ibutsu-backend +- apiVersion: route.openshift.io/v1 + kind: Route + metadata: + annotations: + description: A route to the backend + labels: + app: ${APP_NAME} + shard: internal + name: ibutsu-backend + namespace: ${NAMESPACE} + spec: + host: ${BACKEND_ROUTE_CNAME} + tls: + insecureEdgeTerminationPolicy: Redirect + termination: edge + to: + kind: Service + name: ibutsu-backend - kind: Secret apiVersion: v1 metadata: @@ -225,6 +243,10 @@ parameters: displayName: Backend Route description: The URL of the backend of the Ibutsu server value: ibutsu-api.example.com +- name: BACKEND_ROUTE_CNAME + displayName: Backend Route CNAME + description: The CNAME URL of the backend of the Ibutsu server + value: ibutsu-api.prod.com - name: FRONTEND_ROUTE displayName: Frontend Route description: The URL of the frontend of the Ibutsu server diff --git a/ocp-templates/mpp/frontend.yaml b/ocp-templates/mpp/frontend.yaml index 8c7f163e..40689e78 100644 --- a/ocp-templates/mpp/frontend.yaml +++ b/ocp-templates/mpp/frontend.yaml @@ -128,6 +128,25 @@ objects: insecureEdgeTerminationPolicy: Redirect termination: edge wildcardPolicy: None +- kind: Route + apiVersion: route.openshift.io/v1 + metadata: + labels: + app: ${APP_NAME} + shard: internal + name: ibutsu-frontend-cname + namespace: ${NAMESPACE} + annotations: + description: "A route to the frontend" + spec: + host: ${FRONTEND_ROUTE_CNAME} + to: + kind: Service + name: ibutsu-frontend + tls: + insecureEdgeTerminationPolicy: Redirect + termination: edge + wildcardPolicy: None # =============================================== # Parameters # =============================================== @@ -144,6 +163,10 @@ parameters: displayName: Frontend Route description: The URL of the frontend of the Ibutsu server value: ibutsu.example.com +- name: FRONTEND_ROUTE_CNAME + displayName: Frontend Route + description: The CNAME URL of the frontend of the Ibutsu server + value: ibutsu.prod.com - name: BACKEND_ROUTE displayName: Backend Route description: The URL of the backend of the Ibutsu server