# ingress to route frontend and backend traffic
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: shipyard-ingress
  namespace: dev
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: shipyard.tech
    http:
      paths:
      # https://github.com/kubernetes/ingress-nginx/issues/5265#issuecomment-612680524
      - path: /?(.*)
        pathType: Prefix
        backend:
          service:
            name: shipyard-frontend-service
            port:
              number: 3000
  - host: api.shipyard.tech
    http:
      paths:
      - path: /?(.*)
        pathType: Prefix
        backend:
          service:
            name: shipyard-backend-service
            port:
              number: 8000
  - host: idp.shipyard.tech
    http:
      paths:
      - path: /?(.*)
        pathType: Prefix
        backend:
          service:
            name: shipyard-backend-service
            port:
              number: 8001
  - host: prom.shipyard.tech
    http:
      paths:
      - path: /?(.*)
        pathType: Prefix
        backend:
          service:
            name: shipyard-prometheus-service
            port:
              number: 9000
  - host: grafana.shipyard.tech
    http:
      paths:
      - path: /?(.*)
        pathType: Prefix
        backend:
          service:
            name: shipyard-grafana-service
            port:
              number: 5000
