From 85d09c53cd14b85e61bd0e6548af50fe43ecc28a Mon Sep 17 00:00:00 2001 From: Jan Zickermann <jan.zickermann@dataport.de> Date: Mon, 13 Jan 2025 13:16:24 +0100 Subject: [PATCH] OZG-7121 helm: Improve route --- src/main/helm/templates/route.yaml | 8 ++--- src/main/helm/values.yaml | 4 +++ src/test/helm/certificate_test.yaml | 1 + src/test/helm/route_test.yaml | 52 +++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 src/test/helm/route_test.yaml diff --git a/src/main/helm/templates/route.yaml b/src/main/helm/templates/route.yaml index 0f86471..3990bd3 100644 --- a/src/main/helm/templates/route.yaml +++ b/src/main/helm/templates/route.yaml @@ -2,13 +2,13 @@ kind: Route apiVersion: route.openshift.io/v1 metadata: name: {{ .Release.Name }}-passthrough - namespace: by-enable-dev + namespace: {{ include "app.namespace" . }} spec: host: {{ .Release.Name }}-passthrough-{{ include "app.baseDomain" . }} to: kind: Service - name: xta-test-server + name: {{ .Release.Name }} weight: 100 port: targetPort: 8443 @@ -18,6 +18,6 @@ spec: status: ingress: - host: {{ .Release.Name }}-passthrough-{{ include "app.baseDomain" . }} - routerName: default + routerName: {{ .Values.router.name }} wildcardPolicy: None - routerCanonicalHostname: router-default.apps.okd.dev.by.ozg-cloud.systems + routerCanonicalHostname: {{ .Values.router.hostname }} diff --git a/src/main/helm/values.yaml b/src/main/helm/values.yaml index 9fe80af..c1c3624 100644 --- a/src/main/helm/values.yaml +++ b/src/main/helm/values.yaml @@ -29,6 +29,10 @@ image: name: xta-test-server tag: latest +router: + name: default + hostname: router-default.apps.okd.dev.by.ozg-cloud.systems + clientCertificateCommonNames: - clientA - clientB diff --git a/src/test/helm/certificate_test.yaml b/src/test/helm/certificate_test.yaml index cf78c77..a5de4a8 100644 --- a/src/test/helm/certificate_test.yaml +++ b/src/test/helm/certificate_test.yaml @@ -63,6 +63,7 @@ tests: - equal: path: spec.dnsNames value: + - "xta-test-server-release-name-passthrough-helm.test.by.ozg-cloud.de" - "xta-test-server-release-name-helm.test.by.ozg-cloud.de" - it: should contain default lables and component lables asserts: diff --git a/src/test/helm/route_test.yaml b/src/test/helm/route_test.yaml new file mode 100644 index 0000000..f1d4859 --- /dev/null +++ b/src/test/helm/route_test.yaml @@ -0,0 +1,52 @@ +suite: test route.yaml +release: + name: releasename + namespace: sh-helm-test +templates: + - templates/route.yaml +set: + ozgcloud: + bezeichner: helm + baseUrl: test.by.ozg-cloud.de + +tests: + - it: check route kind + asserts: + - isKind: + of: Route + - it: should set passthrough hostname + asserts: + - equal: + path: spec.host + value: releasename-passthrough-helm.test.by.ozg-cloud.de + - it: should set service name + asserts: + - equal: + path: spec.to.name + value: releasename + - it: should set target port + asserts: + - equal: + path: spec.port.targetPort + value: 8443 + - it: should set passthrough tls termination + asserts: + - equal: + path: spec.tls.termination + value: passthrough + + - it: should set ingress passthrough hostname + asserts: + - equal: + path: status.ingress[0].host + value: releasename-passthrough-helm.test.by.ozg-cloud.de + - it: should set router name + asserts: + - equal: + path: status.ingress[0].routerName + value: default + - it: should set router hostname + asserts: + - equal: + path: status.ingress[0].routerCanonicalHostname + value: router-default.apps.okd.dev.by.ozg-cloud.systems -- GitLab