Skip to content

Commit 583d8c9

Browse files
authored
Merge pull request #1548 from liangyuanpeng/feature_support_apiservercache
Add arg use-api-server-cache to set resourceVersion=0 for ListWatch
2 parents 16e8f54 + 78775b0 commit 583d8c9

8 files changed

Lines changed: 81 additions & 60 deletions

File tree

docs/cli-arguments.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Usage of ./kube-state-metrics:
5454
--telemetry-port int Port to expose kube-state-metrics self metrics on. (default 8081)
5555
--tls-config string Path to the TLS configuration file
5656
--total-shards int The total number of shards. Sharding is disabled when total shards is set to 1. (default 1)
57+
--use-apiserver-cache Sets resourceVersion=0 for ListWatch requests, using cached resources from the apiserver instead of an etcd quorum read.
5758
-v, --v Level number for the log level verbosity
5859
--version kube-state-metrics build version information
5960
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

internal/store/builder.go

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,19 @@ var _ ksmtypes.BuilderInterface = &Builder{}
5757
// Builder helps to build store. It follows the builder pattern
5858
// (https://en.wikipedia.org/wiki/Builder_pattern).
5959
type Builder struct {
60-
kubeClient clientset.Interface
61-
vpaClient vpaclientset.Interface
62-
namespaces options.NamespaceList
63-
ctx context.Context
64-
enabledResources []string
65-
allowDenyList ksmtypes.AllowDenyLister
66-
listWatchMetrics *watch.ListWatchMetrics
67-
shardingMetrics *sharding.Metrics
68-
shard int32
69-
totalShards int
70-
buildStoresFunc ksmtypes.BuildStoresFunc
71-
allowLabelsList map[string][]string
60+
kubeClient clientset.Interface
61+
vpaClient vpaclientset.Interface
62+
namespaces options.NamespaceList
63+
ctx context.Context
64+
enabledResources []string
65+
allowDenyList ksmtypes.AllowDenyLister
66+
listWatchMetrics *watch.ListWatchMetrics
67+
shardingMetrics *sharding.Metrics
68+
shard int32
69+
totalShards int
70+
buildStoresFunc ksmtypes.BuildStoresFunc
71+
allowLabelsList map[string][]string
72+
useAPIServerCache bool
7273
}
7374

7475
// NewBuilder returns a new builder.
@@ -137,8 +138,9 @@ func (b *Builder) WithAllowDenyList(l ksmtypes.AllowDenyLister) {
137138
}
138139

139140
// WithGenerateStoresFunc configures a custom generate store function
140-
func (b *Builder) WithGenerateStoresFunc(f ksmtypes.BuildStoresFunc) {
141+
func (b *Builder) WithGenerateStoresFunc(f ksmtypes.BuildStoresFunc, u bool) {
141142
b.buildStoresFunc = f
143+
b.useAPIServerCache = u
142144
}
143145

144146
// DefaultGenerateStoresFunc returns default buildStores function
@@ -228,125 +230,126 @@ func availableResources() []string {
228230
}
229231

230232
func (b *Builder) buildConfigMapStores() []*metricsstore.MetricsStore {
231-
return b.buildStoresFunc(configMapMetricFamilies, &v1.ConfigMap{}, createConfigMapListWatch)
233+
return b.buildStoresFunc(configMapMetricFamilies, &v1.ConfigMap{}, createConfigMapListWatch, b.useAPIServerCache)
232234
}
233235

234236
func (b *Builder) buildCronJobStores() []*metricsstore.MetricsStore {
235-
return b.buildStoresFunc(cronJobMetricFamilies(b.allowLabelsList["cronjobs"]), &batchv1beta1.CronJob{}, createCronJobListWatch)
237+
return b.buildStoresFunc(cronJobMetricFamilies(b.allowLabelsList["cronjobs"]), &batchv1beta1.CronJob{}, createCronJobListWatch, b.useAPIServerCache)
236238
}
237239

238240
func (b *Builder) buildDaemonSetStores() []*metricsstore.MetricsStore {
239-
return b.buildStoresFunc(daemonSetMetricFamilies(b.allowLabelsList["daemonsets"]), &appsv1.DaemonSet{}, createDaemonSetListWatch)
241+
return b.buildStoresFunc(daemonSetMetricFamilies(b.allowLabelsList["daemonsets"]), &appsv1.DaemonSet{}, createDaemonSetListWatch, b.useAPIServerCache)
240242
}
241243

242244
func (b *Builder) buildDeploymentStores() []*metricsstore.MetricsStore {
243-
return b.buildStoresFunc(deploymentMetricFamilies(b.allowLabelsList["deployments"]), &appsv1.Deployment{}, createDeploymentListWatch)
245+
return b.buildStoresFunc(deploymentMetricFamilies(b.allowLabelsList["deployments"]), &appsv1.Deployment{}, createDeploymentListWatch, b.useAPIServerCache)
244246
}
245247

246248
func (b *Builder) buildEndpointsStores() []*metricsstore.MetricsStore {
247-
return b.buildStoresFunc(endpointMetricFamilies(b.allowLabelsList["endpoints"]), &v1.Endpoints{}, createEndpointsListWatch)
249+
return b.buildStoresFunc(endpointMetricFamilies(b.allowLabelsList["endpoints"]), &v1.Endpoints{}, createEndpointsListWatch, b.useAPIServerCache)
248250
}
249251

250252
func (b *Builder) buildHPAStores() []*metricsstore.MetricsStore {
251-
return b.buildStoresFunc(hpaMetricFamilies(b.allowLabelsList["horizontalpodautoscalers"]), &autoscaling.HorizontalPodAutoscaler{}, createHPAListWatch)
253+
return b.buildStoresFunc(hpaMetricFamilies(b.allowLabelsList["horizontalpodautoscalers"]), &autoscaling.HorizontalPodAutoscaler{}, createHPAListWatch, b.useAPIServerCache)
252254
}
253255

254256
func (b *Builder) buildIngressStores() []*metricsstore.MetricsStore {
255-
return b.buildStoresFunc(ingressMetricFamilies(b.allowLabelsList["ingresses"]), &networkingv1.Ingress{}, createIngressListWatch)
257+
return b.buildStoresFunc(ingressMetricFamilies(b.allowLabelsList["ingresses"]), &networkingv1.Ingress{}, createIngressListWatch, b.useAPIServerCache)
256258
}
257259

258260
func (b *Builder) buildJobStores() []*metricsstore.MetricsStore {
259-
return b.buildStoresFunc(jobMetricFamilies(b.allowLabelsList["jobs"]), &batchv1.Job{}, createJobListWatch)
261+
return b.buildStoresFunc(jobMetricFamilies(b.allowLabelsList["jobs"]), &batchv1.Job{}, createJobListWatch, b.useAPIServerCache)
260262
}
261263

262264
func (b *Builder) buildLimitRangeStores() []*metricsstore.MetricsStore {
263-
return b.buildStoresFunc(limitRangeMetricFamilies, &v1.LimitRange{}, createLimitRangeListWatch)
265+
return b.buildStoresFunc(limitRangeMetricFamilies, &v1.LimitRange{}, createLimitRangeListWatch, b.useAPIServerCache)
264266
}
265267

266268
func (b *Builder) buildMutatingWebhookConfigurationStores() []*metricsstore.MetricsStore {
267-
return b.buildStoresFunc(mutatingWebhookConfigurationMetricFamilies, &admissionregistrationv1.MutatingWebhookConfiguration{}, createMutatingWebhookConfigurationListWatch)
269+
return b.buildStoresFunc(mutatingWebhookConfigurationMetricFamilies, &admissionregistrationv1.MutatingWebhookConfiguration{}, createMutatingWebhookConfigurationListWatch, b.useAPIServerCache)
268270
}
269271

270272
func (b *Builder) buildNamespaceStores() []*metricsstore.MetricsStore {
271-
return b.buildStoresFunc(namespaceMetricFamilies(b.allowLabelsList["namespaces"]), &v1.Namespace{}, createNamespaceListWatch)
273+
return b.buildStoresFunc(namespaceMetricFamilies(b.allowLabelsList["namespaces"]), &v1.Namespace{}, createNamespaceListWatch, b.useAPIServerCache)
272274
}
273275

274276
func (b *Builder) buildNetworkPolicyStores() []*metricsstore.MetricsStore {
275-
return b.buildStoresFunc(networkPolicyMetricFamilies(b.allowLabelsList["networkpolicies"]), &networkingv1.NetworkPolicy{}, createNetworkPolicyListWatch)
277+
return b.buildStoresFunc(networkPolicyMetricFamilies(b.allowLabelsList["networkpolicies"]), &networkingv1.NetworkPolicy{}, createNetworkPolicyListWatch, b.useAPIServerCache)
276278
}
277279

278280
func (b *Builder) buildNodeStores() []*metricsstore.MetricsStore {
279-
return b.buildStoresFunc(nodeMetricFamilies(b.allowLabelsList["nodes"]), &v1.Node{}, createNodeListWatch)
281+
return b.buildStoresFunc(nodeMetricFamilies(b.allowLabelsList["nodes"]), &v1.Node{}, createNodeListWatch, b.useAPIServerCache)
280282
}
281283

282284
func (b *Builder) buildPersistentVolumeClaimStores() []*metricsstore.MetricsStore {
283-
return b.buildStoresFunc(persistentVolumeClaimMetricFamilies(b.allowLabelsList["persistentvolumeclaims"]), &v1.PersistentVolumeClaim{}, createPersistentVolumeClaimListWatch)
285+
return b.buildStoresFunc(persistentVolumeClaimMetricFamilies(b.allowLabelsList["persistentvolumeclaims"]), &v1.PersistentVolumeClaim{}, createPersistentVolumeClaimListWatch, b.useAPIServerCache)
284286
}
285287

286288
func (b *Builder) buildPersistentVolumeStores() []*metricsstore.MetricsStore {
287-
return b.buildStoresFunc(persistentVolumeMetricFamilies(b.allowLabelsList["persistentvolumes"]), &v1.PersistentVolume{}, createPersistentVolumeListWatch)
289+
return b.buildStoresFunc(persistentVolumeMetricFamilies(b.allowLabelsList["persistentvolumes"]), &v1.PersistentVolume{}, createPersistentVolumeListWatch, b.useAPIServerCache)
288290
}
289291

290292
func (b *Builder) buildPodDisruptionBudgetStores() []*metricsstore.MetricsStore {
291-
return b.buildStoresFunc(podDisruptionBudgetMetricFamilies, &policy.PodDisruptionBudget{}, createPodDisruptionBudgetListWatch)
293+
return b.buildStoresFunc(podDisruptionBudgetMetricFamilies, &policy.PodDisruptionBudget{}, createPodDisruptionBudgetListWatch, b.useAPIServerCache)
292294
}
293295

294296
func (b *Builder) buildReplicaSetStores() []*metricsstore.MetricsStore {
295-
return b.buildStoresFunc(replicaSetMetricFamilies(b.allowLabelsList["replicasets"]), &appsv1.ReplicaSet{}, createReplicaSetListWatch)
297+
return b.buildStoresFunc(replicaSetMetricFamilies(b.allowLabelsList["replicasets"]), &appsv1.ReplicaSet{}, createReplicaSetListWatch, b.useAPIServerCache)
296298
}
297299

298300
func (b *Builder) buildReplicationControllerStores() []*metricsstore.MetricsStore {
299-
return b.buildStoresFunc(replicationControllerMetricFamilies, &v1.ReplicationController{}, createReplicationControllerListWatch)
301+
return b.buildStoresFunc(replicationControllerMetricFamilies, &v1.ReplicationController{}, createReplicationControllerListWatch, b.useAPIServerCache)
300302
}
301303

302304
func (b *Builder) buildResourceQuotaStores() []*metricsstore.MetricsStore {
303-
return b.buildStoresFunc(resourceQuotaMetricFamilies, &v1.ResourceQuota{}, createResourceQuotaListWatch)
305+
return b.buildStoresFunc(resourceQuotaMetricFamilies, &v1.ResourceQuota{}, createResourceQuotaListWatch, b.useAPIServerCache)
304306
}
305307

306308
func (b *Builder) buildSecretStores() []*metricsstore.MetricsStore {
307-
return b.buildStoresFunc(secretMetricFamilies(b.allowLabelsList["secrets"]), &v1.Secret{}, createSecretListWatch)
309+
return b.buildStoresFunc(secretMetricFamilies(b.allowLabelsList["secrets"]), &v1.Secret{}, createSecretListWatch, b.useAPIServerCache)
308310
}
309311

310312
func (b *Builder) buildServiceStores() []*metricsstore.MetricsStore {
311-
return b.buildStoresFunc(serviceMetricFamilies(b.allowLabelsList["services"]), &v1.Service{}, createServiceListWatch)
313+
return b.buildStoresFunc(serviceMetricFamilies(b.allowLabelsList["services"]), &v1.Service{}, createServiceListWatch, b.useAPIServerCache)
312314
}
313315

314316
func (b *Builder) buildStatefulSetStores() []*metricsstore.MetricsStore {
315-
return b.buildStoresFunc(statefulSetMetricFamilies(b.allowLabelsList["statefulsets"]), &appsv1.StatefulSet{}, createStatefulSetListWatch)
317+
return b.buildStoresFunc(statefulSetMetricFamilies(b.allowLabelsList["statefulsets"]), &appsv1.StatefulSet{}, createStatefulSetListWatch, b.useAPIServerCache)
316318
}
317319

318320
func (b *Builder) buildStorageClassStores() []*metricsstore.MetricsStore {
319-
return b.buildStoresFunc(storageClassMetricFamilies(b.allowLabelsList["storageclasses"]), &storagev1.StorageClass{}, createStorageClassListWatch)
321+
return b.buildStoresFunc(storageClassMetricFamilies(b.allowLabelsList["storageclasses"]), &storagev1.StorageClass{}, createStorageClassListWatch, b.useAPIServerCache)
320322
}
321323

322324
func (b *Builder) buildPodStores() []*metricsstore.MetricsStore {
323-
return b.buildStoresFunc(podMetricFamilies(b.allowLabelsList["pods"]), &v1.Pod{}, createPodListWatch)
325+
return b.buildStoresFunc(podMetricFamilies(b.allowLabelsList["pods"]), &v1.Pod{}, createPodListWatch, b.useAPIServerCache)
324326
}
325327

326328
func (b *Builder) buildCsrStores() []*metricsstore.MetricsStore {
327-
return b.buildStoresFunc(csrMetricFamilies(b.allowLabelsList["certificatesigningrequests"]), &certv1.CertificateSigningRequest{}, createCSRListWatch)
329+
return b.buildStoresFunc(csrMetricFamilies(b.allowLabelsList["certificatesigningrequests"]), &certv1.CertificateSigningRequest{}, createCSRListWatch, b.useAPIServerCache)
328330
}
329331

330332
func (b *Builder) buildValidatingWebhookConfigurationStores() []*metricsstore.MetricsStore {
331-
return b.buildStoresFunc(validatingWebhookConfigurationMetricFamilies, &admissionregistrationv1.ValidatingWebhookConfiguration{}, createValidatingWebhookConfigurationListWatch)
333+
return b.buildStoresFunc(validatingWebhookConfigurationMetricFamilies, &admissionregistrationv1.ValidatingWebhookConfiguration{}, createValidatingWebhookConfigurationListWatch, b.useAPIServerCache)
332334
}
333335

334336
func (b *Builder) buildVolumeAttachmentStores() []*metricsstore.MetricsStore {
335-
return b.buildStoresFunc(volumeAttachmentMetricFamilies, &storagev1.VolumeAttachment{}, createVolumeAttachmentListWatch)
337+
return b.buildStoresFunc(volumeAttachmentMetricFamilies, &storagev1.VolumeAttachment{}, createVolumeAttachmentListWatch, b.useAPIServerCache)
336338
}
337339

338340
func (b *Builder) buildVPAStores() []*metricsstore.MetricsStore {
339-
return b.buildStoresFunc(vpaMetricFamilies(b.allowLabelsList["verticalpodautoscalers"]), &vpaautoscaling.VerticalPodAutoscaler{}, createVPAListWatchFunc(b.vpaClient))
341+
return b.buildStoresFunc(vpaMetricFamilies(b.allowLabelsList["verticalpodautoscalers"]), &vpaautoscaling.VerticalPodAutoscaler{}, createVPAListWatchFunc(b.vpaClient), b.useAPIServerCache)
340342
}
341343

342344
func (b *Builder) buildLeasesStores() []*metricsstore.MetricsStore {
343-
return b.buildStoresFunc(leaseMetricFamilies, &coordinationv1.Lease{}, createLeaseListWatch)
345+
return b.buildStoresFunc(leaseMetricFamilies, &coordinationv1.Lease{}, createLeaseListWatch, b.useAPIServerCache)
344346
}
345347

346348
func (b *Builder) buildStores(
347349
metricFamilies []generator.FamilyGenerator,
348350
expectedType interface{},
349351
listWatchFunc func(kubeClient clientset.Interface, ns string) cache.ListerWatcher,
352+
useAPIServerCache bool,
350353
) []*metricsstore.MetricsStore {
351354
metricFamilies = generator.FilterMetricFamilies(b.allowDenyList, metricFamilies)
352355
composedMetricGenFuncs := generator.ComposeMetricGenFuncs(metricFamilies)
@@ -358,7 +361,7 @@ func (b *Builder) buildStores(
358361
composedMetricGenFuncs,
359362
)
360363
listWatcher := listWatchFunc(b.kubeClient, v1.NamespaceAll)
361-
b.startReflector(expectedType, store, listWatcher)
364+
b.startReflector(expectedType, store, listWatcher, useAPIServerCache)
362365
return []*metricsstore.MetricsStore{store}
363366
}
364367

@@ -369,7 +372,7 @@ func (b *Builder) buildStores(
369372
composedMetricGenFuncs,
370373
)
371374
listWatcher := listWatchFunc(b.kubeClient, ns)
372-
b.startReflector(expectedType, store, listWatcher)
375+
b.startReflector(expectedType, store, listWatcher, useAPIServerCache)
373376
stores = append(stores, store)
374377
}
375378

@@ -382,8 +385,9 @@ func (b *Builder) startReflector(
382385
expectedType interface{},
383386
store cache.Store,
384387
listWatcher cache.ListerWatcher,
388+
useAPIServerCache bool,
385389
) {
386-
instrumentedListWatch := watch.NewInstrumentedListerWatcher(listWatcher, b.listWatchMetrics, reflect.TypeOf(expectedType).String())
390+
instrumentedListWatch := watch.NewInstrumentedListerWatcher(listWatcher, b.listWatchMetrics, reflect.TypeOf(expectedType).String(), useAPIServerCache)
387391
reflector := cache.NewReflector(sharding.NewShardedListWatch(b.shard, b.totalShards, instrumentedListWatch), expectedType, store, 0)
388392
go reflector.Run(b.ctx.Done())
389393
}

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func main() {
140140

141141
storeBuilder.WithAllowDenyList(allowDenyList)
142142

143-
storeBuilder.WithGenerateStoresFunc(storeBuilder.DefaultGenerateStoresFunc())
143+
storeBuilder.WithGenerateStoresFunc(storeBuilder.DefaultGenerateStoresFunc(), opts.UseAPIServerCache)
144144

145145
proc.StartReaper()
146146

main_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func BenchmarkKubeStateMetrics(b *testing.B) {
6767
builder.WithSharding(0, 1)
6868
builder.WithContext(ctx)
6969
builder.WithNamespaces(options.DefaultNamespaces)
70-
builder.WithGenerateStoresFunc(builder.DefaultGenerateStoresFunc())
70+
builder.WithGenerateStoresFunc(builder.DefaultGenerateStoresFunc(), false)
7171

7272
l, err := allowdenylist.New(map[string]struct{}{}, map[string]struct{}{})
7373
if err != nil {
@@ -132,7 +132,7 @@ func TestFullScrapeCycle(t *testing.T) {
132132
builder.WithEnabledResources(options.DefaultResources.AsSlice())
133133
builder.WithKubeClient(kubeClient)
134134
builder.WithNamespaces(options.DefaultNamespaces)
135-
builder.WithGenerateStoresFunc(builder.DefaultGenerateStoresFunc())
135+
builder.WithGenerateStoresFunc(builder.DefaultGenerateStoresFunc(), false)
136136

137137
l, err := allowdenylist.New(map[string]struct{}{}, map[string]struct{}{})
138138
if err != nil {
@@ -412,7 +412,7 @@ func TestShardingEquivalenceScrapeCycle(t *testing.T) {
412412
unshardedBuilder.WithNamespaces(options.DefaultNamespaces)
413413
unshardedBuilder.WithAllowDenyList(l)
414414
unshardedBuilder.WithAllowLabels(map[string][]string{})
415-
unshardedBuilder.WithGenerateStoresFunc(unshardedBuilder.DefaultGenerateStoresFunc())
415+
unshardedBuilder.WithGenerateStoresFunc(unshardedBuilder.DefaultGenerateStoresFunc(), false)
416416

417417
unshardedHandler := metricshandler.New(&options.Options{}, kubeClient, unshardedBuilder, false)
418418
unshardedHandler.ConfigureSharding(ctx, 0, 1)
@@ -425,7 +425,7 @@ func TestShardingEquivalenceScrapeCycle(t *testing.T) {
425425
shardedBuilder1.WithNamespaces(options.DefaultNamespaces)
426426
shardedBuilder1.WithAllowDenyList(l)
427427
shardedBuilder1.WithAllowLabels(map[string][]string{})
428-
shardedBuilder1.WithGenerateStoresFunc(shardedBuilder1.DefaultGenerateStoresFunc())
428+
shardedBuilder1.WithGenerateStoresFunc(shardedBuilder1.DefaultGenerateStoresFunc(), false)
429429

430430
shardedHandler1 := metricshandler.New(&options.Options{}, kubeClient, shardedBuilder1, false)
431431
shardedHandler1.ConfigureSharding(ctx, 0, 2)
@@ -438,7 +438,7 @@ func TestShardingEquivalenceScrapeCycle(t *testing.T) {
438438
shardedBuilder2.WithNamespaces(options.DefaultNamespaces)
439439
shardedBuilder2.WithAllowDenyList(l)
440440
shardedBuilder2.WithAllowLabels(map[string][]string{})
441-
shardedBuilder2.WithGenerateStoresFunc(shardedBuilder2.DefaultGenerateStoresFunc())
441+
shardedBuilder2.WithGenerateStoresFunc(shardedBuilder2.DefaultGenerateStoresFunc(), false)
442442

443443
shardedHandler2 := metricshandler.New(&options.Options{}, kubeClient, shardedBuilder2, false)
444444
shardedHandler2.ConfigureSharding(ctx, 1, 2)

pkg/builder/builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (b *Builder) WithAllowLabels(l map[string][]string) {
9292

9393
// WithGenerateStoresFunc configures a custom generate store function
9494
func (b *Builder) WithGenerateStoresFunc(f ksmtypes.BuildStoresFunc) {
95-
b.internal.WithGenerateStoresFunc(f)
95+
b.internal.WithGenerateStoresFunc(f, false)
9696
}
9797

9898
// DefaultGenerateStoresFunc returns default buildStore function

pkg/builder/types/interfaces.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type BuilderInterface interface {
4141
WithVPAClient(c vpaclientset.Interface)
4242
WithAllowDenyList(l AllowDenyLister)
4343
WithAllowLabels(l map[string][]string)
44-
WithGenerateStoresFunc(f BuildStoresFunc)
44+
WithGenerateStoresFunc(f BuildStoresFunc, useAPIServerCache bool)
4545
DefaultGenerateStoresFunc() BuildStoresFunc
4646
Build() []metricsstore.MetricsWriter
4747
}
@@ -50,6 +50,7 @@ type BuilderInterface interface {
5050
type BuildStoresFunc func(metricFamilies []generator.FamilyGenerator,
5151
expectedType interface{},
5252
listWatchFunc func(kubeClient clientset.Interface, ns string) cache.ListerWatcher,
53+
useAPIServerCache bool,
5354
) []*metricsstore.MetricsStore
5455

5556
// AllowDenyLister interface for AllowDeny lister that can allow or exclude metrics by there names

pkg/options/options.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ type Options struct {
4949

5050
EnableGZIPEncoding bool
5151

52+
UseAPIServerCache bool
53+
5254
flags *pflag.FlagSet
5355
}
5456

@@ -78,6 +80,7 @@ func (o *Options) AddFlags() {
7880
o.flags.PrintDefaults()
7981
}
8082

83+
o.flags.BoolVarP(&o.UseAPIServerCache, "use-apiserver-cache", "", false, "Sets resourceVersion=0 for ListWatch requests, using cached resources from the apiserver instead of an etcd quorum read.")
8184
o.flags.StringVar(&o.Apiserver, "apiserver", "", `The URL of the apiserver to use as a master`)
8285
o.flags.StringVar(&o.Kubeconfig, "kubeconfig", "", "Absolute path to the kubeconfig file")
8386
o.flags.StringVar(&o.TLSConfig, "tls-config", "", "Path to the TLS configuration file")

0 commit comments

Comments
 (0)