deckhouse/virtualization

VirtualMachineImage spec.storage: Unsupported value: "Kubernetes": supported values: "ContainerRegistry"

shyer opened this issue · 5 comments

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Version

v1.56.9

Expected Behavior

can store VirtualMachineImage on Kubernetes use custom storageClassName

Actual Behavior

The VirtualMachineImage "cirros-image-002" is invalid:

  • : Invalid value: "": "spec" must validate one and only one schema (oneOf). Found none valid
  • spec.storage: Unsupported value: "Kubernetes": supported values: "ContainerRegistry"

Steps To Reproduce

cirros-image-002.yaml

apiVersion: virtualization.deckhouse.io/v1alpha2
kind: VirtualMachineImage
metadata:
  name: cirros-image-002
  namespace: vms
spec:
  dataSource:
    type: HTTP
    http:
      url: "https://github.com/cirros-dev/cirros/releases/download/0.6.2/cirros-0.6.2-x86_64-disk.img"
  storage: Kubernetes

kubectl apply -f cirros-image-002.yaml

Additional Information

virtualmachineimage crd missing storage: Kubernetes and persistentVolumeClaim.storageClassName
https://github.com/deckhouse/virtualization/blob/main/crds/virtualmachineimage.yaml#L44

https://deckhouse.io/modules/virtualization/stable/examples.html#
image

Logs

No response

Thanks for the feedback. This is a bug in the documentation, we will fix it in the next version. For now we recommend to use storage: ContainerRegistry

we use rook ceph as storage, wish save image to ceph rbd block (stroageClass: ceph-block), then create VirtualMachineDisk from VirtualMachineImage store in ceph-block. we assume it use rbd clone like openstack to skip copy image to host node (windows image is too large)

i create a VirtualMachineDisk from VirtualMachineImage(use storage: Kubernetes),it allways in Pending state.

apiVersion: virtualization.deckhouse.io/v1alpha2
kind: VirtualMachineDisk
metadata:
  name: cirros-003-boot
  namespace: vms
spec:
  persistentVolumeClaim:
    size: 200Mi
    storageClassName: ceph-block
  dataSource:
    type: VirtualMachineImage
    virtualMachineImage:
      name: cirros-002

in code, seem like no logic for storage: Kubernetes, so storage: Kubernetes will not support in next version?
https://github.com/deckhouse/virtualization/blob/main/images/virtualization-artifact/pkg/controller/vmd_datavolume.go#L138

	case ds != nil && ds.Type == virtv2.DataSourceTypeVirtualMachineImage:
		vmiRef := ds.VirtualMachineImage
		dvcrSourceImageName := r.dvcrSettings.RegistryImageForVMI(vmiRef.Name, vmd.Namespace)
		dvBuilder.SetRegistryDataSource(dvcrSourceImageName, authSecretName, caBundleName)
	case vmdutil.IsBlankPVC(vmd):

Kubernetes storage support for VMI will not be available yet, at least not in the next version, there are some issues that need to be resolved before it will be in the release.

fl64 commented

I apologize for the long wait, this feature is planned for implementation. I will report here as soon as it is ready.