This is an automated email from the ASF dual-hosted git repository.
zhangjintao 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 0198cab feat: Customizable ingressClassName for gateway (#345)
0198cab is described below
commit 0198cabdb43d185a8d07a75c391703bebac4b4ee
Author: Ćukasz Biegaj <[email protected]>
AuthorDate: Fri Sep 30 04:03:10 2022 +0200
feat: Customizable ingressClassName for gateway (#345)
Co-authored-by: Alex Zhang <[email protected]>
Co-authored-by: Jintao Zhang <[email protected]>
---
charts/apisix/README.md | 2 ++
charts/apisix/templates/ingress.yaml | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/charts/apisix/README.md b/charts/apisix/README.md
index 8a0a0b3..41a0ae7 100644
--- a/charts/apisix/README.md
+++ b/charts/apisix/README.md
@@ -96,6 +96,8 @@ Apache APISIX service parameters, this determines how users
can access itself.
| `gateway.tls.sslProtocols` | TLS protocols allowed to use. | `"TLSv1.2
TLSv1.3"` |
| `gateway.stream` | Apache APISIX service settings for stream
| |
| `gateway.ingress` | Using ingress access Apache APISIX service
| |
+| `gateway.ingress.annotations` | Ingress annotations
| `[]` |
+| `gateway.ingress.className` | `ingressClassName` replaces `annotations
kubernetes.io/ingress.class`, required Kubernetes `>=1.18`
| |
### admin parameters
diff --git a/charts/apisix/templates/ingress.yaml
b/charts/apisix/templates/ingress.yaml
index 1158f88..5cd55de 100644
--- a/charts/apisix/templates/ingress.yaml
+++ b/charts/apisix/templates/ingress.yaml
@@ -17,6 +17,11 @@
{{- if (and .Values.apisix.enabled .Values.gateway.ingress.enabled) -}}
{{- $fullName := include "apisix.fullname" . -}}
{{- $svcPort := .Values.gateway.http.servicePort -}}
+{{- if and .Values.gateway.ingress.className (not (semverCompare ">=1.18-0"
.Capabilities.KubeVersion.GitVersion)) }}
+ {{- if not (hasKey .Values.gateway.ingress.annotations
"kubernetes.io/ingress.class") }}
+ {{- $_ := set .Values.gateway.ingress.annotations
"kubernetes.io/ingress.class" .Values.gateway.ingress.className}}
+ {{- end }}
+{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.Version }}
@@ -34,6 +39,9 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
+ {{- if and .Values.gateway.ingress.className (semverCompare ">=1.18-0"
.Capabilities.KubeVersion.GitVersion) }}
+ ingressClassName: {{ .Values.gateway.ingress.className }}
+ {{- end }}
{{- if .Values.gateway.ingress.tls }}
tls:
{{- range .Values.gateway.ingress.tls }}