func (b *Builder) WithGenerateStoresFunc(f ksmtypes.BuildStoresFunc, u bool) {
	b.buildStoresFunc = f
	b.useAPIServerCache = u
}
WithGenerateStoresFunc configures a custom generate store function
package store
import (
	"context"
	"reflect"
	"sort"
	"strconv"
	"strings"
	"github.com/pkg/errors"
	"github.com/prometheus/client_golang/prometheus"
	admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
	appsv1 "k8s.io/api/apps/v1"
	autoscaling "k8s.io/api/autoscaling/v2beta2"
	batchv1 "k8s.io/api/batch/v1"
	batchv1beta1 "k8s.io/api/batch/v1beta1"
	certv1 "k8s.io/api/certificates/v1"
	coordinationv1 "k8s.io/api/coordination/v1"
	v1 "k8s.io/api/core/v1"
	networkingv1 "k8s.io/api/networking/v1"
	policy "k8s.io/api/policy/v1beta1"
	storagev1 "k8s.io/api/storage/v1"
	vpaautoscaling "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta2"
	vpaclientset "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned"
	clientset "k8s.io/client-go/kubernetes"
	"k8s.io/client-go/tools/cache"
	"k8s.io/klog/v2"
	ksmtypes "k8s.io/kube-state-metrics/v2/pkg/builder/types"
	generator "k8s.io/kube-state-metrics/v2/pkg/metric_generator"
	metricsstore "k8s.io/kube-state-metrics/v2/pkg/metrics_store"
	"k8s.io/kube-state-metrics/v2/pkg/options"
	"k8s.io/kube-state-metrics/v2/pkg/sharding"
	"k8s.io/kube-state-metrics/v2/pkg/watch"
)
var _ ksmtypes.BuilderInterface = &Builder{}
type Builder struct {
	kubeClient           clientset.Interface
	vpaClient            vpaclientset.Interface
	namespaces           options.NamespaceList
	namespaceFilter      string
	ctx                  context.Context
	enabledResources     []string
	allowDenyList        ksmtypes.AllowDenyLister
	listWatchMetrics     *watch.ListWatchMetrics
	shardingMetrics      *sharding.Metrics
	shard                int32
	totalShards          int
	buildStoresFunc      ksmtypes.BuildStoresFunc
	allowAnnotationsList map[string][]string
	allowLabelsList      map[string][]string
	useAPIServerCache    bool
}
func NewBuilder() *Builder {
	b := &Builder{}
	return b
}
func (b *Builder) WithMetrics(r prometheus.Registerer) {
	b.listWatchMetrics = watch.NewListWatchMetrics(r)
	b.shardingMetrics = sharding.NewShardingMetrics(r)
}
func (b *Builder) WithEnabledResources(r []string) error {
	for _, col := range r {
		if !resourceExists(col) {
			return errors.Errorf("resource %s does not exist. Available resources: %s", col, strings.Join(availableResources(), ","))
		}
	}
	var copy []string
	copy = append(copy, r...)
	sort.Strings(copy)
	b.enabledResources = copy
	return nil
}
func (b *Builder) WithNamespaces(n options.NamespaceList, nsFilter string) {
	b.namespaces = n
	b.namespaceFilter = nsFilter
}
func (b *Builder) WithSharding(shard int32, totalShards int) {
	b.shard = shard
	labels := map[string]string{sharding.LabelOrdinal: strconv.Itoa(int(shard))}
	b.shardingMetrics.Ordinal.Reset()
	b.shardingMetrics.Ordinal.With(labels).Set(float64(shard))
	b.totalShards = totalShards
	b.shardingMetrics.Total.Set(float64(totalShards))
}
func (b *Builder) WithContext(ctx context.Context) {
	b.ctx = ctx
}
func (b *Builder) WithKubeClient(c clientset.Interface) {
	b.kubeClient = c
}
func (b *Builder) WithVPAClient(c vpaclientset.Interface) {
	b.vpaClient = c
}
func (b *Builder) WithAllowDenyList(l ksmtypes.AllowDenyLister) {
	b.allowDenyList = l
}