apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/use-regex: "true"
  name: loki
  namespace: observability
spec:
  ingressClassName: TMPL_NGINX_WRITE_INGRESS_CLASS
  rules:
  - http:
      paths:
      - backend:
          service:
            name: loki-ha-write
            port:
              number: 3100
        path: /loki(/|$)(.*)
        pathType: ImplementationSpecific
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/use-regex: "true"
  name: loki-read
  namespace: observability
spec:
  ingressClassName: TMPL_NGINX_READ_INGRESS_CLASS
  rules:
  - http:
      paths:
      - backend:
          service:
            name: loki-ha-read
            port:
              number: 3100
        path: /loki/self-monitoring(/|$)(.*)
        pathType: ImplementationSpecific
