func NewClient(config *rest.Config, resync time.Duration, stopCh <-chan struct{}, log logr.Logger) (*Client, error) {
	dclient, err := dynamic.NewForConfig(config)
	if err != nil {
		return nil, err
	}
	kclient, err := kubernetes.NewForConfig(config)
	if err != nil {
		return nil, err
	}
	client := Client{
		client:       dclient,
		clientConfig: config,
		kclient:      kclient,
		log:          log.WithName("dclient"),
	}
	discoveryClient := &ServerPreferredResources{
		cachedClient: memory.NewMemCacheClient(kclient.Discovery()),
		log:          client.log,
	}
	go discoveryClient.Poll(resync, stopCh)
	client.SetDiscovery(discoveryClient)
	return &client, nil
}
NewClient creates new instance of client
package client
import (
	"context"
	"fmt"
	"strings"
	"time"
	"github.com/go-logr/logr"
	openapiv2 "github.com/googleapis/gnostic/openapiv2"
	meta "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	patchTypes "k8s.io/apimachinery/pkg/types"
	"k8s.io/apimachinery/pkg/version"
	"k8s.io/client-go/discovery"
	"k8s.io/client-go/discovery/cached/memory"
	"k8s.io/client-go/dynamic"
	"k8s.io/client-go/dynamic/dynamicinformer"
	"k8s.io/client-go/kubernetes"
	csrtype "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
	event "k8s.io/client-go/kubernetes/typed/core/v1"
	"k8s.io/client-go/rest"
)
type Client struct {
	client          dynamic.Interface
	log             logr.Logger
	clientConfig    *rest.Config
	kclient         kubernetes.Interface
	DiscoveryClient IDiscovery
}