fix(oidc): Switch LibreChat and MCP OAuth to local Keycloak (keycloak.sttlab.local)

This commit is contained in:
Stéphane Tailland
2026-08-23 07:55:28 +02:00
parent 780e25c15e
commit e235d3dea4
5 changed files with 131 additions and 15 deletions
+61 -2
View File
@@ -13,6 +13,18 @@ spec:
labels:
app: librechat
spec:
# *.sttlab.local are lab-only hostnames (self-signed cert), not real
# DNS — this pod needs an explicit mapping to each Gateway's stable
# in-cluster ClusterIP to resolve them at all.
# catalog-dev: kong-v2 catalog-api Gateway (dataplane-ingress-catalog-dev-v4bkm-xqq6v), REST+MCP share this hostname now.
# llm-dev: kong-v2's platform-llm Gateway (dataplane-ingress-llm-dev-rlrxf-7fkb7).
hostAliases:
- ip: "192.168.194.225"
hostnames:
- "catalog-dev.sttlab.local"
- ip: "192.168.194.153"
hostnames:
- "llm-dev.sttlab.local"
initContainers:
- name: wait-for-mongodb
image: busybox:1.36
@@ -81,13 +93,51 @@ spec:
secretKeyRef:
name: librechat-secrets
key: ANTHROPIC_API_KEY
- name: PLATFORM_LLM_LIBRECHAT_APIKEY
valueFrom:
secretKeyRef:
name: librechat-secrets
key: PLATFORM_LLM_LIBRECHAT_APIKEY
- name: LIBRECHAT_OIDC_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: librechat-secrets
key: LIBRECHAT_OIDC_CLIENT_SECRET
# Same Keycloak client secret as LIBRECHAT_OIDC_CLIENT_SECRET
# above (one Keycloak client, "librechat", used both for the
# app's own SSO login and for each MCP server's OAuth flow) —
# LibreChat's OIDC-login code path reads this specific env var
# name, so it's duplicated rather than referenced once.
- name: OPENID_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: librechat-secrets
key: LIBRECHAT_OIDC_CLIENT_SECRET
- name: OPENID_SESSION_SECRET
valueFrom:
secretKeyRef:
name: librechat-secrets
key: OPENID_SESSION_SECRET
# jira-mcp.sttlab.local / konggw.sttlab.local serve a self-signed
# cert (see hostAliases comment above) — Node rejects it by
# default; NODE_EXTRA_CA_CERTS trusts just this one CA, unlike
# NODE_TLS_REJECT_UNAUTHORIZED=0 which would disable TLS
# verification globally.
- name: NODE_EXTRA_CA_CERTS
value: /etc/sttlab-tls/tls.crt
# 512Mi was too tight for LibreChat under real use (MCP clients,
# OTel instrumentation) and caused repeated V8 heap-limit crashes.
# Cap old-space explicitly, leaving headroom under the new
# container limit for non-heap memory (buffers, native modules).
- name: NODE_OPTIONS
value: "--max-old-space-size=1200"
resources:
requests:
cpu: 100m
memory: 256Mi
memory: 512Mi
limits:
cpu: 500m
memory: 512Mi
memory: 1536Mi
livenessProbe:
httpGet:
path: /health
@@ -104,7 +154,16 @@ spec:
- name: app-config
mountPath: /app/librechat.yaml
subPath: librechat.yaml
- name: sttlab-tls-cert
mountPath: /etc/sttlab-tls
readOnly: true
volumes:
- name: app-config
configMap:
name: librechat-app-config
- name: sttlab-tls-cert
secret:
secretName: sttlab-tls
items:
- key: tls.crt
path: tls.crt