{{- if and .Values.gitea.enabled .Values.gitea.istio.enabled }}
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: gitea
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "kubezero-lib.labels" $ | nindent 4 }}
spec:
  gateways:
  - {{ .Values.gitea.istio.gateway }}
  hosts:
  - {{ .Values.gitea.istio.url }}
  http:
  - name: api
    match:
    - uri:
       prefix: /api/
    route:
    - destination:
        host: gitea-http
  - name: notApi
    route:
    - destination:
        host: gitea-http
  tcp:
  - match:
    - port: 22
    route:
    - destination:
        host: gitea-ssh
{{- end }}
