Gitea-HelmChart/templates/gitea/ingress.yaml
joelgallant 33ee018b52 Fixes access of Capabilities variable (#67)
Fixes access of Capabilities variable

Co-authored-by: Joel Gallant <joel@joelgallant.me>
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/67
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: luhahn <luhahn@noreply.gitea.io>
Co-Authored-By: joelgallant <joelgallant@noreply.gitea.io>
Co-Committed-By: joelgallant <joelgallant@noreply.gitea.io>
2020-11-26 01:20:12 +08:00

49 lines
1.3 KiB
YAML

{{- if .Values.ingress.enabled -}}
{{- $fullName := include "gitea.fullname" . -}}
{{- $httpPort := .Values.service.http.port -}}
{{- 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 }}
labels:
{{- include "gitea.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . | quote }}
http:
paths:
- path: /
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $fullName }}-http
port:
number: {{ $httpPort }}
{{- else -}}
serviceName: {{ $fullName }}-http
servicePort: {{ $httpPort }}
{{- end }}
{{- end }}
{{- end }}