Skip to content

Commit f9ba3c5

Browse files
committed
ref(create): drop old Kubernetes versions support in Ingress template
Signed-off-by: Denis Krivenko <[email protected]> Signed-off-by: dnskr <[email protected]>
1 parent a958f3a commit f9ba3c5

File tree

1 file changed

+7
-25
lines changed

1 file changed

+7
-25
lines changed

pkg/chartutil/create.go

+7-25
Original file line numberDiff line numberDiff line change
@@ -237,32 +237,19 @@ const defaultIgnore = `# Patterns to ignore when building packages.
237237
`
238238

239239
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 -}}
248240
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 }}
254241
kind: Ingress
255242
metadata:
256-
name: {{ $fullName }}
243+
name: {{ include "<CHARTNAME>.fullname" . }}
257244
labels:
258245
{{- include "<CHARTNAME>.labels" . | nindent 4 }}
259246
{{- with .Values.ingress.annotations }}
260247
annotations:
261248
{{- toYaml . | nindent 4 }}
262249
{{- end }}
263250
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: {{ . }}
266253
{{- end }}
267254
{{- if .Values.ingress.tls }}
268255
tls:
@@ -281,19 +268,14 @@ spec:
281268
paths:
282269
{{- range .paths }}
283270
- path: {{ .path }}
284-
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
285-
pathType: {{ .pathType }}
271+
{{- with .pathType }}
272+
pathType: {{ . }}
286273
{{- end }}
287274
backend:
288-
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
289275
service:
290-
name: {{ $fullName }}
276+
name: {{ include "<CHARTNAME>.fullname" $ }}
291277
port:
292-
number: {{ $svcPort }}
293-
{{- else }}
294-
serviceName: {{ $fullName }}
295-
servicePort: {{ $svcPort }}
296-
{{- end }}
278+
number: {{ $.Values.service.port }}
297279
{{- end }}
298280
{{- end }}
299281
{{- end }}

0 commit comments

Comments
 (0)