apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: {{ .Release.Name }}-tls
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  entryPoints:
    - websecure
  tls:
    certResolver: duconet
  routes:
  - match: Host(`{{ .Release.Name }}.ducoterra.net`)
    kind: Rule
    services:
    - name: {{ .Release.Name }}
      port: {{ .Values.port }}
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: {{ .Release.Name }}
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  entryPoints:
    - web
  routes:
  - match: Host(`{{ .Release.Name }}.ducoterra.net`)
    kind: Rule
    services:
    - name: {{ .Release.Name }}
      port: {{ .Values.port }}
    middlewares:
      - name: httpsredirect-{{ .Release.Name }}
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: httpsredirect-{{ .Release.Name }}
spec:
  redirectScheme:
    scheme: https
    permanent: true
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: basic-auth-{{ .Release.Name }}
spec:
  basicAuth:
    secret: authsecret
    removeHeader: true