Kubeapiserver add my admission failed

Cluster information:

Kubernetes version:
Installation method:
Host OS: CentOS 7.6.1810

Hello all.
I add my admission for my CustomResource named virtualmachie in kubernetes, part of my admission code is below:

file: kubernetes/plugin/pkg/admission/vmparamscheck/admission.go

func shouldIgnore(a admission.Attributes) bool {
resource := a.GetResource().GroupResource()
if resource != v1.Resource(“virtualmachines”) {
klog.Infof(“shouldIgnore resource=%#v”, resource)
return true

vm, ok := a.GetObject().(*v1.VirtualMachine)  //always fail here , ok is false
if !ok {
	klog.Errorf("shouldIgnore translate runtime.object to v1.VirtualMachine failed")
	return true

return false


vm, ok := a.GetObject().(*v1.VirtualMachine) the translate here alawys failed here, ok is false, how can i fix it?

can anyone help?