036 Project 36: Proxmox Capacity Balancer
036 Build a Proxmox Capacity Balancer (Dry-Run)
Generate migration suggestions from overloaded nodes to healthier nodes.
Full main.go
package main
import "fmt"
type Node struct {
Name string
CPU float64
}
func main() {
nodes := []Node{
{"pve1", 0.92},
{"pve2", 0.35},
{"pve3", 0.41},
}
src := nodes[0]
dst := nodes[1]
for _, n := range nodes {
if n.CPU > src.CPU {
src = n
}
if n.CPU < dst.CPU {
dst = n
}
}
fmt.Printf("suggest migration: from %s -> %s (cpu %.2f -> %.2f)\n", src.Name, dst.Name, src.CPU, dst.CPU)
}Step-by-Step Explanation
- Collect node/resource metrics from API sources.
- Compute deterministic scores per target.
- Rank candidates by score and policy constraints.
- Produce dry-run placement/migration decisions.
- Apply gradually with canary and rollback plan.
Code Anatomy
- Data collection stage fetches capacity and load.
- Scoring stage turns metrics into comparable values.
- Decision stage emits ranked scheduling actions.
Learning Goals
- Build scheduling logic that is explainable and auditable.
- Balance utilization, reliability, and operational safety.
- Prepare for production-grade orchestration workflows.