dev.aggtaa.com/api/admin path auth, prefix stip
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
# Two Ingresses on one host because the auth middleware is per-Ingress:
|
# Three Ingresses on one host because middlewares and router priority are
|
||||||
# "/" goes through Authelia, "/api" and "/m" are public. Traefik picks the
|
# per-Ingress. Traefik matches pathType Prefix character-wise (not per path
|
||||||
# longer path prefix first, so /api and /m never hit the auth router.
|
# segment), so public prefixes carry a trailing slash and priorities are
|
||||||
# Both need the tls section (otherwise the router is http-only), but only
|
# explicit - by default Traefik orders routers by rule length, which would
|
||||||
# the first carries the cert-manager annotation so a single Certificate
|
# not reliably put /api/admin above /api/.
|
||||||
# owns the dev-tls secret.
|
# 300 dev-admin /api/admin -> Authelia -> api (prefix /api stripped)
|
||||||
|
# 200 dev-public /api/ /m/ -> api / m, public (prefixes stripped)
|
||||||
|
# 100 dev / -> Authelia -> ui (also bare /api and /m)
|
||||||
|
# All carry the tls section (otherwise the router is http-only), but only
|
||||||
|
# "dev" has the cert-manager annotation so a single Certificate owns dev-tls.
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
@@ -11,6 +15,7 @@ metadata:
|
|||||||
namespace: dev
|
namespace: dev
|
||||||
annotations:
|
annotations:
|
||||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||||
|
traefik.ingress.kubernetes.io/router.priority: "100"
|
||||||
traefik.ingress.kubernetes.io/router.middlewares: auth-authelia@kubernetescrd
|
traefik.ingress.kubernetes.io/router.middlewares: auth-authelia@kubernetescrd
|
||||||
spec:
|
spec:
|
||||||
ingressClassName: traefik
|
ingressClassName: traefik
|
||||||
@@ -33,22 +38,53 @@ spec:
|
|||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: dev-public
|
name: dev-admin
|
||||||
namespace: dev
|
namespace: dev
|
||||||
|
annotations:
|
||||||
|
traefik.ingress.kubernetes.io/router.priority: "300"
|
||||||
|
traefik.ingress.kubernetes.io/router.middlewares: auth-authelia@kubernetescrd,dev-strip-prefix@kubernetescrd
|
||||||
spec:
|
spec:
|
||||||
ingressClassName: traefik
|
ingressClassName: traefik
|
||||||
rules:
|
rules:
|
||||||
- host: dev.aggtaa.com
|
- host: dev.aggtaa.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /api
|
# no trailing slash on purpose: also catches bare /api/admin
|
||||||
|
# (and /api/administrator...), all of which stay behind Authelia
|
||||||
|
- path: /api/admin
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
service:
|
service:
|
||||||
name: dev
|
name: dev
|
||||||
port:
|
port:
|
||||||
name: api
|
name: api
|
||||||
- path: /m
|
tls:
|
||||||
|
- secretName: dev-tls
|
||||||
|
hosts:
|
||||||
|
- dev.aggtaa.com
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: dev-public
|
||||||
|
namespace: dev
|
||||||
|
annotations:
|
||||||
|
traefik.ingress.kubernetes.io/router.priority: "200"
|
||||||
|
traefik.ingress.kubernetes.io/router.middlewares: dev-strip-prefix@kubernetescrd
|
||||||
|
spec:
|
||||||
|
ingressClassName: traefik
|
||||||
|
rules:
|
||||||
|
- host: dev.aggtaa.com
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /api/
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: dev
|
||||||
|
port:
|
||||||
|
name: api
|
||||||
|
- path: /m/
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
service:
|
service:
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
|||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- service.yaml
|
- service.yaml
|
||||||
|
- middleware.yaml
|
||||||
- ingress.yaml
|
- ingress.yaml
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Shared by dev-admin and dev-public: /api/a -> /a, /api/admin/b -> /admin/b,
|
||||||
|
# /m/main.css -> /main.css. Only the first matching prefix is stripped, and
|
||||||
|
# none of these routes can match both.
|
||||||
|
apiVersion: traefik.io/v1alpha1
|
||||||
|
kind: Middleware
|
||||||
|
metadata:
|
||||||
|
name: strip-prefix
|
||||||
|
namespace: dev
|
||||||
|
spec:
|
||||||
|
stripPrefix:
|
||||||
|
prefixes:
|
||||||
|
- /api
|
||||||
|
- /m
|
||||||
Reference in New Issue
Block a user