You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by to...@apache.org on 2022/04/11 09:05:32 UTC

[apisix-helm-chart] branch master updated: feat: update ingress to support apiVersion networking.k8s.io/v1 (#264)

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

tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
     new 8baed82  feat: update ingress to support apiVersion networking.k8s.io/v1 (#264)
8baed82 is described below

commit 8baed82a9a0b5ceac4d76d1d5d27a08c75b6a854
Author: Meelis <44...@users.noreply.github.com>
AuthorDate: Mon Apr 11 12:05:28 2022 +0300

    feat: update ingress to support apiVersion networking.k8s.io/v1 (#264)
    
    Co-authored-by: Meelis Tamm <me...@rangeforce.com>
---
 charts/apisix-dashboard/templates/ingress.yaml | 13 ++++++++++++-
 charts/apisix/templates/ingress.yaml           | 13 ++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/charts/apisix-dashboard/templates/ingress.yaml b/charts/apisix-dashboard/templates/ingress.yaml
index 436acae..59bd942 100644
--- a/charts/apisix-dashboard/templates/ingress.yaml
+++ b/charts/apisix-dashboard/templates/ingress.yaml
@@ -17,7 +17,9 @@
 {{- if .Values.ingress.enabled -}}
 {{- $fullName := include "apisix-dashboard.fullname" . -}}
 {{- $svcPort := .Values.service.port -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }}
+{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
+apiVersion: networking.k8s.io/v1
+{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.Version }}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
@@ -53,9 +55,18 @@ spec:
         paths:
           {{- range .paths }}
           - path: {{ . }}
+            {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.Version }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}
+                port:
+                  number:  {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}
               servicePort: {{ $svcPort }}
+            {{- end }}
           {{- end }}
     {{- end }}
   {{- end }}
diff --git a/charts/apisix/templates/ingress.yaml b/charts/apisix/templates/ingress.yaml
index b9220cc..1158f88 100644
--- a/charts/apisix/templates/ingress.yaml
+++ b/charts/apisix/templates/ingress.yaml
@@ -17,7 +17,9 @@
 {{- if (and .Values.apisix.enabled .Values.gateway.ingress.enabled) -}}
 {{- $fullName := include "apisix.fullname" . -}}
 {{- $svcPort := .Values.gateway.http.servicePort -}}
-{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }}
+{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
+apiVersion: networking.k8s.io/v1
+{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.Version }}
 apiVersion: networking.k8s.io/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
@@ -49,9 +51,18 @@ spec:
         paths:
           {{- range .paths }}
           - path: {{ . }}
+            {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.Version }}
+            pathType: ImplementationSpecific
+            backend:
+              service:
+                name: {{ $fullName }}-gateway
+                port:
+                  number:  {{ $svcPort }}
+            {{- else -}}
             backend:
               serviceName: {{ $fullName }}-gateway
               servicePort: {{ $svcPort }}
+            {{- end }}
           {{- end }}
     {{- end }}
   {{- end }}