apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: mini-maestro-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  rules:
  - host: "zoox.dispatch.com"
    http:
      paths:
      - pathType: Prefix
        path: /geo(/|$)(.*)
        backend:
          service:
            name: geo
            port:
              number: 80
      - pathType: Prefix
        path: /cloud-planner(/|$)(.*)
        backend:
          service:
            name: cloud-planner
            port:
               number: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: geo
  labels:
    app: geo
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: geo
  template:
    metadata:
      labels:
        app: geo
    spec:
      containers:
      - name: geo
        env:
        - name: GEO__PLANNER_CLIENT__URL
          value: http://cloud-planner
        image: maestro.docker.zooxlabs.com/geo:latest
        ports:
        - containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cloud-planner
  labels:
    app: cloud-planner
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cloud-planner
  template:
    metadata:
      labels:
        app: cloud-planner
    spec:
      containers:
      - name: cloud-planner
        image: maestro.docker.zooxlabs.com/planner:latest
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: geo
  namespace: default
spec:
  selector:
    app: geo
  ports:
  - port: 80
    targetPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: cloud-planner
  namespace: default
spec:
  selector:
    app: cloud-planner
  ports:
  - port: 80
    targetPort: 80
