Просмотр исходного кода

feat(helm): add support for networking.k8s.io/v1

Alexander Babel 4 лет назад
Родитель
Сommit
ef0bdf641a

+ 1 - 1
deploy/charts/emqx/Chart.yaml

@@ -14,7 +14,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.
-version: 4.3.0
+version: 4.4.0
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application.

+ 2 - 0
deploy/charts/emqx/README.md

@@ -66,11 +66,13 @@ The following table lists the configurable parameters of the emqx chart and thei
 | `service.externalIPs` |	ExternalIPs for the service |	[] |
 | `service.annotations` |	Service annotations |	{}(evaluated as a template)|
 | `ingress.dashboard.enabled` |	Enable ingress for EMQX Dashboard |	false |
+| `ingress.dashboard.ingressClassName` |	Set the ingress class for EMQX Dashboard |	 |
 | `ingress.dashboard.path` | Ingress path for EMQX Dashboard |	/ |
 | `ingress.dashboard.hosts` | Ingress hosts for EMQX Mgmt API |	dashboard.emqx.local |
 | `ingress.dashboard.tls` | Ingress tls for EMQX Mgmt API |	[] |
 | `ingress.dashboard.annotations` | Ingress annotations for EMQX Mgmt API |	{} |
 | `ingress.mgmt.enabled` |	Enable ingress for EMQX Mgmt API |	false |
+| `ingress.dashboard.ingressClassName` |	Set the ingress class for EMQX Mgmt API |	 |
 | `ingress.mgmt.path` | Ingress path for EMQX Mgmt API |	/ |
 | `ingress.mgmt.hosts` | Ingress hosts for EMQX Mgmt API |	api.emqx.local |
 | `ingress.mgmt.tls` | Ingress tls for EMQX Mgmt API |	[] |

+ 29 - 1
deploy/charts/emqx/templates/ingress.yaml

@@ -1,5 +1,7 @@
 {{- if .Values.ingress.dashboard.enabled -}}
-{{- 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/v1beta1
 {{- else -}}
 apiVersion: extensions/v1beta1
@@ -17,15 +19,28 @@ metadata:
     {{- toYaml .Values.ingress.dashboard.annotations | nindent 4 }}
   {{- end }}
 spec:
+{{- if and .Values.ingress.dashboard.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
+  ingressClassName: {{ .Values.ingress.dashboard.ingressClassName }}
+{{- end }}
   rules:
   {{- range $host := .Values.ingress.dashboard.hosts }}
   - host: {{ $host }}
     http:
       paths:
       - path: /
+        {{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
+        pathType: ImplementationSpecific
+        {{- end }}
         backend:
+          {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
+          service:
+            name: {{ include "emqx.fullname" $ }}
+            port:
+              number: {{ $.Values.service.dashboard }}
+          {{- else }}
           serviceName: {{ include "emqx.fullname" $ }}
           servicePort: {{ $.Values.service.dashboard }}
+          {{- end }}
   {{- end -}}
   {{- if .Values.ingress.dashboard.tls }}
   tls:
@@ -52,15 +67,28 @@ metadata:
     {{- toYaml .Values.ingress.mgmt.annotations | nindent 4 }}
   {{- end }}
 spec:
+{{- if and .Values.ingress.mgmt.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
+  ingressClassName: {{ .Values.ingress.mgmt.ingressClassName }}
+{{- end }}
   rules:
   {{- range $host := .Values.ingress.mgmt.hosts }}
   - host: {{ $host }}
     http:
       paths:
       - path: /
+        {{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
+        pathType: ImplementationSpecific
+        {{- end }}
         backend:
+          {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
+          service:
+            name: {{ include "emqx.fullname" $ }}
+            port:
+              number: {{ $.Values.service.mgmt }}
+          {{- else }}
           serviceName: {{ include "emqx.fullname" $ }}
           servicePort: {{ $.Values.service.mgmt }}
+          {{- end }}
   {{- end -}}
   {{- if .Values.ingress.mgmt.tls }}
   tls:

+ 2 - 0
deploy/charts/emqx/values.yaml

@@ -128,6 +128,7 @@ ingress:
   ## ingress for EMQX Dashboard
   dashboard:
     enabled: false
+    # ingressClassName: nginx
     annotations: {}
       # kubernetes.io/ingress.class: nginx
       # kubernetes.io/tls-acme: "true"
@@ -139,6 +140,7 @@ ingress:
   ## ingress for EMQX Mgmt API
   mgmt:
     enabled: false
+    # ingressClassName: nginx
     annotations: {}
       # kubernetes.io/ingress.class: nginx
       # kubernetes.io/tls-acme: "true"