Progressive Deployment Operator for Kubernetes
BGswitch is a Kubernetes operator that automates safe, progressive deployments with automatic traffic shifting, health monitoring, and rollback capabilities. Deploy with confidence using canary analysis and blue-green strategies.
Kubernetes rolling updates are risky:
- No gradual traffic shifting
- Limited health validation
- Manual rollback process
- No metric-based decision making
Result: Failed deployments cause downtime and impact users.
BGswitch automates progressive deployments:
- 🔄 Gradual traffic shifting (10% → 25% → 50% → 100%)
- 📊 Metric-based health validation (Prometheus integration)
- ⚡ Automatic rollback on failures
- 🎛️ Manual promotion controls
- 📈 Real-time deployment status
# Install the operator
kubectl apply -f https://raw.githubusercontent.com/ghanatava/bgswitch/main/deploy/operator.yaml
# Verify installation
kubectl get pods -n bgswitch-systemapiVersion: bgswitch.dev/v1alpha1
kind: ProgressiveDeployment
metadata:
name: my-app
spec:
targetDeployment: my-app
canarySteps: [10, 25, 50, 100]
stepDuration: 5m
metrics:
errorRate:
threshold: 1.0
query: "rate(http_requests_errors_total{app='my-app'}[5m])"
latency:
threshold: 500
query: "histogram_quantile(0.95, http_request_duration_seconds{app='my-app'})"
autoPromote: truekubectl apply -f my-progressive-deployment.yaml
# Watch progress
kubectl get progressivedeployment my-app -wStable (v1.0) [████████████] 100%
↓
Step 1 - Analyze [███████████░] 90% stable, 10% canary
↓ Metrics OK?
Step 2 - Promote [████████░░░░] 75% stable, 25% canary
↓ Metrics OK?
Step 3 - Promote [█████░░░░░░░] 50% stable, 50% canary
↓ Metrics OK?
Step 4 - Complete [░░░░░░░░░░░░] 100% canary → new stable
If metrics degrade at any step:
[██████░░] Rollback initiated → [████████████] Stable restored
- Define custom canary steps (e.g., 5%, 10%, 25%, 50%, 100%)
- Configurable duration per step
- Replica-based traffic distribution
- Prometheus metric integration
- Custom PromQL queries
- Error rate tracking
- Latency monitoring
- Custom metric thresholds
- Detects metric degradation
- Instant rollback to stable version
- Preserves original deployment
- Detailed rollback reasons
# Promote to next step
kubectl bgswitch promote my-app
# Rollback immediately
kubectl bgswitch rollback my-app
# Pause progression
kubectl bgswitch pause my-app
# Get status
kubectl bgswitch status my-app- Go 1.21+
- Docker
- kubectl
- kind (for local testing)
# Clone repository
git clone https://github.com/ghanatava/bgswitch.git
cd bgswitch
# Install dependencies
make install
# Run locally
make run
# Build operator image
make docker-build
# Run tests
make test# Create local cluster
make cluster-up
# Install operator
make deploy
# Run example
kubectl apply -f examples/demo-app/
# Cleanup
make cluster-downv0.1.0 (Current)
- Basic canary deployments
- Replica-based traffic shifting
- Prometheus integration
- Auto-rollback
v0.2.0 (Planned)
- Istio/Service Mesh integration for precise traffic control
- Webhook-based notifications (Slack, Discord)
- Advanced metric analysis (statistical tests)
- Multi-metric weighted decisions
v0.3.0 (Future)
- Blue-Green deployment strategy
- A/B testing support
- Custom webhook integrations
- Dashboard UI
Inspired by:
- Flagger - Progressive delivery toolkit
- Argo Rollouts - Advanced deployment strategies
- Spinnaker - Continuous delivery platform
- GitHub Issues: Report bugs or request features
- Discussions: Ask questions
Built with ❤️ by [Ghanatava]
Making Kubernetes deployments safe and simple.