From 474a4e44be2b4a8128f22e0ecc7a7549f193531f Mon Sep 17 00:00:00 2001
From: groundhog2k <10630407+groundhog2k@users.noreply.github.com>
Date: Tue, 13 Apr 2021 17:08:53 +0200
Subject: [PATCH] Updated ingress deployment to use API networking.k8s.io/v1
 for Kubernetes >= 1.19 (#354)

* Draft: for issue 312

* Adapted ingress for wordpress and nextcloud - fixed semver compare

* Fixed version comparision

* Fixed semVer version comparison
---
 charts/commento/Chart.yaml                  |  2 +-
 charts/commento/README.md                   |  2 +-
 charts/commento/templates/ingress.yaml      | 16 ++++++++++-
 charts/elasticsearch/Chart.yaml             |  2 +-
 charts/elasticsearch/README.md              |  2 +-
 charts/elasticsearch/templates/ingress.yaml | 16 ++++++++++-
 charts/ghost/Chart.yaml                     |  2 +-
 charts/ghost/README.md                      |  2 +-
 charts/ghost/templates/ingress.yaml         | 16 ++++++++++-
 charts/gitea/Chart.yaml                     |  2 +-
 charts/gitea/README.md                      |  2 +-
 charts/gitea/templates/ingress.yaml         | 16 ++++++++++-
 charts/graylog/Chart.yaml                   |  2 +-
 charts/graylog/README.md                    |  2 +-
 charts/graylog/templates/ingress.yaml       | 16 ++++++++++-
 charts/nextcloud/Chart.yaml                 |  2 +-
 charts/nextcloud/README.md                  |  2 +-
 charts/nextcloud/templates/ingress.yaml     | 31 +++++++++++++++++++--
 charts/rabbitmq/Chart.yaml                  |  2 +-
 charts/rabbitmq/README.md                   |  2 +-
 charts/rabbitmq/templates/ingress.yaml      | 16 ++++++++++-
 charts/wordpress/Chart.yaml                 |  2 +-
 charts/wordpress/README.md                  |  2 +-
 charts/wordpress/templates/ingress.yaml     | 16 ++++++++++-
 24 files changed, 150 insertions(+), 25 deletions(-)

diff --git a/charts/commento/Chart.yaml b/charts/commento/Chart.yaml
index f7a49dc7..c7db1b65 100644
--- a/charts/commento/Chart.yaml
+++ b/charts/commento/Chart.yaml
@@ -7,7 +7,7 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.1.12
+version: 0.1.13
 
 appVersion: "v1.8.0"
 
diff --git a/charts/commento/README.md b/charts/commento/README.md
index 2788daac..5dd172da 100644
--- a/charts/commento/README.md
+++ b/charts/commento/README.md
@@ -1,6 +1,6 @@
 # Commento
 
-![Version: 0.1.12](https://img.shields.io/badge/Version-0.1.12-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.8.0](https://img.shields.io/badge/AppVersion-v1.8.0-informational?style=flat-square)
+![Version: 0.1.13](https://img.shields.io/badge/Version-0.1.13-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.8.0](https://img.shields.io/badge/AppVersion-v1.8.0-informational?style=flat-square)
 
 A Helm chart for Commento on Kubernetes
 
diff --git a/charts/commento/templates/ingress.yaml b/charts/commento/templates/ingress.yaml
index 073c02f7..d3d70aaf 100644
--- a/charts/commento/templates/ingress.yaml
+++ b/charts/commento/templates/ingress.yaml
@@ -1,11 +1,16 @@
 {{- if .Values.ingress.enabled -}}
 {{- $fullName := include "commento.fullname" . -}}
 {{- $svcPort := .Values.service.port -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- $kubeVersion := .Capabilities.KubeVersion.Version -}}
+{{- if semverCompare ">=1.19" $kubeVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else -}}
+{{- if semverCompare ">=1.14" $kubeVersion -}}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
 {{- end }}
+{{- end }}
 kind: Ingress
 metadata:
   name: {{ $fullName }}
@@ -27,7 +32,16 @@ spec:
       http:
         paths:
           - path: /
+            {{- if semverCompare ">=1.19" $kubeVersion }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}
+                port:
+                  number: {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}
               servicePort: {{ $svcPort }}
+            {{- end }}
   {{- end }}
diff --git a/charts/elasticsearch/Chart.yaml b/charts/elasticsearch/Chart.yaml
index aeefe2d3..2a36c0d7 100644
--- a/charts/elasticsearch/Chart.yaml
+++ b/charts/elasticsearch/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.2.0
+version: 0.2.1
 
 appVersion: 7.12.0
diff --git a/charts/elasticsearch/README.md b/charts/elasticsearch/README.md
index 938ea2cd..c1df0985 100644
--- a/charts/elasticsearch/README.md
+++ b/charts/elasticsearch/README.md
@@ -1,6 +1,6 @@
 # Elasticsearch
 
-![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 7.12.0](https://img.shields.io/badge/AppVersion-7.12.0-informational?style=flat-square)
+![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 7.12.0](https://img.shields.io/badge/AppVersion-7.12.0-informational?style=flat-square)
 
 A Helm chart for Elasticsearch on Kubernetes
 
diff --git a/charts/elasticsearch/templates/ingress.yaml b/charts/elasticsearch/templates/ingress.yaml
index 4f345c0b..efd9dac5 100644
--- a/charts/elasticsearch/templates/ingress.yaml
+++ b/charts/elasticsearch/templates/ingress.yaml
@@ -1,11 +1,16 @@
 {{- if .Values.ingress.enabled -}}
 {{- $fullName := include "elasticsearch.fullname" . -}}
 {{- $svcPort := .Values.service.httpPort -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- $kubeVersion := .Capabilities.KubeVersion.Version -}}
+{{- if semverCompare ">=1.19" $kubeVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else -}}
+{{- if semverCompare ">=1.14" $kubeVersion -}}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
 {{- end }}
+{{- end }}
 kind: Ingress
 metadata:
   name: {{ $fullName }}
@@ -33,9 +38,18 @@ spec:
         paths:
           {{- range .paths }}
           - path: {{ . }}
+            {{- if semverCompare ">=1.19" $kubeVersion }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}
+                port:
+                  number: {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}
               servicePort: {{ $svcPort }}
+            {{- end }}
           {{- end }}
     {{- end }}
   {{- end }}
diff --git a/charts/ghost/Chart.yaml b/charts/ghost/Chart.yaml
index 10ec60ee..f75827dd 100644
--- a/charts/ghost/Chart.yaml
+++ b/charts/ghost/Chart.yaml
@@ -7,7 +7,7 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.5.0
+version: 0.5.1
 
 appVersion: "4.2.0"
 
diff --git a/charts/ghost/README.md b/charts/ghost/README.md
index 9b751889..09a1c5dc 100644
--- a/charts/ghost/README.md
+++ b/charts/ghost/README.md
@@ -1,6 +1,6 @@
 # Ghost
 
-![Version: 0.5.0](https://img.shields.io/badge/Version-0.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.2.0](https://img.shields.io/badge/AppVersion-4.2.0-informational?style=flat-square)
+![Version: 0.5.1](https://img.shields.io/badge/Version-0.5.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.2.0](https://img.shields.io/badge/AppVersion-4.2.0-informational?style=flat-square)
 
 A Helm chart for Ghost blog on Kubernetes
 
diff --git a/charts/ghost/templates/ingress.yaml b/charts/ghost/templates/ingress.yaml
index 3cb02548..0fddae23 100644
--- a/charts/ghost/templates/ingress.yaml
+++ b/charts/ghost/templates/ingress.yaml
@@ -2,11 +2,16 @@
 {{- $fullName := include "ghost.fullname" . -}}
 {{- $svcPort := .Values.service.port -}}
 {{- $maxSize := .Values.ingress.maxBodySize -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- $kubeVersion := .Capabilities.KubeVersion.Version -}}
+{{- if semverCompare ">=1.19" $kubeVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else -}}
+{{- if semverCompare ">=1.14" $kubeVersion -}}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
 {{- end }}
+{{- end }}
 kind: Ingress
 metadata:
   name: {{ $fullName }}
@@ -35,9 +40,18 @@ spec:
         paths:
           {{- range .paths }}
           - path: {{ . }}
+            {{- if semverCompare ">=1.19" $kubeVersion }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}
+                port:
+                  number: {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}
               servicePort: {{ $svcPort }}
+            {{- end }}
           {{- end }}
     {{- end }}
   {{- end }}
diff --git a/charts/gitea/Chart.yaml b/charts/gitea/Chart.yaml
index 71e83574..a93f0253 100644
--- a/charts/gitea/Chart.yaml
+++ b/charts/gitea/Chart.yaml
@@ -8,7 +8,7 @@ maintainers:
   - name: groundhog2k
 
 # This is the chart version
-version: 0.3.2
+version: 0.3.3
 
 # This is the version number of the application being deployed.
 appVersion: "1.14.0"
diff --git a/charts/gitea/README.md b/charts/gitea/README.md
index dd2e1d3d..1d3d27df 100644
--- a/charts/gitea/README.md
+++ b/charts/gitea/README.md
@@ -1,6 +1,6 @@
 #  Gitea
 
-![Version: 0.3.2](https://img.shields.io/badge/Version-0.3.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.14.0](https://img.shields.io/badge/AppVersion-1.14.0-informational?style=flat-square)
+![Version: 0.3.3](https://img.shields.io/badge/Version-0.3.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.14.0](https://img.shields.io/badge/AppVersion-1.14.0-informational?style=flat-square)
 
 A Helm chart for Gitea on Kubernetes
 
diff --git a/charts/gitea/templates/ingress.yaml b/charts/gitea/templates/ingress.yaml
index d995aebf..ceb32de9 100644
--- a/charts/gitea/templates/ingress.yaml
+++ b/charts/gitea/templates/ingress.yaml
@@ -2,11 +2,16 @@
 {{- $fullName := include "gitea.fullname" . -}}
 {{- $svcPort := .Values.services.http.port -}}
 {{- $maxSize := .Values.ingress.maxBodySize -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- $kubeVersion := .Capabilities.KubeVersion.Version -}}
+{{- if semverCompare ">=1.19" $kubeVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else -}}
+{{- if semverCompare ">=1.14" $kubeVersion -}}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
 {{- end }}
+{{- end }}
 kind: Ingress
 metadata:
   name: {{ $fullName }}
@@ -35,9 +40,18 @@ spec:
         paths:
           {{- range .paths }}
           - path: {{ . }}
+            {{- if semverCompare ">=1.19" $kubeVersion }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}-http
+                port:
+                  number: {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}-http
               servicePort: {{ $svcPort }}
+            {{- end }}
           {{- end }}
     {{- end }}
   {{- end }}
diff --git a/charts/graylog/Chart.yaml b/charts/graylog/Chart.yaml
index 7e3ac972..985c655c 100644
--- a/charts/graylog/Chart.yaml
+++ b/charts/graylog/Chart.yaml
@@ -7,7 +7,7 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.1.13
+version: 0.1.14
 
 appVersion: "4.0.6"
 
diff --git a/charts/graylog/README.md b/charts/graylog/README.md
index 77519fcc..e36bb9f2 100644
--- a/charts/graylog/README.md
+++ b/charts/graylog/README.md
@@ -1,6 +1,6 @@
 # Graylog
 
-![Version: 0.1.13](https://img.shields.io/badge/Version-0.1.13-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.0.6](https://img.shields.io/badge/AppVersion-4.0.6-informational?style=flat-square)
+![Version: 0.1.14](https://img.shields.io/badge/Version-0.1.14-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.0.6](https://img.shields.io/badge/AppVersion-4.0.6-informational?style=flat-square)
 
 A Helm chart for Graylog on Kubernetes
 
diff --git a/charts/graylog/templates/ingress.yaml b/charts/graylog/templates/ingress.yaml
index 0641f690..216aa9a0 100644
--- a/charts/graylog/templates/ingress.yaml
+++ b/charts/graylog/templates/ingress.yaml
@@ -1,11 +1,16 @@
 {{- if .Values.ingress.enabled -}}
 {{- $fullName := include "graylog.fullname" . -}}
 {{- $svcPort := .Values.service.port -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- $kubeVersion := .Capabilities.KubeVersion.Version -}}
+{{- if semverCompare ">=1.19" $kubeVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else -}}
+{{- if semverCompare ">=1.14" $kubeVersion -}}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
 {{- end }}
+{{- end }}
 kind: Ingress
 metadata:
   name: {{ $fullName }}
@@ -33,9 +38,18 @@ spec:
         paths:
           {{- range .paths }}
           - path: {{ . }}
+            {{- if semverCompare ">=1.19" $kubeVersion }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}
+                port:
+                  number: {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}
               servicePort: {{ $svcPort }}
+            {{- end }}
           {{- end }}
     {{- end }}
   {{- end }}
diff --git a/charts/nextcloud/Chart.yaml b/charts/nextcloud/Chart.yaml
index a925678b..213d5717 100644
--- a/charts/nextcloud/Chart.yaml
+++ b/charts/nextcloud/Chart.yaml
@@ -8,7 +8,7 @@ maintainers:
   - name: groundhog2k
 
 # This is the chart version.
-version: 0.5.1
+version: 0.5.2
 
 # This is the version number of the application being deployed.
 appVersion: "21.0.1-apache"
diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md
index 1ce5af37..04c15f5e 100644
--- a/charts/nextcloud/README.md
+++ b/charts/nextcloud/README.md
@@ -1,6 +1,6 @@
 #  Nextcloud
 
-![Version: 0.5.1](https://img.shields.io/badge/Version-0.5.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 21.0.1-apache](https://img.shields.io/badge/AppVersion-21.0.1-informational?style=flat-square)
+![Version: 0.5.2](https://img.shields.io/badge/Version-0.5.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 21.0.1-apache](https://img.shields.io/badge/AppVersion-21.0.1-informational?style=flat-square)
 
 A Helm chart for Nextcloud on Kubernetes
 
diff --git a/charts/nextcloud/templates/ingress.yaml b/charts/nextcloud/templates/ingress.yaml
index 42835ee5..e51ee17f 100644
--- a/charts/nextcloud/templates/ingress.yaml
+++ b/charts/nextcloud/templates/ingress.yaml
@@ -3,11 +3,16 @@
 {{- $svcPort := .Values.service.port -}}
 {{- $maxSize := .Values.ingress.maxBodySize -}}
 {{- $webroot := .Values.settings.overwriteWebRoot -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- $kubeVersion := .Capabilities.KubeVersion.Version -}}
+{{- if semverCompare ">=1.19" $kubeVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else -}}
+{{- if semverCompare ">=1.14" $kubeVersion -}}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
 {{- end }}
+{{- end }}
 kind: Ingress
 metadata:
   name: {{ $fullName }}
@@ -42,18 +47,31 @@ spec:
           {{- else }}
           - path: /
           {{- end }}
+            {{- if semverCompare ">=1.19" $kubeVersion }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}
+                port:
+                  number: {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}
               servicePort: {{ $svcPort }}
+            {{- end }}
     {{- end }}
 
 ---
 
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- if semverCompare ">=1.19" $kubeVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else -}}
+{{- if semverCompare ">=1.14" $kubeVersion -}}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
 {{- end }}
+{{- end }}
 kind: Ingress
 metadata:
   name: {{ $fullName }}-dav
@@ -82,8 +100,17 @@ spec:
           {{- else }}
           - path: /.well-known/ca(l|rd)dav(/|.*)
           {{- end }}
+            {{- if semverCompare ">=1.19" $kubeVersion }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}
+                port:
+                  number: {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}
               servicePort: {{ $svcPort }}
+            {{- end }}
     {{- end }}
 {{- end }}
diff --git a/charts/rabbitmq/Chart.yaml b/charts/rabbitmq/Chart.yaml
index 90bfea29..1140c8d4 100644
--- a/charts/rabbitmq/Chart.yaml
+++ b/charts/rabbitmq/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.2.12
+version: 0.2.13
 
 appVersion: "3.8.14"
diff --git a/charts/rabbitmq/README.md b/charts/rabbitmq/README.md
index 38a55a78..9e8e2f78 100644
--- a/charts/rabbitmq/README.md
+++ b/charts/rabbitmq/README.md
@@ -1,6 +1,6 @@
 # RabbitMQ
 
-![Version: 0.2.12](https://img.shields.io/badge/Version-0.2.12-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.8.14](https://img.shields.io/badge/AppVersion-3.8.14-informational?style=flat-square)
+![Version: 0.2.13](https://img.shields.io/badge/Version-0.2.13-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.8.14](https://img.shields.io/badge/AppVersion-3.8.14-informational?style=flat-square)
 
 A Helm chart for a RabbitMQ cluster on Kubernetes
 
diff --git a/charts/rabbitmq/templates/ingress.yaml b/charts/rabbitmq/templates/ingress.yaml
index 8e368ccf..afece075 100644
--- a/charts/rabbitmq/templates/ingress.yaml
+++ b/charts/rabbitmq/templates/ingress.yaml
@@ -1,11 +1,16 @@
 {{- if .Values.ingress.enabled -}}
 {{- $fullName := include "rabbitmq.fullname" . -}}
 {{- $svcPort := .Values.service.mgmt.port -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- $kubeVersion := .Capabilities.KubeVersion.Version -}}
+{{- if semverCompare ">=1.19" $kubeVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else -}}
+{{- if semverCompare ">=1.14" $kubeVersion -}}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
 {{- end }}
+{{- end }}
 kind: Ingress
 metadata:
   name: {{ $fullName }}
@@ -33,9 +38,18 @@ spec:
         paths:
           {{- range .paths }}
           - path: {{ . }}
+            {{- if semverCompare ">=1.19" $kubeVersion }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}
+                port:
+                  number: {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}
               servicePort: {{ $svcPort }}
+            {{- end }}
           {{- end }}
     {{- end }}
   {{- end }}
diff --git a/charts/wordpress/Chart.yaml b/charts/wordpress/Chart.yaml
index b0251709..a9d7282d 100644
--- a/charts/wordpress/Chart.yaml
+++ b/charts/wordpress/Chart.yaml
@@ -8,7 +8,7 @@ maintainers:
 type: application
 
 # This is the chart version.
-version: 0.3.0
+version: 0.3.1
 
 # This is the version number of the application being deployed.
 appVersion: "5.7.0-apache"
diff --git a/charts/wordpress/README.md b/charts/wordpress/README.md
index 00a06623..f2aab75c 100644
--- a/charts/wordpress/README.md
+++ b/charts/wordpress/README.md
@@ -1,6 +1,6 @@
 #  Wordpress
 
-![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 5.7.0-apache](https://img.shields.io/badge/AppVersion-5.7.0-informational?style=flat-square)
+![Version: 0.3.1](https://img.shields.io/badge/Version-0.3.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 5.7.0-apache](https://img.shields.io/badge/AppVersion-5.7.0-informational?style=flat-square)
 
 A Helm chart for Wordpress on Kubernetes
 
diff --git a/charts/wordpress/templates/ingress.yaml b/charts/wordpress/templates/ingress.yaml
index 1e1fa299..5a7f165b 100644
--- a/charts/wordpress/templates/ingress.yaml
+++ b/charts/wordpress/templates/ingress.yaml
@@ -2,11 +2,16 @@
 {{- $fullName := include "wordpress.fullname" . -}}
 {{- $svcPort := .Values.service.port -}}
 {{- $maxSize := .Values.ingress.maxBodySize -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+{{- $kubeVersion := .Capabilities.KubeVersion.Version -}}
+{{- if semverCompare ">=1.19" $kubeVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else -}}
+{{- if semverCompare ">=1.14" $kubeVersion -}}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
 {{- end }}
+{{- end }}
 kind: Ingress
 metadata:
   name: {{ $fullName }}
@@ -35,9 +40,18 @@ spec:
         paths:
           {{- range .paths }}
           - path: {{ . }}
+            {{- if semverCompare ">=1.19" $kubeVersion }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}
+                port:
+                  number: {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}
               servicePort: {{ $svcPort }}
+            {{- end }}
           {{- end }}
     {{- end }}
   {{- end }}
-- 
GitLab