#kubectl apply -f non-prod-nginx-alb-ingress-mapper-for-instance-type.yaml -n ingress
#apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: "instance-type-ingress"
  labels:
    app: "instance-type-ingress"
  annotations:
    # more details https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.1/guide/ingress/annotations/#listen-ports
    # trigger the alb-ingress-controller
    kubernetes.io/ingress.class: "alb"
    # set ALB parameters
    alb.ingress.kubernetes.io/scheme: "internet-facing"
    alb.ingress.kubernetes.io/target-type: "instance"
    #for security we are not allowing access to everyone
    #alb.ingress.kubernetes.io/inbound-cidrs: 185.125.224.20/32,212.86.32.0/19,62.178.175.89/32
    #public subnet id in which ALB needs to be created
    alb.ingress.kubernetes.io/subnets: "subnet-0ef477ea678bf84fb,subnet-08cf369c3ac2c580e,subnet-05503648b75216c2e"
    alb.ingress.kubernetes.io/certificate-arn: "arn:aws:acm:eu-central-1:373612170290:certificate/0e1520d5-1ebf-49cf-b4f7-6325cab280d3,arn:aws:acm:eu-central-1:373612170290:certificate/b466dfdc-1a03-49b7-84c4-41cde60c4e78,arn:aws:acm:eu-central-1:373612170290:certificate/3fd45be9-cf66-4af6-8f4d-30941e55fbfa,arn:aws:acm:eu-central-1:373612170290:certificate/89ad680b-f257-4fc4-b95b-91473a42d652"
    #alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]'
    # port on which to listen traffic req. in following case we are listening only on https
    #alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}, {"HTTP": 8080}, {"HTTPS": 8443}]'
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS": 443}]'
    # allow 404s on the health check
    alb.ingress.kubernetes.io/healthcheck-path: "/"
    alb.ingress.kubernetes.io/success-codes: "200,404"
spec:
  rules:
  - http:
      paths:
      - path: "/*"
        pathType: Prefix
        backend:
          service:
            name: nginx-nginx-ingress-controller # please note this name must match with nginx service name
            port:
              number: 80
