apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: mozhi-api-nginx-ingress
  namespace: mozhi
  labels:
    org: mozhi
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/configuration-snippet: |
           more_set_headers "Access-Control-Allow-Origin: $http_origin";
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, DELETE, OPTIONS"
    nginx.ingress.kubernetes.io/cors-allow-origin: "*"
    nginx.ingress.kubernetes.io/proxy-body-size: 200m
#    nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
spec:
  rules:
  - host: mozhi.ai
    http:
      paths:
      - path: /api/v1/(.*)
        pathType: Prefix
        backend:
          service:
            name: mozhi-api-cpu-svc
            port:
              number: 8088
      - path: /api/calamari/v1/(.*)
        pathType: Prefix
        backend:
          service:
            name: mozhi-ocr-cpu-svc
            port:
              number: 8089
      - path: /api/torchserve/pred/v1/(.*)
        pathType: Prefix
        backend:
          service:
            name: mozhi-api-torchserve-svc
            port:
              number: 6543
      - path: /api/torchserve/mgmnt/v1/(.*)
        pathType: Prefix
        backend:
          service:
            name: mozhi-api-torchserve-svc
            port:
              number: 6544
      - path: /(.*)
        pathType: Prefix
        backend:
          service:
            name: mozhi-ui-cpu-svc
            port:
              number: 8080