mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-31 04:04:51 +00:00
config file for informerPageSize
This commit is contained in:
parent
aaf456aa17
commit
a3712554fe
4 changed files with 25 additions and 4 deletions
|
@ -117,8 +117,6 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs)
|
|||
"in the same format as in the config file (i.e. json or yaml). These options")
|
||||
flagset.BoolVar(&args.EnableLeaderElection, "enable-leader-election", false,
|
||||
"Enables a leader election. Enable this when running more than one replica on nfd master.")
|
||||
flagset.Int64Var(&args.ListSize, "informer-page-size", 200,
|
||||
"The list size to use when listing NodeFeature objects to sync informer cache.")
|
||||
|
||||
args.Klog = klogutils.InitKlogFlags(flagset)
|
||||
|
||||
|
@ -142,6 +140,8 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs)
|
|||
flagset.Var(overrides.ResyncPeriod, "resync-period", "Specify the NFD API controller resync period.")
|
||||
overrides.NfdApiParallelism = flagset.Int("nfd-api-parallelism", 10, "Defines the maximum number of goroutines responsible of updating nodes. "+
|
||||
"Can be used for the throttling mechanism.")
|
||||
overrides.InformerPageSize = flagset.Int64("informer-page-size", 200,
|
||||
"The list size to use when listing NodeFeature objects to sync informer cache.")
|
||||
|
||||
return args, overrides
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ master:
|
|||
# # this value has to be greater than 0
|
||||
# retryPeriod: 2s
|
||||
# nfdApiParallelism: 10
|
||||
# informerPageSize: 50
|
||||
### <NFD-MASTER-CONF-END-DO-NOT-REMOVE>
|
||||
port: 8080
|
||||
instance:
|
||||
|
|
|
@ -216,6 +216,21 @@ Example:
|
|||
nfdApiParallelism: 1
|
||||
```
|
||||
|
||||
## informerPageSize
|
||||
|
||||
The `informerPageSize` option is used to control pagination
|
||||
during informer cache sync on nfd-master startup.
|
||||
This is useful to control load on api-server/etcd as listing
|
||||
NodeFeature objects can be expensive, especially in large clusters.
|
||||
|
||||
Default: 200
|
||||
|
||||
Example:
|
||||
|
||||
```yaml
|
||||
informerPageSize: 50
|
||||
```
|
||||
|
||||
## klog
|
||||
|
||||
The following options specify the logger configuration. Most of which can be
|
||||
|
|
|
@ -91,6 +91,7 @@ type NFDConfig struct {
|
|||
NfdApiParallelism int
|
||||
Klog klogutils.KlogConfigOpts
|
||||
Restrictions Restrictions
|
||||
InformerPageSize int64
|
||||
}
|
||||
|
||||
// LeaderElectionConfig contains the configuration for leader election
|
||||
|
@ -109,6 +110,7 @@ type ConfigOverrideArgs struct {
|
|||
NoPublish *bool
|
||||
ResyncPeriod *utils.DurationVal
|
||||
NfdApiParallelism *int
|
||||
InformerPageSize *int64
|
||||
}
|
||||
|
||||
// Args holds command line arguments
|
||||
|
@ -122,7 +124,6 @@ type Args struct {
|
|||
Options string
|
||||
EnableLeaderElection bool
|
||||
MetricsPort int
|
||||
ListSize int64
|
||||
|
||||
Overrides ConfigOverrideArgs
|
||||
}
|
||||
|
@ -243,6 +244,7 @@ func newDefaultConfig() *NFDConfig {
|
|||
NfdApiParallelism: 10,
|
||||
EnableTaints: false,
|
||||
ResyncPeriod: utils.DurationVal{Duration: time.Duration(1) * time.Hour},
|
||||
InformerPageSize: 200,
|
||||
LeaderElection: LeaderElectionConfig{
|
||||
LeaseDuration: utils.DurationVal{Duration: time.Duration(15) * time.Second},
|
||||
RetryPeriod: utils.DurationVal{Duration: time.Duration(2) * time.Second},
|
||||
|
@ -1191,6 +1193,9 @@ func (m *nfdMaster) configure(filepath string, overrides string) error {
|
|||
if m.args.Overrides.NfdApiParallelism != nil {
|
||||
c.NfdApiParallelism = *m.args.Overrides.NfdApiParallelism
|
||||
}
|
||||
if m.args.Overrides.InformerPageSize != nil {
|
||||
c.InformerPageSize = *m.args.Overrides.InformerPageSize
|
||||
}
|
||||
|
||||
if c.NfdApiParallelism <= 0 {
|
||||
return fmt.Errorf("the maximum number of concurrent labelers should be a non-zero positive number")
|
||||
|
@ -1296,7 +1301,7 @@ func (m *nfdMaster) startNfdApiController() error {
|
|||
ResyncPeriod: m.config.ResyncPeriod.Duration,
|
||||
K8sClient: m.k8sClient,
|
||||
NodeFeatureNamespaceSelector: m.config.Restrictions.NodeFeatureNamespaceSelector,
|
||||
ListSize: m.args.ListSize,
|
||||
ListSize: m.config.InformerPageSize,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to initialize CRD controller: %w", err)
|
||||
|
|
Loading…
Add table
Reference in a new issue