{{- if .Values.ingress.enabled -}} {{- $fullName := include "gitea.fullname" . -}} {{- $httpPort := .Values.service.http.port -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: {{ $fullName }} namespace: {{ .Values.namespace | default .Release.Namespace }} labels: {{- include "gitea.labels" . | nindent 4 }} annotations: {{- range $key, $value := .Values.ingress.annotations }} {{ $key }}: {{ $value | quote }} {{- end }} spec: {{- if .Values.ingress.className }} ingressClassName: {{ tpl .Values.ingress.className . }} {{- else if .Values.ingress.ingressClassName }} ingressClassName: {{ tpl .Values.ingress.ingressClassName . }} {{- end }} {{- if .Values.ingress.tls }} tls: {{- range .Values.ingress.tls }} - hosts: {{- range .hosts }} - {{ tpl . $ | quote }} {{- end }} secretName: {{ .secretName }} {{- end }} {{- end }} rules: {{- range .Values.ingress.hosts }} - host: {{ tpl .host $ | quote }} http: paths: {{- if .paths }} {{- range .paths }} {{- if kindIs "string" . }} - path: {{ . }} pathType: {{ default "Prefix" $.Values.ingress.pathType }} backend: service: name: {{ $fullName }}-http port: number: {{ $httpPort }} {{- else }} - path: {{ .path | default "/" }} pathType: {{ .pathType | default "Prefix" }} backend: service: name: {{ $fullName }}-http port: number: {{ $httpPort }} {{- end }} {{- end }} {{- else }} - path: "/" pathType: "Prefix" backend: service: name: {{ $fullName }}-http port: number: {{ $httpPort }} {{- end }} {{- end }} {{- end }}