#---
#apiVersion: networking.k8s.io/v1
#kind: Ingress
#metadata:
#  name: echo.server
#  labels:
#    app: echoserver
#  annotations:
#    kubernetes.io/ingress.class: "nginx"
#    nginx.ingress.kubernetes.io/ssl-redirect: "true"
#    nginx.ingress.kubernetes.io/configuration-snippet: |
#      return 308 $scheme://local.io$request_uri;
#spec:
#  tls:
#    - hosts:
#      -  "*.local.io"
#      secretName: "local.io"
#  rules:
#    - host: echo.local.io
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: local.io
  labels:
    app: echoserver
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    # redirect wwww.local.io to local.io
    nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
    #nginx.ingress.kubernetes.io/server-alias: "www.local.io"
    nginx.ingress.kubernetes.io/configuration-snippet: |
      rewrite ^(/mem/.*)$ http://ex.local.io$1 permanent;
spec:
  tls:
    - hosts:
      -  "*.local.io"
      secretName: "local.io"
  rules:
    - host: local.io
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: echoserver
                port:
                  number: 80
