func NewResourceWatcher(config *restclient.Config,
	storeConfig StoreConfig, excludedNamespaces []string) ResourceWatcher {
	var err error
	resourceWatcher := ResourceWatcher{}
	resourceWatcher.clientset, err = kubernetes.NewForConfig(config)
	util.FatalIf(err)
	resourceWatcher.storeConfig = storeConfig
	resourceWatcher.excludedNamespaces = make([]*regexp.Regexp, len(excludedNamespaces))
	for i, ns := range excludedNamespaces {
		rg, err := regexp.Compile(ns)
		util.FatalIf(err)
		resourceWatcher.excludedNamespaces[i] = rg
	}
	glog.Infof("%d Namespaces will be excluded: %s", len(excludedNamespaces), excludedNamespaces)
	return resourceWatcher
}
NewResourceWatcher creates a new resource watcher on a given cluster
package resourcewatcher
import (
	"context"
	"path"
	"strings"
	"time"
	"kubectlfzf/pkg/k8sresources"
	"kubectlfzf/pkg/util"
	"regexp"
	"github.com/golang/glog"
	appsv1 "k8s.io/api/apps/v1"
	autoscalingv1 "k8s.io/api/autoscaling/v1"
	batchv1 "k8s.io/api/batch/v1"
	batchbetav1 "k8s.io/api/batch/v1beta1"
	corev1 "k8s.io/api/core/v1"
	betav1 "k8s.io/api/extensions/v1beta1"
	apimeta "k8s.io/apimachinery/pkg/api/meta"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/fields"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/client-go/kubernetes"
	_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
	restclient "k8s.io/client-go/rest"
	"k8s.io/client-go/tools/cache"
)
type ResourceWatcher struct {
	clientset          *kubernetes.Clientset
	namespaces         []string  
	excludedNamespaces []*regexp.Regexp
	cluster            string
	cancelFuncs        []context.CancelFunc
	storeConfig        StoreConfig
}
type WatchConfig struct {
	resourceCtor      func(obj interface{}, config k8sresources.CtorConfig) k8sresources.K8sResource
	header            string
	resourceName      string
	getter            cache.Getter
	runtimeObject     runtime.Object
	hasNamespace      bool
	splitByNamespaces bool
	pollingPeriod     time.Duration
}