code: func CreateLocalPVSpec(config *LocalPVConfig) *v1.PersistentVolume {
  	pv := &v1.PersistentVolume{
  		ObjectMeta: metav1.ObjectMeta{
  			Name:   config.Name,
  			Labels: config.Labels,
  			Annotations: map[string]string{
  				AnnProvisionedBy: config.ProvisionerName,
  			},
  		},
  		Spec: v1.PersistentVolumeSpec{
  			PersistentVolumeReclaimPolicy: config.ReclaimPolicy,
  			Capacity: v1.ResourceList{
  				v1.ResourceName(v1.ResourceStorage): *resource.NewQuantity(int64(config.Capacity), resource.BinarySI),
  			},
  			PersistentVolumeSource: v1.PersistentVolumeSource{
  				Local: &v1.LocalVolumeSource{
  					Path:   config.HostPath,
  					FSType: config.FsType,
  				},
  			},
  			AccessModes: []v1.PersistentVolumeAccessMode{
  				v1.ReadWriteOnce,
  			},
  			StorageClassName: config.StorageClass,
  			VolumeMode:       &config.VolumeMode,
  			MountOptions:     config.MountOptions,
  		},
  	}
  	if config.UseAlphaAPI {
  		pv.ObjectMeta.Annotations[AlphaStorageNodeAffinityAnnotation] = config.AffinityAnn
  	} else {
  		pv.Spec.NodeAffinity = config.NodeAffinity
  	}
  	return pv
  }
docs: // CreateLocalPVSpec returns a PV spec that can be used for PV creation