A Kubernetes-native microservice that automates the creation of custom VM golden images for both Linux and Windows. Built with open-source technologies including KubeVirt, CDI, Rook-Ceph, and GitHub Actions.
- Automated VM Creation: Downloads and customizes base ISOs for Linux and Windows
- Unattended Setup: Injects cloud-init scripts for Linux and autounattend.xml for Windows
- Software Preloading: Preloads software and internal tools during image creation
- Windows Sysprep: Automatically syspreps and seals Windows images
- Persistent Storage: Stores golden images in Rook-Ceph persistent volumes
- GitHub Actions Integration: Trigger workflows via GitHub Actions for 5-minute automation
- Multi-Cluster Support: Reuse golden images across different Kubernetes clusters
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β GitHub Actions βββββΆβ GoldenPipe API βββββΆβ KubeVirt β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββββββ βββββββββββββββββββ
β CDI βββββΆβ Rook-Ceph β
β (Data Importer) β β (Storage) β
ββββββββββββββββββββ βββββββββββββββββββ
- Kubernetes cluster (1.20+)
- KubeVirt installed
- CDI (Containerized Data Importer) installed
- Rook-Ceph storage class available
# Install KubeVirt
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/v1.1.0/kubevirt-operator.yaml
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/v1.1.0/kubevirt-cr.yaml
# Install CDI
kubectl apply -f https://github.com/kubevirt/containerized-data-importer/releases/download/v1.55.0/cdi-operator.yaml
kubectl apply -f https://github.com/kubevirt/containerized-data-importer/releases/download/v1.55.0/cdi-cr.yaml
# Install Rook-Ceph (optional - use your preferred storage class)
kubectl apply -f https://raw.githubusercontent.com/rook/rook/v1.12.0/deploy/examples/crds.yaml
kubectl apply -f https://raw.githubusercontent.com/rook/rook/v1.12.0/deploy/examples/common.yaml
kubectl apply -f https://raw.githubusercontent.com/rook/rook/v1.12.0/deploy/examples/operator.yaml
kubectl apply -f https://raw.githubusercontent.com/rook/rook/v1.12.0/deploy/examples/cluster.yaml# Clone the repository
git clone https://github.com/your-org/goldenpipe.git
cd goldenpipe
# Build and deploy (recommended)
./build.sh --test --lint --deploy
# Or build locally only
./build.sh --local --test --lint
# Or use Make
make install-operators
make build docker-build
make k8s-apply# Check if GoldenPipe is running
kubectl get pods -n goldenpipe-system
# Test the API
kubectl port-forward service/goldenpipe 8080:80 -n goldenpipe-system
curl http://localhost:8080/api/v1/health# Create a Linux golden image
curl -X POST http://localhost:8080/api/v1/images \
-H "Content-Type: application/json" \
-d '{
"name": "ubuntu-22.04-golden",
"os_type": "linux",
"base_iso_url": "https://releases.ubuntu.com/22.04/ubuntu-22.04.3-desktop-amd64.iso",
"customizations": {
"packages": ["docker", "kubectl", "helm"],
"scripts": ["install-docker.sh", "configure-k8s.sh"]
}
}'
# Check the status
curl http://localhost:8080/api/v1/images/ubuntu-22.04-golden/status# Make the build script executable
chmod +x build.sh
# Build with tests and linting
./build.sh --test --lint
# Build and deploy to Kubernetes
./build.sh --test --lint --deploy
# Build for local development
./build.sh --local --test --lint
# Build with custom registry
./build.sh --registry my-registry.com --image my-goldenpipe --deploy# Install dependencies
make deps
# Run tests
make test
# Run linting
make lint
# Build application
make build
# Build Docker image
make docker-build
# Deploy to Kubernetes
make k8s-apply
# Check deployment status
make k8s-status
# View logs
make k8s-logs# 1. Install dependencies
cd microservice
go mod tidy
go mod download
# 2. Run tests
go test -v ./...
# 3. Build application
CGO_ENABLED=0 GOOS=linux go build -o bin/goldenpipe ./cmd/server
# 4. Build Docker image
docker build -t goldenpipe:latest ./microservice
# 5. Deploy to Kubernetes
kubectl apply -f k8s/base/
# 6. Check deployment
kubectl rollout status deployment/goldenpipe -n goldenpipe-systemGoldenPipe/
βββ microservice/ # Main Go application
β βββ cmd/ # Application entry points
β βββ internal/ # Internal packages
β β βββ api/ # REST API handlers
β β βββ kubevirt/ # KubeVirt integration
β β βββ cdi/ # CDI integration
β β βββ storage/ # Storage management
β β βββ vm/ # VM lifecycle management
β βββ pkg/ # Public packages
β βββ configs/ # Configuration files
β βββ Dockerfile # Container image
βββ k8s/ # Kubernetes manifests
β βββ base/ # Base configurations
β βββ overlays/ # Environment-specific overlays
β βββ operators/ # Operator installations
βββ scripts/ # Automation scripts
β βββ linux/ # Linux-specific scripts
β βββ windows/ # Windows-specific scripts
βββ .github/ # GitHub Actions
β βββ workflows/ # CI/CD workflows
βββ docs/ # Documentation
βββ build.sh # Build script
βββ Makefile # Make targets
βββ README.md # This file
# Set up development environment
make dev-setup
# Create local Kubernetes cluster
make dev-cluster
# Deploy to development cluster
make dev-deploy
# Test API endpoints
make test-api# Required
KUBECONFIG_PATH=/path/to/kubeconfig
STORAGE_CLASS=rook-ceph-block
NAMESPACE=goldenpipe-system
# Optional
LOG_LEVEL=info
API_PORT=8080
MAX_CONCURRENT_VMS=5- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run the test suite:
make test - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
MIT License - see LICENSE for details.