apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: tasknote-external-redirect
  namespace: default
spec:
  redirectRegex:
    regex: "^https?://tasknote.darkroasted.vps-kinghost.net/(.*)"
    replacement: "https://tasknote.cc/${1}"
    permanent: true
---
apiVersion: v1
kind: Service
metadata:
  name: redirect-tasknote
  namespace: default
spec:
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: tasknote-redirect-ingress
  namespace: default
  annotations:
    traefik.ingress.kubernetes.io/router.middlewares: default-tasknote-external-redirect@kubernetescrd
    traefik.ingress.kubernetes.io/router.entrypoints: web, websecure
spec:
  ingressClassName: traefik
  rules:
  - host: tasknote.darkroasted.vps-kinghost.net
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: redirect-tasknote
            port:
              number: 80
