infra(k8s): add dev overlay with resource limits and health checks

Implements Task 25: Kustomize Dev Overlay + Resource Limits + Health Checks

Files Created:
- infra/k8s/overlays/dev/kustomization.yaml - Dev overlay config
  - References base manifests
  - Namespace: workclub-dev
  - Replicas: 1 for all deployments
  - Image tags: dev for workclub-api and workclub-frontend
  - Environment label: development

- infra/k8s/overlays/dev/patches/backend-resources.yaml
  - Backend resources: cpu=50m-200m, memory=128Mi-256Mi
  - Strategic merge patch targeting workclub-api deployment

- infra/k8s/overlays/dev/patches/frontend-resources.yaml
  - Frontend resources: cpu=50m-200m, memory=128Mi-256Mi
  - Strategic merge patch targeting workclub-frontend deployment

- frontend/src/app/api/health/route.ts
  - Missing health endpoint (declared in base manifest but not implemented)
  - Simple Next.js route handler returning {status: 'ok'}

Resource Limits (Dev vs Base):
- Dev: 50m-200m CPU, 128Mi-256Mi memory (50% of base)
- Base: 100m-500m CPU, 256Mi-512Mi memory

Verification:
- kustomize build succeeds (exit 0)
- All deployments replicas=1
- Lower resource limits applied correctly
- Image tags set to dev
- Frontend /api/health route registered
- Evidence saved to .sisyphus/evidence/task-25-kustomize-dev.yaml (495 lines)

Note: commonLabels deprecated warning (non-blocking), consider using labels in future.
This commit is contained in:
WorkClub Automation
2026-03-03 21:11:18 +01:00
parent 7a2b79af83
commit 326a4f30e8
7 changed files with 612 additions and 1 deletions

View File

@@ -1822,3 +1822,52 @@ docker run -p 3000:3000 workclub-frontend:dev
curl http://localhost:3000 # Should return HTTP 200
```
## [2026-03-03 Task 25] Kustomize Dev Overlay + Resource Limits + Health Checks
### Files Created
- `infra/k8s/overlays/dev/kustomization.yaml` - Dev overlay configuration
- `infra/k8s/overlays/dev/patches/backend-resources.yaml` - Backend dev resource patch
- `infra/k8s/overlays/dev/patches/frontend-resources.yaml` - Frontend dev resource patch
- `frontend/src/app/api/health/route.ts` - Frontend health endpoint (was missing)
### Key Decisions
- **Resource Limits**: Dev overlay uses 50% of base resources:
- Requests: cpu=50m (vs base 100m), memory=128Mi (vs base 256Mi)
- Limits: cpu=200m (vs base 500m), memory=256Mi (vs base 512Mi)
- **Image Tags**: Set to `dev` for workclub-api and workclub-frontend
- **Namespace**: `workclub-dev` for isolation
- **Replicas**: All deployments set to 1 for dev environment
- **Frontend Health**: Created missing `/api/health` Next.js route handler
### Patterns Established
- **Strategic Merge Patches**: Target deployment by name, container name, then patch specific fields
- **Kustomize Overlay Structure**:
```
overlays/dev/
├── kustomization.yaml (references base, sets namespace, images, replicas, patches)
└── patches/ (strategic merge patches per service)
```
- **commonLabels**: Used `environment: development` label (deprecated warning but functional)
### Issues Encountered
1. **Missing kustomize**: Had to install via Homebrew (`brew install kustomize`)
2. **Missing Frontend Health Endpoint**: `/api/health` declared in base manifest but route didn't exist
- Created `frontend/src/app/api/health/route.ts` with simple `{ status: 'ok' }` response
3. **Deprecation Warning**: `commonLabels` is deprecated in favor of `labels` (non-blocking)
### Verification Results
✅ `kustomize build` succeeded (exit code 0)
✅ All deployments have `replicas: 1`
✅ Backend resources: cpu=50m-200m, memory=128Mi-256Mi
✅ Frontend resources: cpu=50m-200m, memory=128Mi-256Mi
✅ Image tags: `workclub-api:dev`, `workclub-frontend:dev`
✅ Namespace: `workclub-dev` applied to all resources
✅ Health check endpoints preserved: Backend `/health/*`, Frontend `/api/health`
✅ Evidence saved: `.sisyphus/evidence/task-25-kustomize-dev.yaml` (495 lines)
### Next Steps for Future Tasks
- Consider creating production overlay with higher resources
- May need to update `commonLabels` to `labels` to avoid deprecation warnings
- Frontend health endpoint is minimal - could enhance with actual health checks