Situation
Developer teams shared a single, persistent staging environment for integration testing. This bottleneck caused frequent “staging deployment queues,” data pollution between competing feature branches, and high cloud costs from idle 24/7 staging resources.
Task
Architect an automated infrastructure system capable of instantly provisioning short-lived, isolated micro-staging environments on Kubernetes for every pull request, routing test traffic dynamically and destroying environments upon PR merge or close.
Action
- Dynamic Namespace & Helm Orchestration: Wrote a Go-based Kubernetes operator that reacted to GitHub webhook events, rendering parameterized Helm charts into ephemeral K8s namespaces in under 90 seconds.
- Wildcard Ingress & Service Mesh Routing: Configured Envoy and Traefik dynamic ingress routers with wildcard DNS (
*.pr-preview.internal) to route API traffic to isolated feature-branch containers using PR header metadata. - Automated TTL & Ephemeral Lifecycle Management: Built an automated garbage collection controller that tracked namespace activity, auto-scaling compute resources to zero after 30 minutes of inactivity and completely destroying teardown stacks upon branch closure.
Result
- Reduced staging infrastructure cloud expenditure by 55% through auto-scaling and aggressive TTL reclamation.
- Unblocked developer velocity by hosting over 100 concurrent isolated preview environments simultaneously without resource collisions.