---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
  name: fakebook
spec:
  defaultBackend:
    service:
      name: fakebook-spa
      port:
        number: 80
  ingressClassName: nginx
  rules:
  - host: fakebook.revaturelabs.com
    http:
      paths:
      - path: /api/posts
        pathType: Prefix
        backend:
          service:
            name: fakebook-posts-api
            port:
              number: 80
      - path: /api/comments
        pathType: Prefix
        backend:
          service:
            name: fakebook-posts-api
            port:
              number: 80
      - path: /api/follows
        pathType: Prefix
        backend:
          service:
            name: fakebook-posts-api
            port:
              number: 80
      - path: /notifications
        pathType: Prefix
        backend:
          service:
            name: fakebook-notifications-api
            port:
              number: 80
      - path: /api/profiles
        pathType: Prefix
        backend:
          service:
            name: fakebook-profile-api
            port:
              number: 80
      - path: /api/profilepicture
        pathType: Prefix
        backend:
          service:
            name: fakebook-profile-api
            port:
              number: 80
  tls:
  - hosts:
    - fakebook.revaturelabs.com
    secretName: fakebook-tls

# https://docs.microsoft.com/en-us/azure/aks/ingress-static-ip

# (group is the aks-created one)
# az network public-ip create -g mc_nick-escalona-945-p3_fakebook_eastus -n fakebook-public-ip --sku Standard --allocation-method static --query publicIp.ipAddress -o tsv
# (output 52.152.144.110)

# helm install fakebook-ingress ingress-nginx/ingress-nginx \
#     --set controller.replicaCount=2 \
#     --set controller.nodeSelector."beta\.kubernetes\.io/os"=linux \
#     --set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux \
#     --set controller.admissionWebhooks.patch.nodeSelector."beta\.kubernetes\.io/os"=linux \
#     --set controller.service.loadBalancerIP="52.152.144.110"
