apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: gitea-cert
  namespace: istio-system
spec:
  dnsNames:
    - gitea.cloud.cps.sarex.lonsdaleites.ru
  duration: 2160h
  issuerRef:
    kind: ClusterIssuer
    name: letsencrypt-issuer-istio
  privateKey:
    rotationPolicy: Always
  renewBefore: 360h
  secretName: gitea-tls
---
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
  name: gitea-gateway
  namespace: gateway
spec:
  selector:
    istio: ingressgateway
  servers:
    - hosts:
        - gitea.cloud.cps.sarex.lonsdaleites.ru
      port:
        name: https-443
        number: 443
        protocol: HTTPS
      tls:
        credentialName: gitea-tls
        mode: SIMPLE
    - hosts:
        - gitea.cloud.cps.sarex.lonsdaleites.ru
      port:
        name: http-80
        number: 80
        protocol: HTTP
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: gitea-virt-service
  namespace: gitea
spec:
  gateways:
    - gateway/gitea-gateway
  hosts:
    - gitea.cloud.cps.sarex.lonsdaleites.ru
  http:
    - match:
        - uri:
            prefix: /
      route:
        - destination:
            host: gitea
            port:
              number: 3000
