You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by le...@apache.org on 2023/09/21 13:49:26 UTC

[tika-helm] branch main updated: support newer ingress apiVersion (#14)

This is an automated email from the ASF dual-hosted git repository.

lewismc pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika-helm.git


The following commit(s) were added to refs/heads/main by this push:
     new 74c41fb  support newer ingress apiVersion (#14)
74c41fb is described below

commit 74c41fbfbc476f2912c19355c4f69aaeb629b987
Author: euven <18...@users.noreply.github.com>
AuthorDate: Fri Sep 22 01:49:20 2023 +1200

    support newer ingress apiVersion (#14)
    
    from K8s version 1.22 you can only access the ingress api via the stable
    'networking.k8s.io/v1' API
---
 templates/ingress.yaml | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/templates/ingress.yaml b/templates/ingress.yaml
index 155e0b3..716fd6d 100644
--- a/templates/ingress.yaml
+++ b/templates/ingress.yaml
@@ -19,7 +19,14 @@
 {{- if .Values.ingress.enabled -}}
 {{- $fullName := include "tika-helm.fullname" . -}}
 {{- $svcPort := .Values.service.port -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
+  {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
+  {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
+  {{- end }}
+{{- end }}
+{{- 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/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
@@ -34,6 +41,9 @@ metadata:
     {{- toYaml . | nindent 4 }}
   {{- end }}
 spec:
+  {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
+  ingressClassName: {{ .Values.ingress.className }}
+  {{- end }}
   {{- if .Values.ingress.tls }}
   tls:
     {{- range .Values.ingress.tls }}
@@ -51,9 +61,19 @@ spec:
         paths:
           {{- range .paths }}
           - path: {{ .path }}
+            {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
+            pathType: {{ .pathType }}
+            {{- end }}
             backend:
+              {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
+              service:
+                name: {{ $fullName }}
+                port:
+                  number: {{ $svcPort }}
+              {{- else }}
               serviceName: {{ $fullName }}
               servicePort: {{ $svcPort }}
+              {{- end }}
           {{- end }}
     {{- end }}
-  {{- end }}
+{{- end }}