{{- include "gitea.validate-ingress-gateway-conflict" . }} {{- if .Values.gateway.httpRoute.enabled -}} {{- $fullName := include "gitea.fullname" . -}} {{- $httpPort := .Values.service.http.port -}} apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: {{ $fullName }} namespace: {{ .Values.namespace | default .Release.Namespace }} labels: {{- include "gitea.labels" . | nindent 4 }} annotations: {{- range $key, $value := .Values.gateway.httpRoute.annotations }} {{ $key }}: {{ $value | quote }} {{- end }} spec: hostnames: {{- range .Values.gateway.httpRoute.hostnames }} - {{ tpl . $ | quote }} {{- end }} parentRefs: {{- range .Values.gateway.httpRoute.parentRefs }} - name: {{ .name | quote }} {{- if .namespace }} namespace: {{ .namespace | quote }} {{- end }} {{- if .kind }} kind: {{ .kind | quote }} {{- end }} {{- if .group }} group: {{ .group | quote }} {{- end }} {{- if .sectionName }} sectionName: {{ .sectionName | quote }} {{- end }} {{- if .port }} port: {{ .port }} {{- end }} {{- end }} rules: {{- if .Values.gateway.httpRoute.paths }} {{- range .Values.gateway.httpRoute.paths }} {{- if kindIs "string" . }} - matches: - path: type: {{ default "PathPrefix" $.Values.gateway.httpRoute.pathType }} value: {{ . }} backendRefs: - group: "" kind: Service name: {{ $fullName }}-http namespace: {{ $.Values.namespace | default $.Release.Namespace }} port: {{ $httpPort }} {{- else }} - matches: - path: type: {{ .pathType | default "PathPrefix" }} value: {{ .path | default "/" }} backendRefs: - group: "" kind: Service name: {{ $fullName }}-http namespace: {{ $.Values.namespace | default $.Release.Namespace }} port: {{ $httpPort }} {{- end }} {{- end }} {{- else }} - matches: - path: type: PathPrefix value: "/" backendRefs: - group: "" kind: Service name: {{ $fullName }}-http namespace: {{ .Values.namespace | default .Release.Namespace }} port: {{ $httpPort }} {{- end }} {{- end }}