func (k *Kubeclient) Create(pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error) {
	cli, err := k.getClientsetOrCached()
	if err != nil {
		return nil, errors.Wrapf(err, "failed to create pv: %s", stringer.Yaml("persistent volume", pv))
	}
	return k.create(cli, pv, metav1.CreateOptions{})
}
Create creates a pv in kubernetes cluster
package persistentvolume
import (
	"context"
	"strings"
	stringer "github.com/openebs/maya/pkg/apis/stringer/v1alpha1"
	errors "github.com/pkg/errors"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"github.com/openebs/dynamic-nfs-provisioner/pkg/kubernetes/client"
	"k8s.io/client-go/kubernetes"
)
const (
	KeyNode = "kubernetes.io/hostname"
)
type getClientsetFn func() (clientset *kubernetes.Clientset, err error)
type getClientsetForPathFn func(kubeConfigPath string) (clientset *kubernetes.Clientset, err error)
type getFn func(cli *kubernetes.Clientset, name string, opts metav1.GetOptions) (*corev1.PersistentVolume, error)
type listFn func(cli *kubernetes.Clientset, opts metav1.ListOptions) (*corev1.PersistentVolumeList, error)
type deleteFn func(cli *kubernetes.Clientset, name string, deleteOpts *metav1.DeleteOptions) error
type deleteCollectionFn func(cli *kubernetes.Clientset, listOpts metav1.ListOptions, deleteOpts *metav1.DeleteOptions) error
type createFn func(cli *kubernetes.Clientset, pv *corev1.PersistentVolume, createOpts metav1.CreateOptions) (*corev1.PersistentVolume, error)
type Kubeclient struct {
	clientset *kubernetes.Clientset
	kubeConfigPath string
	getClientset        getClientsetFn
	getClientsetForPath getClientsetForPathFn
	list                listFn
	get                 getFn
	create              createFn
	del                 deleteFn
	delCollection       deleteCollectionFn
}
type KubeclientBuildOption func(*Kubeclient)
func (k *Kubeclient) withDefaults() {
	if k.getClientset == nil {
		k.getClientset = func() (clients *kubernetes.Clientset, err error) {
			return client.New().Clientset()
		}
	}
	if k.getClientsetForPath == nil {
		k.getClientsetForPath = func(kubeConfigPath string) (clients *kubernetes.Clientset, err error) {
			return client.New(client.WithKubeConfigPath(kubeConfigPath)).Clientset()
		}
	}
	if k.get == nil {
		k.get = func(cli *kubernetes.Clientset, name string, opts metav1.GetOptions) (*corev1.PersistentVolume, error) {
			return cli.CoreV1().PersistentVolumes().Get(context.TODO(), name, opts)
		}
	}
	if k.list == nil {
		k.list = func(cli *kubernetes.Clientset, opts metav1.ListOptions) (*corev1.PersistentVolumeList, error) {
			return cli.CoreV1().PersistentVolumes().List(context.TODO(), opts)
		}
	}
	if k.del == nil {
		k.del = func(cli *kubernetes.Clientset, name string, deleteOpts *metav1.DeleteOptions) error {
			return cli.CoreV1().PersistentVolumes().Delete(context.TODO(), name, *deleteOpts)
		}
	}
	if k.delCollection == nil {
		k.delCollection = func(cli *kubernetes.Clientset, listOpts metav1.ListOptions, deleteOpts *metav1.DeleteOptions) error {
			return cli.CoreV1().PersistentVolumes().DeleteCollection(context.TODO(), *deleteOpts, listOpts)
		}
	}
	if k.create == nil {
		k.create = func(cli *kubernetes.Clientset, pv *corev1.PersistentVolume, createOpts metav1.CreateOptions) (*corev1.PersistentVolume, error) {
			return cli.CoreV1().PersistentVolumes().Create(context.TODO(), pv, createOpts)
		}
	}
}
func WithClientSet(c *kubernetes.Clientset) KubeclientBuildOption {
	return func(k *Kubeclient) {
		k.clientset = c
	}
}
func WithKubeConfigPath(path string) KubeclientBuildOption {
	return func(k *Kubeclient) {
		k.kubeConfigPath = path
	}
}
func NewKubeClient(opts ...KubeclientBuildOption) *Kubeclient {
	k := &Kubeclient{}
	for _, o := range opts {
		o(k)
	}
	k.withDefaults()
	return k
}
func (k *Kubeclient) getClientsetForPathOrDirect() (*kubernetes.Clientset, error) {
	if k.kubeConfigPath != "" {
		return k.getClientsetForPath(k.kubeConfigPath)
	}
	return k.getClientset()
}
func (k *Kubeclient) getClientsetOrCached() (*kubernetes.Clientset, error) {
	if k.clientset != nil {
		return k.clientset, nil
	}
	cs, err := k.getClientsetForPathOrDirect()
	if err != nil {
		return nil, errors.Wrapf(err, "failed to get clientset")
	}
	k.clientset = cs
	return k.clientset, nil
}
func (k *Kubeclient) Get(name string, opts metav1.GetOptions) (*corev1.PersistentVolume, error) {
	if strings.TrimSpace(name) == "" {
		return nil, errors.New("failed to get pv: missing pv name")
	}
	cli, err := k.getClientsetOrCached()
	if err != nil {
		return nil, errors.Wrapf(err, "failed to get pv {%s}", name)
	}
	return k.get(cli, name, opts)
}
func (k *Kubeclient) List(opts metav1.ListOptions) (*corev1.PersistentVolumeList, error) {
	cli, err := k.getClientsetOrCached()
	if err != nil {
		return nil, errors.Wrapf(err, "failed to list pv listoptions: '%v'", opts)
	}
	return k.list(cli, opts)
}
func (k *Kubeclient) Delete(name string, deleteOpts *metav1.DeleteOptions) error {
	if strings.TrimSpace(name) == "" {
		return errors.New("failed to delete pvc: missing pv name")
	}
	cli, err := k.getClientsetOrCached()
	if err != nil {
		return errors.Wrapf(err, "failed to delete pv {%s}", name)
	}
	return k.del(cli, name, deleteOpts)
}