Reorganized traefik

This commit is contained in:
Dreaded_X 2025-02-17 04:16:36 +01:00
parent 86c9ecaffc
commit c2b7d0db2e
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4
13 changed files with 67 additions and 59 deletions

View File

@ -4,7 +4,6 @@ resources:
- ./lldap - ./lldap
- ./authelia - ./authelia
- ./grafana - ./grafana
- ./traefik-dashboard
- ./whoami.yaml - ./whoami.yaml
- ./akri-demo.yaml - ./akri-demo.yaml

View File

@ -1,19 +0,0 @@
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: traefik-dashboard
namespace: traefik
spec:
entryPoints:
- websecure
routes:
- match: Host(`traefik.${domain}`)
kind: Rule
middlewares:
- name: forwardauth-authelia
namespace: authelia
services:
- name: api@internal
kind: TraefikService
tls:
secretName: ${domain//./-}-tls

View File

@ -6,6 +6,7 @@ metadata:
spec: spec:
dependsOn: dependsOn:
- name: infra-configs - name: infra-configs
- name: traefik
decryption: decryption:
provider: sops provider: sops
secretRef: secretRef:

View File

@ -0,0 +1,16 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: traefik-middleware
namespace: flux-system
spec:
interval: 15m
path: ./infra/traefik-middleware
dependsOn:
- name: traefik
prune: true
timeout: 10m
sourceRef:
kind: GitRepository
name: flux-system
wait: true

View File

@ -0,0 +1,18 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: traefik
namespace: flux-system
spec:
interval: 15m
path: ./infra/traefik
prune: true
timeout: 2m
sourceRef:
kind: GitRepository
name: flux-system
wait: true
postBuild:
substituteFrom:
- kind: ConfigMap
name: domain-vars

View File

@ -2,7 +2,6 @@ apiVersion: traefik.io/v1alpha1
kind: Middleware kind: Middleware
metadata: metadata:
name: default-headers name: default-headers
namespace: default
spec: spec:
headers: headers:
browserXssFilter: true browserXssFilter: true
@ -14,21 +13,3 @@ spec:
customFrameOptionsValue: SAMEORIGIN customFrameOptionsValue: SAMEORIGIN
customRequestHeaders: customRequestHeaders:
X-Forwarded-Proto: https X-Forwarded-Proto: https
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: test-errors
namespace: default
spec:
errors:
status:
- "403"
- "500"
- "501"
- "503"
- "505-599"
query: /{status}.html
service:
name: whoami
port: 80

View File

@ -2,4 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
namespace: traefik namespace: traefik
resources: resources:
- ingress.yaml - ./default-headers.yaml

View File

@ -1,17 +1,3 @@
apiVersion: v1
kind: Namespace
metadata:
name: traefik
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: traefik
namespace: traefik
spec:
interval: 1m0s
url: https://traefik.github.io/charts
---
apiVersion: helm.toolkit.fluxcd.io/v2 apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease kind: HelmRelease
metadata: metadata:
@ -46,13 +32,24 @@ spec:
port: websecure port: websecure
websecure: websecure:
middlewares: middlewares:
- default-default-headers@kubernetescrd - traefik-default-headers@kubernetescrd
- default-test-errors@kubernetescrd
providers: providers:
kubernetesCRD: kubernetesCRD:
allowCrossNamespace: true allowCrossNamespace: true
ingressRoute:
dashboard:
enabled: true
entryPoints:
- websecure
matchRule: Host(`traefik.${domain}`)
middlewares:
- name: forwardauth-authelia
namespace: authelia
tls:
secretName: ${domain//./-}-tls
# This is needed in order to properly forward the real ip to each service # This is needed in order to properly forward the real ip to each service
# There are likely better ways of handling that, but for now this works # There are likely better ways of handling that, but for now this works
# TODO(Tim): Figure out how to properly forward the IP # TODO(Tim): Figure out how to properly forward the IP

View File

@ -0,0 +1,7 @@
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: traefik
spec:
interval: 1m0s
url: https://traefik.github.io/charts

View File

@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: traefik
resources:
- ./namespace.yaml
- ./helm-repository.yaml
- ./helm-release.yaml

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: traefik

View File

@ -1,6 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ./middleware.yaml
- ./intel-devices - ./intel-devices

View File

@ -2,7 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- akri.yaml - akri.yaml
- traefik.yaml
- cloudnative-pg.yaml - cloudnative-pg.yaml
- ./rook - ./rook
- ./topolvm - ./topolvm