From 64e13114aefa84ff91ec3801e717e2397b3b65e3 Mon Sep 17 00:00:00 2001 From: Kiran Saladi Date: Wed, 4 Mar 2026 16:48:51 +0530 Subject: [PATCH] [charts/portal] changes to openshift route from static to dynamic --- charts/portal/Chart.yaml | 2 +- charts/portal/README.md | 3 + charts/portal/templates/ingress/route.yaml | 171 ++++++++++++++++++++- examples/portal/openshift/README.md | 2 +- 4 files changed, 169 insertions(+), 9 deletions(-) diff --git a/charts/portal/Chart.yaml b/charts/portal/Chart.yaml index 7d4328e9..ef4702f6 100644 --- a/charts/portal/Chart.yaml +++ b/charts/portal/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: "5.4.1" description: CA API Developer Portal name: portal -version: 2.3.22 +version: 2.3.23 type: application home: https://github.com/CAAPIM/apim-charts maintainers: diff --git a/charts/portal/README.md b/charts/portal/README.md index 39c70cb9..68270dd1 100644 --- a/charts/portal/README.md +++ b/charts/portal/README.md @@ -6,6 +6,9 @@ This Chart deploys the Layer7 API Developer Portal on a Kubernetes Cluster using ## Release Notes +## 2.3.23 General Updates +- Create dynamic routes in Open-shift environment. + ## 2.3.22 General Updates - This new version of the chart supports API Portal 5.4.1 - Upgrade to 2.3.22 requires chart version 2.3.16 (per Portal compatibility requirements). diff --git a/charts/portal/templates/ingress/route.yaml b/charts/portal/templates/ingress/route.yaml index 2c1c7249..da7ab599 100644 --- a/charts/portal/templates/ingress/route.yaml +++ b/charts/portal/templates/ingress/route.yaml @@ -5,7 +5,20 @@ kind: Route metadata: name: apim-route labels: - router: default + app: {{ template "portal.name" . }} + chart: {{ template "portal.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- range $key, $val := .Values.global.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + {{- range $key, $val := .Values.ingress.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + annotations: + {{- range $key, $val := .Values.ingress.annotations }} + {{ $key }}: "{{ $val }}" + {{- end }} spec: host: {{ include "default-tenant-host" . | quote }} port: @@ -23,7 +36,20 @@ kind: Route metadata: name: pssg-enroll labels: - router: default + app: {{ template "portal.name" . }} + chart: {{ template "portal.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- range $key, $val := .Values.global.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + {{- range $key, $val := .Values.ingress.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + annotations: + {{- range $key, $val := .Values.ingress.annotations }} + {{ $key }}: "{{ $val }}" + {{- end }} spec: host: {{ include "pssg-enroll-host" . | quote }} port: @@ -41,7 +67,20 @@ kind: Route metadata: name: pssg-sync labels: - router: default + app: {{ template "portal.name" . }} + chart: {{ template "portal.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- range $key, $val := .Values.global.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + {{- range $key, $val := .Values.ingress.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + annotations: + {{- range $key, $val := .Values.ingress.annotations }} + {{ $key }}: "{{ $val }}" + {{- end }} spec: host: {{ include "pssg-sync-host" . | quote }} port: @@ -59,7 +98,20 @@ kind: Route metadata: name: apim-route-broker labels: - router: default + app: {{ template "portal.name" . }} + chart: {{ template "portal.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- range $key, $val := .Values.global.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + {{- range $key, $val := .Values.ingress.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + annotations: + {{- range $key, $val := .Values.ingress.annotations }} + {{ $key }}: "{{ $val }}" + {{- end }} spec: host: {{ include "broker-host" . | quote }} port: @@ -77,7 +129,20 @@ kind: Route metadata: name: apim-route-sso labels: - router: default + app: {{ template "portal.name" . }} + chart: {{ template "portal.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- range $key, $val := .Values.global.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + {{- range $key, $val := .Values.ingress.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + annotations: + {{- range $key, $val := .Values.ingress.annotations }} + {{ $key }}: "{{ $val }}" + {{- end }} spec: host: {{ include "pssg-sso-host" . | quote }} port: @@ -95,7 +160,20 @@ kind: Route metadata: name: apim-route-tssg labels: - router: default + app: {{ template "portal.name" . }} + chart: {{ template "portal.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- range $key, $val := .Values.global.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + {{- range $key, $val := .Values.ingress.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + annotations: + {{- range $key, $val := .Values.ingress.annotations }} + {{ $key }}: "{{ $val }}" + {{- end }} spec: host: {{ include "tssg-public-host" . | quote }} port: @@ -113,7 +191,20 @@ kind: Route metadata: name: datalake-analytics labels: - router: default + app: {{ template "portal.name" . }} + chart: {{ template "portal.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- range $key, $val := .Values.global.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + {{- range $key, $val := .Values.ingress.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + annotations: + {{- range $key, $val := .Values.ingress.annotations }} + {{ $key }}: "{{ $val }}" + {{- end }} spec: host: {{ include "analytics-host" . | quote }} port: @@ -125,4 +216,70 @@ spec: name: apim weight: 100 wildcardPolicy: None +{{- range .Values.ingress.customRoutes }} +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: {{ .subdomain }}-route + labels: + app: {{ template "portal.name" $ }} + chart: {{ template "portal.chart" $ }} + release: {{ $.Release.Name }} + heritage: {{ $.Release.Service }} + {{- range $key, $val := $.Values.global.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + {{- range $key, $val := $.Values.ingress.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + annotations: + {{- range $key, $val := $.Values.ingress.annotations }} + {{ $key }}: "{{ $val }}" + {{- end }} +spec: + host: "{{ .subdomain }}.{{ $.Values.portal.domain }}" + port: + targetPort: {{ .service.port }} + tls: + termination: passthrough + to: + kind: Service + name: {{ .service.name }} + weight: 100 + wildcardPolicy: None +{{- end }} +{{- range .Values.ingress.tenantIds }} +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: {{ . }}-route + labels: + app: {{ template "portal.name" $ }} + chart: {{ template "portal.chart" $ }} + release: {{ $.Release.Name }} + heritage: {{ $.Release.Service }} + {{- range $key, $val := $.Values.global.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + {{- range $key, $val := $.Values.ingress.additionalLabels }} + {{ $key }}: "{{ $val }}" + {{- end }} + annotations: + {{- range $key, $val := $.Values.ingress.annotations }} + {{ $key }}: "{{ $val }}" + {{- end }} +spec: + host: "{{ . }}.{{ $.Values.portal.domain }}" + port: + targetPort: portal-https + tls: + termination: passthrough + to: + kind: Service + name: dispatcher + weight: 100 + wildcardPolicy: None +{{- end }} {{- end }} diff --git a/examples/portal/openshift/README.md b/examples/portal/openshift/README.md index 1f3294bd..3a04b16d 100644 --- a/examples/portal/openshift/README.md +++ b/examples/portal/openshift/README.md @@ -56,7 +56,7 @@ $ helm install --set-file "portal.registryCredentials=/path/to 7. [Create a new tenant](https://github.com/CAAPIM/apim-charts/tree/stable/utils) -8. Add new tenant route in Openshift. +8. Add new tenant route in Openshift. This step is required only if tenant is created by not specifying in values.ingress.tenantIds. ``` $ oc process -f new-tenant-route-template.yaml -p TENANT_NAME= -p PORTAL_DOMAIN= | oc apply -f -