Files
riotpiao.com/infra/portfolio/base/deployment.yaml
T
Story Crater Bot 4ad8a4f4a4
Build & Push Portfolio Image / Test (pull_request) Failing after 34s
Build & Push Portfolio Image / Build & Push Image (pull_request) Skipped
fix: move LLM config to encrypted ConfigMap (CI-friendly)
Problem: LLM_API_URL hardcoded to external HTTPS endpoint
- https://api.riotpiao.com/v1/chat/completions (TLS hairpin through nginx)
- Not externalizable for CI or environment-specific deployment

Solution: Move to SOPS-encrypted ConfigMap with in-cluster endpoint
- LLM_API_URL: http://api-gateway.api.svc.cluster.local:8080/v1/chat/completions
- No TLS overhead, direct cluster communication
- Encrypted for security (SOPS + age key)
- Externalizable: CI can update values without app redeployment

Changes:
1. Create configmap.enc.yaml (SOPS-encrypted)
   - Data: LLM_API_URL, LLM_MODEL
   - Encrypted with .sops.yaml age key
2. Update deployment.yaml
   - Change from 'value:' to 'valueFrom: configMapKeyRef'
   - Reference portfolio-llm-config ConfigMap
3. Update kustomization.yaml
   - Add configmap.enc.yaml to resources
   - Add sops: version: 3 for decryption

Benefits:
- ArgoCD auto-decrypts via SOPS before applying
- CI can auto-patch ConfigMap without app changes
- Environment-specific config (dev/staging/prod)
- Secrets encrypted in git (never plain text)
2026-09-06 23:25:35 -07:00

83 lines
2.1 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: portfolio
namespace: portfolio
labels:
app.kubernetes.io/name: portfolio
app.kubernetes.io/component: web
spec:
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: portfolio
template:
metadata:
labels:
app.kubernetes.io/name: portfolio
spec:
containers:
- name: portfolio
image: forgejo.riotpiao.com/rock/portfolio:latest
imagePullPolicy: Always
env:
- name: FORGEJO_TOKEN
valueFrom:
secretKeyRef:
name: portfolio-secrets
key: FORGEJO_TOKEN
# OAuth credentials for LLM API (client_credentials grant)
- name: AUTHENTIK_CLIENT_ID
valueFrom:
secretKeyRef:
name: portfolio-agent-oidc
key: CLIENT_ID
- name: AUTHENTIK_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: portfolio-agent-oidc
key: CLIENT_SECRET
- name: AUTHENTIK_TOKEN_URL
valueFrom:
secretKeyRef:
name: portfolio-agent-oidc
key: TOKEN_URL
# LLM API configuration (from encrypted ConfigMap)
- name: LLM_API_URL
valueFrom:
configMapKeyRef:
name: portfolio-llm-config
key: LLM_API_URL
- name: LLM_MODEL
valueFrom:
configMapKeyRef:
name: portfolio-llm-config
key: LLM_MODEL
ports:
- name: http
containerPort: 3000
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 2
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi