[Workload]: chaos-migration
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- bash, kubernetes, linux
- Área
- devops, infrastructure
Línea de trabajo
Empieza comparando las implementaciones existentes de los workloads chaos-disk, chaos-network y chaos-process, y después sigue la configuración de los recursos del workload y la ruta de RequiresService(). Implementa la VM del controlador, los recursos RBAC y los scripts en /usr/local/bin/virtwork-chaos-migration.sh y /etc/systemd/system/virtwork-chaos-migration.service; se considera terminado cuando el workload puede descubrir los destinos, excluirse a sí mismo, activar y notificar migraciones, y gestionar claramente los destinos ausentes o los clústeres de un solo nodo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Workload Name
chaos-migration
Workload Description
Chaos workload that triggers live migrations on other virtwork-managed VMs at random intervals, testing partner product resilience to KubeVirt live migration events. Runs inside a dedicated "controller" VM and uses virtctl to initiate migrations on target VMs selected by label, producing a continuous stream of migration events — start, in-progress, completed, or failed — across the VM fleet.
This is a chaos variant in the same family as chaos-disk, chaos-network, and chaos-process, but operates at the platform level rather than inside a single VM. The existing chaos workloads inject faults within a VM (disk fill, network disruption, process kill). chaos-migration injects a platform-level disruption — live migration — that affects the VM's network identity, storage attachment, and node placement. Every partner product that runs alongside KubeVirt VMs must handle migrations correctly: monitoring agents must maintain metric continuity, storage drivers must handle disk re-attachment, network products must re-route traffic, and backup products must handle VMs moving between nodes.
Live migration is not a rare event on OpenShift — it's triggered by node drain (oc adm drain), cluster upgrades, resource rebalancing, and descheduler policies. Partners cannot claim KubeVirt support without validating migration resilience.
Tooling and Packages
- Tool:
virtctlCLI (KubeVirt client) for triggering migrations,kubectlfor label-based VM discovery - RPM packages: none —
virtctlandkubectlare single binary downloads - systemd service command:
/usr/local/bin/virtwork-chaos-migration.sh - Behavior loop:
- Discover virtwork-managed VMs in the target namespace via label selector (
app.kubernetes.io/managed-by=virtwork) - Exclude self (the chaos-migration VM) from targets
- Select a random target VM
- Trigger migration:
virtctl migrate <vm-name> -n <namespace> - Wait for migration to complete (or timeout)
- Log result (success, failure, duration)
- Sleep for configurable interval (randomized within a range)
- Repeat
- Discover virtwork-managed VMs in the target namespace via label selector (
- Configurable parameters:
migration-interval-min: minimum seconds between migrations (default: 120)migration-interval-max: maximum seconds between migrations (default: 600)migration-timeout: seconds to wait for a migration to complete (default: 300)migration-target-labels: additional label selector to filter target VMs (default: all virtwork VMs)migration-exclude-components: workload components to exclude from migration (default: none — butchaos-migrationalways excludes itself)migration-dry-run: log which VM would be migrated without triggering (default: false)
VM Count Model
Single VM (like cpu, memory, disk)
This workload is a "controller" VM — it doesn't generate resource pressure itself, it orchestrates disruptions on other VMs. It requires at least one other virtwork workload running in the same namespace to have migration targets. Intended to be deployed alongside other workloads: virtwork run --workloads cpu,disk,database,chaos-migration.
Required Resources
- Persistent storage (DataVolume)
- Kubernetes Service (for inter-VM communication)
- Kubernetes Secret (for credentials or config)
- Additional CPU/memory beyond defaults
- GPU or special device passthrough
The Secret holds a kubeconfig or ServiceAccount token with permissions to get/list VirtualMachines, get/list VirtualMachineInstances, and create VirtualMachineInstanceMigrations in the target namespace. The controller VM needs minimal resources (1 CPU, 512Mi memory) — it's running shell scripts, not generating load.
Cloud-Init Details
write_files:
- path: /usr/local/bin/virtwork-chaos-migration.sh
permissions: '0755'
content: |
#!/bin/bash
set -euo pipefail
NAMESPACE="${MIGRATION_NAMESPACE:-<namespace>}"
INTERVAL_MIN="${MIGRATION_INTERVAL_MIN:-120}"
INTERVAL_MAX="${MIGRATION_INTERVAL_MAX:-600}"
TIMEOUT="${MIGRATION_TIMEOUT:-300}"
EXCLUDE="${MIGRATION_EXCLUDE_SELF:-<self-vm-name>}"
KUBECONFIG="${KUBECONFIG:-/etc/virtwork/kubeconfig}"
DRY_RUN="${MIGRATION_DRY_RUN:-false}"
export KUBECONFIG
random_interval() {
echo $(( RANDOM % (INTERVAL_MAX - INTERVAL_MIN + 1) + INTERVAL_MIN ))
}
while true; do
# Discover running VMIs (exclude self)
TARGETS=$(kubectl get vmi -n "$NAMESPACE" \
-l app.kubernetes.io/managed-by=virtwork \
--field-selector=status.phase=Running \
-o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | \
grep -v "^${EXCLUDE}$" | grep -v "chaos-migration")
if [ -z "$TARGETS" ]; then
echo "$(date -Iseconds) No migration targets found, waiting..."
sleep 60
continue
fi
# Select random target
TARGET=$(echo "$TARGETS" | shuf -n1)
WAIT=$(random_interval)
if [ "$DRY_RUN" = "true" ]; then
echo "$(date -Iseconds) DRY-RUN: would migrate $TARGET (next in ${WAIT}s)"
sleep "$WAIT"
continue
fi
echo "$(date -Iseconds) Triggering migration of $TARGET"
START_TIME=$(date +%s)
# Trigger migration
if virtctl migrate "$TARGET" -n "$NAMESPACE" 2>&1; then
# Wait for migration to complete
MIGRATION_NAME=$(kubectl get vmim -n "$NAMESPACE" \
--sort-by=.metadata.creationTimestamp \
-o jsonpath='{.items[-1].metadata.name}' 2>/dev/null)
if [ -n "$MIGRATION_NAME" ]; then
kubectl wait vmim/"$MIGRATION_NAME" -n "$NAMESPACE" \
--for=jsonpath='{.status.phase}'=Succeeded \
--timeout="${TIMEOUT}s" 2>/dev/null && \
RESULT="succeeded" || RESULT="timeout-or-failed"
else
RESULT="no-migration-object"
fi
END_TIME=$(date +%s)
DURATION=$((END_TIME - START_TIME))
echo "$(date -Iseconds) Migration of $TARGET: $RESULT (${DURATION}s)"
else
echo "$(date -Iseconds) Migration trigger failed for $TARGET"
fi
echo "$(date -Iseconds) Next migration in ${WAIT}s"
sleep "$WAIT"
done
- path: /etc/systemd/system/virtwork-chaos-migration.service
content: |
[Unit]
Description=Virtwork chaos migration controller
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
Environment=MIGRATION_NAMESPACE=<namespace>
Environment=MIGRATION_INTERVAL_MIN=120
Environment=MIGRATION_INTERVAL_MAX=600
Environment=MIGRATION_TIMEOUT=300
Environment=MIGRATION_EXCLUDE_SELF=<self-vm-name>
ExecStart=/usr/local/bin/virtwork-chaos-migration.sh
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
runcmd:
- curl -Lo /usr/local/bin/virtctl https://github.com/kubevirt/kubevirt/releases/download/v1.7.0/virtctl-v1.7.0-linux-amd64
- chmod +x /usr/local/bin/virtctl
- curl -Lo /usr/local/bin/kubectl "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- chmod +x /usr/local/bin/kubectl
- systemctl enable --now virtwork-chaos-migration.service
Use Case
- Monitoring/Observability partners (Datadog, Dynatrace, Sysdig, Prometheus ecosystem): The #1 validation scenario. When a VM migrates, its metrics should show continuity — no gaps, no duplicate data points, correct node/host attribution before and after migration. Most monitoring agents track the host/node the VM runs on; migration changes this. Partners need repeated, unpredictable migrations to validate that their agents handle the topology change correctly. A single manual migration proves it works once;
chaos-migrationproves it works continuously. - Storage partners (CSI drivers): Live migration involves detaching and re-attaching the VM's storage on the destination node. For ReadWriteOnce (RWO) PVCs, this is a complex handoff. For ReadWriteMany (RWX) or shared storage, migration should be transparent. Partners need sustained migrations under active I/O (from
diskordatabaseworkloads) to validate that their CSI driver handles the storage handoff without data loss or corruption. - Network partners (CNI, OVN-Kubernetes, SDN): Migration moves the VM's network identity (pod IP, MAC address) to a new node. In-flight connections may be disrupted. Network partners need repeated migrations to validate that their CNI correctly handles IP re-assignment, that Services continue routing to the migrated VM, and that network policies remain enforced post-migration.
- Backup/DR partners: A VM that migrates during a backup window may cause backup failures (PVC attachment changes, VSS freeze/thaw disrupted). Partners need to validate that their backup product handles concurrent migration events gracefully — either pausing the backup, retrying, or completing without corruption.
- Platform engineering / SRE tooling: Validates that cluster operations (node drain, upgrade, rebalance) work correctly when VMs are running realistic workloads. The randomized migration interval simulates the unpredictable timing of real operational events.
Additional Context
- Relationship to existing chaos workloads: This follows the same pattern as
chaos-disk,chaos-network, andchaos-process:chaos-disk: injects disk-level faults inside a VMchaos-network: injects network faults inside a VMchaos-process: kills processes inside a VMchaos-migration: triggers platform-level disruption from a VM to other VMs
The key difference is thatchaos-migrationoperates externally on other VMs rather than internally on itself. This requires cluster API access (kubeconfig/ServiceAccount) that the other chaos workloads don't need.
- RBAC requirements: The chaos-migration VM needs a ServiceAccount with:
get,listonvirtualmachines.kubevirt.ioandvirtualmachineinstances.kubevirt.iocreateonvirtualmachineinstancemigrations.kubevirt.io- Scoped to the workload namespace via Role + RoleBinding
This is additional RBAC beyond what virtwork currently creates. The implementation should create these resources as part of the workload'sRequiresService()/ resource setup path.
- Self-exclusion: The chaos-migration VM must never migrate itself — migrating the controller disrupts the migration schedule. The script excludes its own VM name and any VM with "chaos-migration" in the name from the target list.
- Multi-node requirement: Live migration requires at least two schedulable nodes. On single-node clusters, migration will fail. The implementation should detect single-node clusters and either skip with a warning or fail fast with a clear message.
- Migration frequency tuning: The default range (120-600s, randomized) produces 6-30 migrations per hour across the fleet. For aggressive testing, set
migration-interval-min=30andmigration-interval-max=60to get near-continuous migrations. For background chaos, use the defaults. - Composability: This workload is designed to run alongside other workloads — it's the "chaos layer" on top of the "signal layer." The most valuable deployment pattern:
This produces sustained workload signals and continuous migration disruptions, validating that partner products maintain signal accuracy through platform events.virtwork run --workloads cpu,memory,disk,database,network,chaos-migration - Audit integration: Migration events (target VM, start time, result, duration) logged to stdout/journald are captured in the VM's journal. Consider also recording migration events in virtwork's audit database via a future audit API — but stdout logging is sufficient for initial implementation.
- virtctl version pinning: The cloud-init downloads a specific virtctl version. This should match the cluster's KubeVirt version. Consider making the virtctl version configurable or detecting it from the cluster.
- Lenguaje dominante
- Go
- Estrellas
- 0
- Forks
- 0
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de opdev/virtwork
-
good first issue needs-triage size/L workload-request workload/variant
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
-
[Workload]: disk-snapshotAbiertogood first issue needs-triage size/XL workload-request workload/variant
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
[Workload]: encryptionAbiertoneeds-triage size/L workload-request workload/tier-3
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
[Workload]: windowsAbiertoneeds-triage size/XXL workload-request workload/tier-3
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
[Workload]: gpu-computeAbiertoneeds-triage size/XL workload-request workload/tier-3
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
Todos los issues de opdev/virtwork
Issues similares
-
[Bug]: message-level cache_control on chat messages is dropped, so Anthropic prompt caching never triggersPosiblemente ocupada @Atharva-Kanherkar la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
-
documentation good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
eugenioenko/ttt#1000 ·
Los mantenedores suelen responder en 1 día
-
bug needs-acceptance wg/developer-experience-ecosystem
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
vllm-project/semantic-router#5249 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Billionmail/BillionMail#389 ·
-
在“产品文档”下拉列表,增加“探索”频道Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
DaoCloud/DaoCloud-docs#7489 ·
Los mantenedores suelen responder en 1 día