diff --git a/elasticsearch/templates/ingress.yaml b/elasticsearch/templates/ingress.yaml index bcb2befa6..481420f50 100644 --- a/elasticsearch/templates/ingress.yaml +++ b/elasticsearch/templates/ingress.yaml @@ -2,7 +2,18 @@ {{- $fullName := include "elasticsearch.uname" . -}} {{- $httpPort := .Values.httpPort -}} {{- $ingressPath := .Values.ingress.path -}} +{{- 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 +{{- end }} kind: Ingress metadata: name: {{ $fullName }} @@ -15,7 +26,10 @@ metadata: {{ toYaml . | indent 4 }} {{- end }} spec: -{{- if .Values.ingress.tls }} + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} tls: {{- if .ingressPath }} {{- range .Values.ingress.tls }} @@ -36,18 +50,38 @@ spec: http: paths: - path: {{ $ingressPath }} + {{- 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: {{ $httpPort }} + {{- else }} serviceName: {{ $fullName }} servicePort: {{ $httpPort }} + {{- end }} {{- else }} - host: {{ .host }} http: 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: {{ .servicePort | default $httpPort }} + {{- else }} serviceName: {{ $fullName }} servicePort: {{ .servicePort | default $httpPort }} + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index cb3ff6d81..720e12d4f 100755 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -239,6 +239,7 @@ tolerations: [] # Only enable this if you have security enabled on your cluster ingress: enabled: false + className: "" annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" @@ -246,6 +247,7 @@ ingress: - host: chart-example.local paths: - path: / + pathType: ImplementationSpecific tls: [] # - secretName: chart-example-tls # hosts: diff --git a/kibana/templates/ingress.yaml b/kibana/templates/ingress.yaml index f79255f30..60960a94f 100644 --- a/kibana/templates/ingress.yaml +++ b/kibana/templates/ingress.yaml @@ -2,7 +2,18 @@ {{- $fullName := include "kibana.fullname" . -}} {{- $httpPort := .Values.httpPort -}} {{- $ingressPath := .Values.ingress.path -}} +{{- 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 +{{- end }} kind: Ingress metadata: name: {{ $fullName }} @@ -12,7 +23,10 @@ metadata: {{ toYaml . | indent 4 }} {{- end }} spec: -{{- if .Values.ingress.tls }} + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} tls: {{- if .ingressPath }} {{- range .Values.ingress.tls }} @@ -33,18 +47,38 @@ spec: http: paths: - path: {{ $ingressPath }} + {{- 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: {{ $httpPort }} + {{- else }} serviceName: {{ $fullName }} servicePort: {{ $httpPort }} + {{- end }} {{- else }} - host: {{ .host }} http: 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: {{ .servicePort | default $httpPort }} + {{- else }} serviceName: {{ $fullName }} servicePort: {{ .servicePort | default $httpPort }} + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/kibana/values.yaml b/kibana/values.yaml index f62775654..e52369c4d 100755 --- a/kibana/values.yaml +++ b/kibana/values.yaml @@ -128,6 +128,7 @@ service: ingress: enabled: false + className: "" annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" @@ -135,6 +136,7 @@ ingress: - host: chart-example.local paths: - path: / + pathType: ImplementationSpecific tls: [] # - secretName: chart-example-tls # hosts: diff --git a/logstash/templates/ingress.yaml b/logstash/templates/ingress.yaml index a4aeb145e..58f4a16e8 100644 --- a/logstash/templates/ingress.yaml +++ b/logstash/templates/ingress.yaml @@ -1,6 +1,17 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "logstash.fullname" . -}} +{{- 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 +{{- end }} kind: Ingress metadata: name: {{ $fullName }} @@ -9,15 +20,18 @@ metadata: chart: "{{ .Chart.Name }}" heritage: {{ .Release.Service | quote }} release: {{ .Release.Name | quote }} -{{- with .Values.ingress.annotations }} + {{- with .Values.ingress.annotations }} annotations: -{{ toYaml . | indent 4 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: -{{- if .Values.ingress.tls }} + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} tls: -{{ toYaml .Values.ingress.tls | indent 4 }} -{{- end }} + {{ toYaml .Values.ingress.tls | nindent 4 }} + {{- end }} rules: {{- range $.Values.ingress.hosts }} - host: {{ .host }} @@ -25,9 +39,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: {{ .servicePort }} + {{- else }} serviceName: {{ $fullName }} servicePort: {{ .servicePort }} + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/logstash/values.yaml b/logstash/values.yaml index cc31b38ac..c451c614b 100755 --- a/logstash/values.yaml +++ b/logstash/values.yaml @@ -270,10 +270,15 @@ service: {} ingress: enabled: false -# annotations: {} -# hosts: -# - host: logstash.local -# paths: -# - path: /logs -# servicePort: 8080 -# tls: [] + className: "" + annotations: {} + hosts: + - host: logstash.local + paths: + - path: /logs + servicePort: 8080 + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local