vm-operator icon indicating copy to clipboard operation
vm-operator copied to clipboard

Provide user feedback when no storage class is specified

Open aruneshpa opened this issue 2 years ago • 1 comments

What steps did you take and what happened? Storage class is effectively a mandatory parameter when it comes to creating a VM on Supervisor (which is the only platform supported by VM operator at the moment). However, this is not enforced using validation webhooks. Instead, if storage class is not specified in the VM's spec, the VM is never realized. We do emit logs that the storage policy is required, but not specified. Since developers don't have access to logs in production, this is not helpful.

What did you expect to happen? A clear feedback to user about the required storage class. Possibly even rejecting the request outright.

Is there anything else you would like to add? Here's the output from the logs when storage class is not specified:

E0907 02:16:05.359503       1 virtualmachine_controller.go:378] VirtualMachine "msg"="Failed to reconcile VirtualMachine" "error"="StorageClass is required but not specified" "name"="tkg-ns-auto/test-vm"

We need to either modify our validation webhooks to reject such requests (might be a breaking change). Or, emit a condition indicating this issue.

aruneshpa avatar Sep 07 '23 02:09 aruneshpa

Looks like v1a2 is handling this err in both validation: https://github.com/vmware-tanzu/vm-operator/blob/main/webhooks/virtualmachine/v1alpha2/validation/virtualmachine_validator.go#L277 and condition: https://github.com/vmware-tanzu/vm-operator/blob/be66239ac8ce586f2f218685ef9cb5359ad9f4e2/pkg/vmprovider/providers/vsphere2/vmprovider_vm.go#L758 Do we still need this issue? @aruneshpa

zyiyi11 avatar Oct 04 '23 22:10 zyiyi11