Create ephemeral preview environment for feature branch testing with unique URL and Keycloak client
Creates ephemeral preview environments for feature branches with isolated URLs and Keycloak clients.
/plugin marketplace add Lobbi-Docs/claude/plugin install lobbi-docs-aws-eks-helm-keycloak-plugins-aws-eks-helm-keycloak@Lobbi-Docs/claudeCreate an isolated preview environment for your feature branch with its own URL and Keycloak configuration.
/eks:preview [options]
--branch - Branch to deploy (default: current branch)--service - Service to preview (default: auto-detect)--ttl - Time-to-live before auto-cleanup (default: 24h)--base-env - Base environment for config (default: dev)--keycloak - Create preview Keycloak client (default: true)--seed-data - Include seed data (default: false)--notify - Send notification with preview URL (default: true)--pr - Link to PR number for auto-cleanup on merge/eks:preview
Creates preview for current Git branch.
/eks:preview --branch=feature/new-auth
/eks:preview --ttl=72h
/eks:preview --pr=142
Auto-cleanup when PR #142 is merged/closed.
/eks:preview --seed-data
PREVIEW ENVIRONMENT: feature-new-auth-abc12
═════════════════════════════════════════════════════════════════════════
🌐 NAMESPACE: preview-feature-new-auth-abc12
📦 DEPLOYED SERVICES:
└── api-gateway (from feature/new-auth)
🔗 ACCESS:
├── URL: https://preview-abc12.dev.example.com
└── API: https://api-preview-abc12.dev.example.com
🔐 KEYCLOAK:
├── Client ID: preview-abc12-client
├── Realm: development
└── Redirect: https://preview-abc12.dev.example.com/*
⏰ LIFECYCLE:
├── Created: 2024-01-15 10:30 UTC
├── TTL: 24 hours
├── Expires: 2024-01-16 10:30 UTC
└── Linked PR: #142 (auto-cleanup on merge)
🧑💻 TEST CREDENTIALS:
├── Username: testuser
└── Password: testpass
═════════════════════════════════════════════════════════════════════════
┌─────────────────────────────────────────────────────────────────────┐
│ EKS Dev Cluster │
├─────────────────────────────────────────────────────────────────────┤
│ ┌──────────────────────┐ ┌──────────────────────┐ │
│ │ main namespace │ │ preview-abc12 │ ← Isolated │
│ │ ───────────────── │ │ ─────────────────── │ │
│ │ api-gateway (main) │ │ api-gateway (PR) │ │
│ │ user-service │ │ (shared deps) │ │
│ │ payment-service │ │ │ │
│ └──────────────────────┘ └──────────────────────┘ │
│ │
│ Ingress: *.dev.example.com │
│ ├── api-gateway.dev.example.com → main/api-gateway │
│ └── preview-abc12.dev.example.com → preview-abc12/api-gateway │
└─────────────────────────────────────────────────────────────────────┘
Each preview gets its own Keycloak client:
{
"clientId": "preview-abc12-client",
"enabled": true,
"redirectUris": [
"https://preview-abc12.dev.example.com/*"
],
"webOrigins": [
"https://preview-abc12.dev.example.com"
],
"attributes": {
"preview.branch": "feature/new-auth",
"preview.pr": "142",
"preview.expires": "2024-01-16T10:30:00Z"
}
}
This command activates the dev-assistant agent for creation and troubleshooting.
Generate Preview ID
Create Namespace
Configure Keycloak
Deploy Service
Verify & Report
/eks:preview --cleanup=preview-abc12
/eks:preview --list
Output:
ACTIVE PREVIEW ENVIRONMENTS
═══════════════════════════════════════════════════════════════════════
ID BRANCH PR CREATED EXPIRES
──────────────────────────────────────────────────────────────────────
preview-abc12 feature/new-auth 142 2h ago 22h
preview-def34 fix/payment-bug 156 5h ago 19h
preview-ghi56 feature/dashboard - 1d ago Expired
Total: 3 previews (1 expired)
When linked to a PR (--pr=142):
On PR Update
On PR Merge
PR Comments
Preview environments have restricted resources:
resourceQuota:
requests.cpu: "2"
requests.memory: "4Gi"
limits.cpu: "4"
limits.memory: "8Gi"
pods: "20"
limitRange:
default:
cpu: "200m"
memory: "256Mi"
max:
cpu: "1"
memory: "1Gi"
| Issue | Solution |
|---|---|
| Preview URL not accessible | Check ingress configuration, verify DNS |
| Pods not starting | Check resource quota, review events |
| Keycloak auth fails | Verify client redirect URIs |
| Auto-cleanup not working | Check CronJob, verify TTL annotation |