@@ -237,32 +237,19 @@ const defaultIgnore = `# Patterns to ignore when building packages.
237
237
`
238
238
239
239
const defaultIngress = `{{- if .Values.ingress.enabled -}}
240
- {{- $fullName := include "<CHARTNAME>.fullname" . -}}
241
- {{- $svcPort := .Values.service.port -}}
242
- {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
243
- {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
244
- {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
245
- {{- end }}
246
- {{- end }}
247
- {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
248
240
apiVersion: networking.k8s.io/v1
249
- {{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
250
- apiVersion: networking.k8s.io/v1beta1
251
- {{- else -}}
252
- apiVersion: extensions/v1beta1
253
- {{- end }}
254
241
kind: Ingress
255
242
metadata:
256
- name: {{ $fullName }}
243
+ name: {{ include "<CHARTNAME>.fullname" . }}
257
244
labels:
258
245
{{- include "<CHARTNAME>.labels" . | nindent 4 }}
259
246
{{- with .Values.ingress.annotations }}
260
247
annotations:
261
248
{{- toYaml . | nindent 4 }}
262
249
{{- end }}
263
250
spec:
264
- {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
265
- ingressClassName: {{ .Values.ingress.className }}
251
+ {{- with .Values.ingress.className }}
252
+ ingressClassName: {{ . }}
266
253
{{- end }}
267
254
{{- if .Values.ingress.tls }}
268
255
tls:
@@ -281,19 +268,14 @@ spec:
281
268
paths:
282
269
{{- range .paths }}
283
270
- path: {{ .path }}
284
- {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
285
- pathType: {{ .pathType }}
271
+ {{- with .pathType }}
272
+ pathType: {{ . }}
286
273
{{- end }}
287
274
backend:
288
- {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
289
275
service:
290
- name: {{ $fullName }}
276
+ name: {{ include "<CHARTNAME>.fullname" $ }}
291
277
port:
292
- number: {{ $svcPort }}
293
- {{- else }}
294
- serviceName: {{ $fullName }}
295
- servicePort: {{ $svcPort }}
296
- {{- end }}
278
+ number: {{ $.Values.service.port }}
297
279
{{- end }}
298
280
{{- end }}
299
281
{{- end }}
0 commit comments