apiVersion: pool.kubevirt.io/v1alpha1
kind: VirtualMachinePool
metadata:
  name: fedora
spec:
  replicas: 1
  selector:
    matchLabels:
      kubevirt.io/vmpool: fedora
  virtualMachineTemplate:
    metadata:
      labels:
        kubevirt.io/vmpool: fedora
    spec:
      running: true
      template:
        spec:
          architecture: amd64
          domain:
            cpu:
              cores: 2
            devices:
#              autoattachSerialConsole: false
              disks:
                - disk:
                    bus: virtio
                  name: containerdisk
                - disk:
                    bus: virtio
                  name: cloudinitdisk
            memory:
              guest: 4G
            resources:   # Uncomment if you want to do manual overcommit
#              limits:
#                cpu: "0.02"
#              requests:
#                memory: 2G
          terminationGracePeriodSeconds: 0
          affinity:
            podAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
                - weight: 100
                  podAffinityTerm:
                    labelSelector:
                      matchExpressions:
                        - key: kubevirt.io/vmpool
                          operator: In
                          values:
                            - fedora
                    topologyKey: "kubernetes.io/hostname"
          volumes:
            - containerDisk:
                image: 'quay.io/containerdisks/fedora:39'
              name: containerdisk
            - cloudInitNoCloud:
                userData: |
                  #cloud-config
                  password: fedora
                  chpasswd: { expire: False }
                  runcmd:
                    - ["bash", "-c", "sleep $(( RANDOM % 60 )) ; dd if=/dev/vda of=/dev/null bs=1M count=4096"]
              name: cloudinitdisk
status: {}
