ansible-role-k8s-traefik/templates/traefik-ingressroute.yml.j2
Adrien Reslinger c0bfc09c8c
All checks were successful
continuous-integration/drone/push Build is passing
Update role
2022-02-26 00:46:31 +01:00

50 lines
1.5 KiB
Django/Jinja

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: traefik
labels:
app: traefik
spec:
entryPoints:
- websecure
routes:
# Match is the rule corresponding to an underlying router.
# Later on, match could be the simple form of a path prefix, e.g. just "/bar",
# but for now we only support a traefik style matching rule.
- match: Host(`traefik.{{ cluster_domain }}`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))
# kind could eventually be one of "Rule", "Path", "Host", "Method", "Header",
# "Parameter", etc, to support simpler forms of rule matching, but for now we
# only support "Rule".
kind: Rule
{% if basic_auth is defined or ingress_whitelist is defined %}
middlewares:
{% if ingress_whitelist is defined %}
- name: traefik-ipwhitelist@file
{% endif %}
{% if basic_auth is defined %}
- name: basic-auth@file
{% endif %}
{% endif %}
services:
- name: api@internal
kind: TraefikService
- match: Host(`traefik.{{ cluster_domain }}`) && PathPrefix(`/ping`)
kind: Rule
services:
- name: ping@internal
kind: TraefikService
# - match: Host(`traefik.{{ cluster_domain }}`) && PathPrefix(`/metrics`)
# kind: Rule
# services:
# - name: prometheus@internal
# kind: TraefikService
tls:
{% if traefik_dashboard_certificate is defined %}
secretName: {{ traefik_dashboard_certificate }}
{% else %}
secretName: traefik.{{ cluster_domain }}
{% endif %}