Only render ingressClassName when not empty

Signed-off-by: justusbunsi <sk.bunsenbrenner@gmail.com>
This commit is contained in:
justusbunsi 2024-07-21 13:10:01 +02:00
parent 5ec52eaef8
commit 20fca813bc
No known key found for this signature in database
GPG Key ID: 26C8313BA763E7E5
2 changed files with 15 additions and 18 deletions

View File

@ -413,6 +413,20 @@ https
{{- end }}
{{- end -}}
{{- define "ingress.ingressClassName" -}}
{{- if ne .Values.ingress.className "" -}}
# WARNING: 'ingress.className' is deprecated and will be removed in a future release. Use 'ingress.ingressClassName' instead."
{{ end -}}
{{- if and (ne .Values.ingress.className "" ) (ne .Values.ingress.ingressClassName "") -}}
{{- fail "ingress.ingressClassName and ingress.className cannot be defined at the same time. Please only choose one." -}}
{{- end -}}
{{- if ne .Values.ingress.className "" -}}
ingressClassName: {{ tpl .Values.ingress.className . }}
{{- else if ne .Values.ingress.ingressClassName "" -}}
ingressClassName: {{ tpl .Values.ingress.ingressClassName . }}
{{- end -}}
{{- end -}}
{{- define "gitea.admin.passwordMode" -}}
{{- if has .Values.gitea.admin.passwordMode (tuple "keepUpdated" "initialOnlyNoReset" "initialOnlyRequireReset") -}}
{{ .Values.gitea.admin.passwordMode }}
@ -420,15 +434,3 @@ https
{{ printf "gitea.admin.passwordMode must be set to one of 'keepUpdated', 'initialOnlyNoReset', or 'initialOnlyRequireReset'. Received: '%s'" .Values.gitea.admin.passwordMode | fail }}
{{- end -}}
{{- end -}}
{{- /* Deprecations */ -}}
{{- /* 10.4.0 (2024-07) */ -}}
{{- define "deprecations" -}}
{{- if ne .Values.ingress.className "" }}
{{- printf "# WARNING: 'ingress.className' is deprecated and will be removed in a future release. Use 'ingress.ingressClassName' instead.\n" -}}
{{- end -}}
{{- if and (ne .Values.ingress.className "" ) (ne .Values.ingress.ingressClassName "") -}}
{{- fail "ingress.ingressClassName and ingress.className cannot be defined at the same time. Please only choose one." -}}
{{- end -}}
{{- end -}}

View File

@ -1,4 +1,3 @@
{{- include "deprecations" . -}}
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "gitea.fullname" . -}}
{{- $httpPort := .Values.service.http.port -}}
@ -11,11 +10,7 @@ metadata:
{{- include "gitea.labels" . | nindent 4 }}
{{- template "ingress.annotations" . }}
spec:
{{- if ne .Values.ingress.className "" }}
ingressClassName: {{ tpl .Values.ingress.className . }}
{{- else }}
ingressClassName: {{ tpl .Values.ingress.ingressClassName . }}
{{- end }}
{{- include "ingress.ingressClassName" . | nindent 2 }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}