Replace hardcoded value: with valueFrom: configMapKeyRef
Reference portfolio-llm-config ConfigMap
Update kustomization.yaml
Add configmap.enc.yaml to resources
Add sops: version: 3 for auto-decryption
Benefits
✅No TLS overhead: In-cluster endpoint, direct communication ✅Externalizable: CI can update ConfigMap without app redeployment ✅Environment-aware: Different config per environment (update kustomization overlay) ✅Encrypted in git: Secrets encrypted with SOPS, never plain text ✅ArgoCD-friendly: Auto-decrypts via SOPS before applying
Testing
After merge:
ArgoCD syncs → SOPS decrypts → ConfigMap created
Portfolio pod mounts ConfigMap values
Verify: kubectl -n portfolio get cm portfolio-llm-config
## Problem
LLM_API_URL was hardcoded in deployment.yaml to the external HTTPS endpoint:
```
LLM_API_URL: https://api.riotpiao.com/v1/chat/completions
```
Issues:
- **TLS hairpin overhead**: DNS resolves to nginx, which proxies back in-cluster
- **Not externalizable**: CI cannot update config without app redeployment
- **Environment coupling**: Same URL for dev/staging/prod
- **Plain text in git**: Config not encrypted (not a secret but sensitive)
## Solution
Move LLM configuration to SOPS-encrypted ConfigMap with in-cluster endpoint.
### Changes
1. **Create configmap.enc.yaml** (SOPS-encrypted)
- LLM_API_URL: `http://api-gateway.api.svc.cluster.local:8080/v1/chat/completions`
- LLM_MODEL: `qwen2.5:3b-instruct`
- Encrypted with age key from .sops.yaml
2. **Update deployment.yaml**
- Replace hardcoded `value:` with `valueFrom: configMapKeyRef`
- Reference `portfolio-llm-config` ConfigMap
3. **Update kustomization.yaml**
- Add `configmap.enc.yaml` to resources
- Add `sops: version: 3` for auto-decryption
### Benefits
✅ **No TLS overhead**: In-cluster endpoint, direct communication
✅ **Externalizable**: CI can update ConfigMap without app redeployment
✅ **Environment-aware**: Different config per environment (update kustomization overlay)
✅ **Encrypted in git**: Secrets encrypted with SOPS, never plain text
✅ **ArgoCD-friendly**: Auto-decrypts via SOPS before applying
### Testing
After merge:
1. ArgoCD syncs → SOPS decrypts → ConfigMap created
2. Portfolio pod mounts ConfigMap values
3. Verify: `kubectl -n portfolio get cm portfolio-llm-config`
4. Verify pod env: `kubectl -n portfolio exec deploy/portfolio -- env | grep LLM`
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)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
LLM_API_URL was hardcoded in deployment.yaml to the external HTTPS endpoint:
Issues:
Solution
Move LLM configuration to SOPS-encrypted ConfigMap with in-cluster endpoint.
Changes
Create configmap.enc.yaml (SOPS-encrypted)
http://api-gateway.api.svc.cluster.local:8080/v1/chat/completionsqwen2.5:3b-instructUpdate deployment.yaml
value:withvalueFrom: configMapKeyRefportfolio-llm-configConfigMapUpdate kustomization.yaml
configmap.enc.yamlto resourcessops: version: 3for auto-decryptionBenefits
✅ No TLS overhead: In-cluster endpoint, direct communication
✅ Externalizable: CI can update ConfigMap without app redeployment
✅ Environment-aware: Different config per environment (update kustomization overlay)
✅ Encrypted in git: Secrets encrypted with SOPS, never plain text
✅ ArgoCD-friendly: Auto-decrypts via SOPS before applying
Testing
After merge:
kubectl -n portfolio get cm portfolio-llm-configkubectl -n portfolio exec deploy/portfolio -- env | grep LLMPull request closed