atlas-iac/services/hermes/agent-ingress.yaml
Hermes Agent f4f51323f6 hermes: restore legacy chat/triage hosts alongside the renamed ones
PR #34 renamed the public chat/triage hosts in place rather than adding
the new names, so chat.hermes.bstein.dev and triage.hermes.bstein.dev
were dropped from the certificate SANs, the hermes-sites Ingress rules
and the CoreDNS overrides at once. Both legacy hosts now answer 404 with
Traefik's default self-signed certificate, and the renamed hosts cannot
complete a login because the Keycloak clients still carry the old
redirect URIs, so chat and triage are unreachable on every hostname.

Make the rename additive, which is the rollback path the post-merge
runbook asks for when the OIDC step fails:

- put the legacy names back on hermes-sites-tls and on the Ingress,
  pointing at the same oauth2-proxy backends
- restore both CoreDNS host overrides for in-cluster resolution
- teach ensure_proxy_client to register an optional legacy origin, so
  hermes-chat-proxy and hermes-triage-proxy accept the old and new
  redirect URIs, web origins and post-logout origins at the same time
  while rootUrl stays on the canonical new host
- bump the immutable ensure Job so Flux reruns the script

Serving both names is deliberate: oauth2-proxy cookies are host-bound,
so redirecting the legacy hosts would silently drop live sessions.
Retiring them stays a separate, explicit change.

Supersedes #36, which only bumped the Job and would have left the
legacy hosts dark.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 08:49:09 +00:00

140 lines
3.7 KiB
YAML

# services/hermes/agent-ingress.yaml
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: hermes-agent-terminal-slash
namespace: hermes
spec:
redirectRegex:
regex: ^https://agent\.hermes\.bstein\.dev/terminal$
replacement: https://agent.hermes.bstein.dev/terminal/
permanent: false
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: hermes-agent-stock-dashboard-headers
namespace: hermes
spec:
headers:
customRequestHeaders:
Origin: http://127.0.0.1:9119
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hermes-agent-dashboard
namespace: hermes
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.middlewares: hermes-hermes-agent-stock-dashboard-headers@kubernetescrd
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
ingressClassName: traefik
tls:
- hosts:
- agent.hermes.bstein.dev
secretName: hermes-sites-tls
rules:
- host: agent.hermes.bstein.dev
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: oauth2-proxy-hermes-agent
port:
name: http
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hermes-agent-terminal
namespace: hermes
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.middlewares: hermes-hermes-agent-terminal-slash@kubernetescrd
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
ingressClassName: traefik
tls:
- hosts:
- agent.hermes.bstein.dev
secretName: hermes-sites-tls
rules:
- host: agent.hermes.bstein.dev
http:
paths:
- path: /terminal
pathType: Prefix
backend:
service:
name: oauth2-proxy-hermes-agent
port:
name: http
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hermes-sites
namespace: hermes
annotations:
cert-manager.io/cluster-issuer: letsencrypt
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
ingressClassName: traefik
tls:
- hosts:
- agent.hermes.bstein.dev
- chat.bstein.dev
- triage.bstein.dev
- chat.hermes.bstein.dev
- triage.hermes.bstein.dev
secretName: hermes-sites-tls
rules:
- host: chat.bstein.dev
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: oauth2-proxy-hermes-chat
port:
name: http
- host: triage.bstein.dev
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: oauth2-proxy-hermes-triage
port:
name: http
# Legacy hosts serve the same backends so the rename is additive. They are
# kept until an explicit retirement change, not redirected: oauth2-proxy
# cookies are host-bound, so a redirect would silently drop the session.
- host: chat.hermes.bstein.dev
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: oauth2-proxy-hermes-chat
port:
name: http
- host: triage.hermes.bstein.dev
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: oauth2-proxy-hermes-triage
port:
name: http