From 6b5919018ebfde164e9b78e478e71be468b7d431 Mon Sep 17 00:00:00 2001
From: Bernhard Mallinger <bernhard.mallinger@eox.at>
Date: Mon, 8 Mar 2021 15:40:49 +0100
Subject: [PATCH] Ensure compatiblity with production cluster (k8s 1.18)

---
 chart/Chart.yaml             |  2 +-
 chart/templates/ingress.yaml | 30 +++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/chart/Chart.yaml b/chart/Chart.yaml
index 08219b0c..6bc53296 100644
--- a/chart/Chart.yaml
+++ b/chart/Chart.yaml
@@ -7,7 +7,7 @@ type: application
 # This is the chart version. This version number should be incremented each time you make changes
 # to the chart and its templates, including the app version.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.3.19
+version: 0.3.21
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application.
diff --git a/chart/templates/ingress.yaml b/chart/templates/ingress.yaml
index d4023f60..86544169 100644
--- a/chart/templates/ingress.yaml
+++ b/chart/templates/ingress.yaml
@@ -1,7 +1,9 @@
 {{- $fullName := include "vs.fullname" . -}}
 {{- $svcPort := .Values.service.port -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
 apiVersion: networking.k8s.io/v1
+{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+apiVersion: networking.k8s.io/v1beta
 {{- else -}}
 apiVersion: extensions/v1
 {{- end }}
@@ -28,6 +30,7 @@ spec:
   {{- end }}
   rules:
     {{- range .Values.ingress.hosts }}
+    {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
     - host: {{ .host | quote }}
       http:
         paths:
@@ -66,4 +69,29 @@ spec:
               name: {{ $fullName }}-client
               port: 
                 number: 80             
+    {{- else -}}
+    - host: {{ .host | quote }}
+      http:
+          paths:
+              - path: /(ows.*)
+                backend:
+                    serviceName: {{ $fullName }}-renderer
+                    servicePort: http
+              - path: /(opensearch.*)
+                backend:
+                    serviceName: {{ $fullName }}-renderer
+                    servicePort: http
+              - path: /(admin.*)
+                backend:
+                    serviceName: {{ $fullName }}-renderer
+                    servicePort: http
+              - path: /cache/(.*)
+                backend:
+                    serviceName: {{ $fullName }}-cache
+                    servicePort: http
+              - path: /(.*)
+                backend:
+                    serviceName: {{ $fullName }}-client
+                    servicePort: http
+    {{- end -}}
     {{- end }}
-- 
GitLab