Files
homelab/k8s/apps/ingresses/templates/authentik.yaml
T
2024-07-17 18:21:42 -04:00

85 lines
2.8 KiB
YAML

---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: authentik.{{ .Values.global.rootSubDomain }}.{{ .Values.global.domain }}
namespace: chart-authentik
spec:
routes:
- kind: Rule
match: "Host(`authentik.{{ .Values.global.rootSubDomain }}.{{ .Values.global.domain }}`)"
middlewares:
- name: forwardauth-authentik
namespace: chart-authentik
priority: 10
services:
- kind: Service
name: authentik-server
namespace: chart-authentik
port: 80
- kind: Rule
match: "Host(`authentik.{{ .Values.global.rootSubDomain }}.{{ .Values.global.domain }}`) && PathPrefix(`/outpost.goauthentik.io/`)"
priority: 15
services:
- kind: Service
name: authentik-server
namespace: chart-authentik
port: 80
{{ if .Values.global.tls.enabled }}
tls:
secretName: tls-authentik.{{ .Values.global.rootSubDomain }}.{{ .Values.global.domain }}
domains:
- main: authentik.{{ .Values.global.rootSubDomain }}.{{ .Values.global.domain }}
{{ end }}
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: forwardauth-authentik
namespace: chart-authentik
spec:
forwardAuth:
address: http://authentik.{{ .Values.global.rootSubDomain }}.{{ .Values.global.domain }}/outpost.goauthentik.io/auth/traefik
trustForwardHeader: true
authResponseHeaders:
- X-authentik-username
- X-authentik-groups
- X-authentik-email
- X-authentik-name
- X-authentik-uid
- X-authentik-jwt
- X-authentik-meta-jwks
- X-authentik-meta-outpost
- X-authentik-meta-provider
- X-authentik-meta-app
- X-authentik-meta-version
---
{{ if .Values.global.tls.enabled }}
{{ include "homelab.ingress.domain.tls" (dict "global" .Values.global "namespace" "chart-authentik" "prefix" "authentik.home" "domain" .Values.global.domain ) }}
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "authentik-outpost-tls"
namespace: chart-authentik
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: apps-ingresses
target:
name: "authentik-outpost-tls"
creationPolicy: Owner
deletionPolicy: Delete
data:
- secretKey: tls.crt
remoteRef:
key: cloudflare-wildcard.{{ .Values.global.domain }}
property: tls.crt
- secretKey: tls.key
remoteRef:
key: cloudflare-wildcard.{{ .Values.global.domain }}
property: tls.key
{{ end }}