apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    #nginx.ingress.kubernetes.io/rewrite-target: /
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
  rules:
    - host: ticketing.dev
      http:
        paths:
          - path: /api/users/?(.*)
            pathType: Prefix
            backend:
              service:
                name: auth-clusterip-srv
                port:
                  number: 3001
              #serviceName: auth-clusterip-srv
              #servicePort: 3001
          - path: /api/tickets/?(.*)
            pathType: Prefix
            backend:
              service:
                  name: tickets-clusterip-srv
                  port:
                    number: 3002
              #serviceName: tickets-clusterip-srv
              #servicePort: 3002
          - path: /api/orders/?(.*)
            pathType: Prefix
            backend:
              service:
                  name: orders-clusterip-srv
                  port:
                    number: 3003
              #serviceName: orders-clusterip-srv
              #servicePort: 3003
          - path: /api/payments/?(.*)
            pathType: Prefix
            backend:
              service:
                  name: payments-clusterip-srv
                  port:
                    number: 3004
              #serviceName: payments-clusterip-srv
              #servicePort: 3004
          - path: /?(.*)
            pathType: Prefix
            backend:
              service:
                  name: client-clusterip-srv
                  port:
                    number: 3000
              #serviceName: client-clusterip-srv
              #servicePort: 3000


# Create the Ingress resource by running the following command:
# kubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml
