Skip to content

VirtRigaud Examples

This directory contains comprehensive examples for VirtRigaud v0.2.3+, showcasing all features and capabilities.

Quick Start Examples

Basic Examples

Provider Examples

Resource Examples

v0.2.1 Feature Examples

New in v0.2.1

Advanced Provider Examples

Multi-Provider Examples

v0.2.3 Feature Summary

🔧 VM Reconfiguration (vSphere, Libvirt, Proxmox)

# Online resource changes (vSphere, Proxmox)
# Offline changes (Libvirt - requires restart)
spec:
  vmClassRef: medium  # Change from small to medium
  powerState: "On"

📋 Async Task Tracking (vSphere, Proxmox)

# Automatic tracking of long-running operations
# Real-time progress and error reporting

🖥️ Console Access (vSphere, Libvirt)

# Web console URLs automatically generated
status:
  consoleURL: "https://vcenter.example.com/ui/app/vm..."  # vSphere
  # or
  consoleURL: "vnc://libvirt-host:5900"  # Libvirt VNC

🌐 Guest Agent Integration (Proxmox)

# Accurate IP detection via QEMU guest agent
status:
  ipAddresses:
    - 192.168.1.100
    - fd00::1234:5678:9abc:def0

📦 VM Cloning (vSphere)

# Full and linked clones with automatic snapshot handling
spec:
  vmImageRef: source-vm
  cloneType: linked  # or "full"

🔄 Previous Features (v0.2.1)

  • Graceful Shutdown: OffGraceful power state with VMware Tools
  • Hardware Version Management: vSphere hardware version control
  • Proper Disk Sizing: Correct disk allocation across providers
  • Enhanced Lifecycle Management: postStart/preStop hooks

Usage Patterns

Testing v0.2.3 Features

  1. Test VM reconfiguration:

    # Change VM class to trigger reconfiguration
    kubectl patch virtualmachine my-vm --type='merge' \
      -p='{"spec":{"vmClassRef":"medium"}}'
    
    # Watch the reconfiguration process
    kubectl get vm my-vm -w
    

  2. Access VM console:

    # Get console URL from VM status
    kubectl get vm my-vm -o jsonpath='{.status.consoleURL}'
    
    # For VNC (Libvirt): Use any VNC client
    vncviewer $(kubectl get vm my-vm -o jsonpath='{.status.consoleURL}' | sed 's/vnc:\/\///')
    

  3. Monitor async tasks (vSphere, Proxmox):

    # Watch task progress in provider logs
    kubectl logs -f deployment/virtrigaud-provider-vsphere
    

  4. Verify guest agent (Proxmox):

    # Check IP addresses from guest agent
    kubectl get vm my-vm -o jsonpath='{.status.ipAddresses}'
    

  5. Test VM cloning (vSphere):

    # Create a clone of existing VM
    kubectl apply -f - <<EOF
    apiVersion: infra.virtrigaud.io/v1beta1
    kind: VirtualMachine
    metadata:
      name: web-server-clone
    spec:
      vmClassRef: small
      vmImageRef: web-server-01
      cloneType: linked
    EOF
    

Development Workflow

  1. Choose base example based on your use case
  2. Customize provider, class, and VM specifications
  3. Test locally with your infrastructure
  4. Iterate based on your requirements

Production Deployment

  1. Start with complete-example.yaml
  2. Add security configurations from security/ subdirectory
  3. Configure secrets from secrets/ subdirectory
  4. Apply advanced patterns from advanced/ subdirectory

File Organization

docs/examples/
├── README.md                          # This file
├── complete-example.yaml             # Complete setup guide
├── v021-feature-showcase.yaml        # 🌟 v0.2.1 comprehensive demo
├── vm-ubuntu-small.yaml             # Simple VM example
├── vmclass-small.yaml               # Basic VMClass
├── provider-*.yaml                  # Provider configurations
├── graceful-shutdown-examples.yaml  # OffGraceful demos
├── vsphere-hardware-versions.yaml   # Hardware version examples
├── disk-sizing-examples.yaml        # Disk sizing tests
├── advanced/                        # Complex scenarios
├── secrets/                         # Secret management
└── security/                        # Security configurations

Version Compatibility

  • v0.2.3+: All examples with v0.2.3 features (Reconfigure, Clone, TaskStatus, ConsoleURL, Guest Agent)
  • v0.2.2: Nested virtualization, TPM support, snapshot management
  • v0.2.1: Graceful shutdown, hardware version, disk sizing fixes
  • v0.2.0: Initial production-ready providers
  • v0.1.x: Legacy examples in git history

Need Help?


Pro Tip: Start with v021-feature-showcase.yaml to see all v0.2.1 capabilities in action! 🚀