apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: tidbcloud-redirect-ingress
  namespace: wordpress
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/subnets: subnet-042f9e7d753fcf1e4, subnet-05d19fa99d367e49c
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]'
    alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-west-1:801626783489:certificate/4268985c-51f4-4d92-876b-9c995de9d339
    alb.ingress.kubernetes.io/ssl-redirect: '443'
    alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-FS-1-2-2019-08
    # alb.ingress.kubernetes.io/target-group-attributes: stickiness.enabled=true, stickiness.lb_cookie.duration_seconds=3600
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/actions.redirect-to-tidbcloud-com: >
      {"Type":"redirect","RedirectConfig":{"Host":"tidbcloud.com","Port":"443","Protocol":"HTTPS","Path":"/","StatusCode": "HTTP_302"}}
spec:
  rules:
    - host: tidb.cloud
      http:
        paths:
          - backend:
              service:
                name: redirect-to-tidbcloud-com
                port:
                  name: use-annotation
            path: /
            pathType: Prefix
    - host: www.tidb.cloud
      http:
        paths:
          - backend:
              service:
                name: redirect-to-tidbcloud-com
                port:
                  name: use-annotation
            path: /
            pathType: Prefix
