code: func (h *RegistrationHandler) ValidatePlugin(pluginName string, endpoint string, versions []string, foundInDeprecatedDir bool) error {
  	klog.Infof(log("Trying to validate a new CSI Driver with name: %s endpoint: %s versions: %s, foundInDeprecatedDir: %v",
  		pluginName, endpoint, strings.Join(versions, ","), foundInDeprecatedDir))
  
  	if foundInDeprecatedDir {
  		// CSI 0.x drivers used /var/lib/kubelet/plugins as the socket dir.
  		// This was deprecated as the socket dir for kubelet drivers, in lieu of a dedicated dir /var/lib/kubelet/plugins_registry
  		// The deprecated dir will only be allowed for a whitelisted set of old versions.
  		// CSI 1.x drivers should use the /var/lib/kubelet/plugins_registry
  		if !isDeprecatedSocketDirAllowed(versions) {
  			err := fmt.Errorf("socket for CSI driver %q versions %v was found in a deprecated dir. Drivers implementing CSI 1.x+ must use the new dir", pluginName, versions)
  			klog.Error(err)
  			return err
  		}
  	}
  
  	_, err := h.validateVersions("ValidatePlugin", pluginName, endpoint, versions)
  	return err
  }
docs: // ValidatePlugin is called by kubelet's plugin watcher upon detection
  // of a new registration socket opened by CSI Driver registrar side car.