apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: search-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/configuration-snippet: |
      if ($host = 'ausnews.org' ) {
        rewrite ^ https://www.ausnews.org permanent;
      }
    nginx.ingress.kubernetes.io/from-to-www-redirect: 'true'
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
  tls:
  - hosts:
    - s.ausnews.org
    - m.ausnews.org
    - ausnews.org
    secretName: ausnews-tls
  rules:
  - host: s.ausnews.org
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: web-api-service
            port:
              number: 80
  - host: m.ausnews.org
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: monitoring-service
            port:
              number: 80
