apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kh-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/affinity: "cookie"
    nginx.ingress.kubernetes.io/session-cookie-name: "ingress"
    nginx.ingress.kubernetes.io/session-cookie-hash: "sha1"
    nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
    nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
    nginx.ingress.kubernetes.io/configuration-snippet: |
      rewrite ^([^.?]*[^/])$ $1/ redirect;

spec:
  tls:
  - hosts:
    - api.knighthacks.org
    - knighthacks.org
    secretName: ingress-tls
  rules:
  - host: api.knighthacks.org
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: kh-backend
            port:
              number: 80
  - host: knighthacks.org
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: kh-frontend
            port:
              number: 80
