Sandworm

Scheduler de workloads

Sandworm distribuye workloads entre los nodos del cluster usando un algoritmo de bin-packing optimizado. Solo el nodo líder ejecuta el scheduler activamente — si hay failover, el nuevo líder retoma el scheduling automáticamente.

Job file

hcl
job "patient-api" {
  replicas = 3
  image    = "registry.local/patient-api:v2.1"
  port     = 8080

  resources {
    cpu    = 500    # MHz reservados
    memory = 256    # MB reservados
  }

  health_check {
    path     = "/health"
    interval = "10s"
    timeout  = "5s"
  }

  deploy {
    strategy   = "rolling"    # rolling | canary | blue-green
    max_surge  = 1
    min_healthy = 2
  }

  constraint {
    attribute = "node.zone"
    operator  = "distinct"    # spread entre zonas
  }
}

CLI

bash
# Desplegar
dune deploy -f patient-api.dune
# ✦ Evaluating placement...
# ✦ Selected: prod-01, prod-02, prod-03
# ✦ Rolling deploy: 1/3 → 2/3 → 3/3
# ✦ All health checks passing.

# Ver workloads
dune workloads list
# SERVICE        REPLICAS  STATUS      NODE
# patient-api    3/3       running     prod-01,02,03
# lab-svc        2/2       running     prod-01,02
# gateway        3/3       running     prod-01,02,03

# Escalar
dune scale patient-api --replicas 5

# Rollback
dune rollback patient-api --to v2.0