diff --git a/api/nfd/go.mod b/api/nfd/go.mod index cf24a9355..1f4ba3960 100644 --- a/api/nfd/go.mod +++ b/api/nfd/go.mod @@ -1,7 +1,8 @@ module sigs.k8s.io/node-feature-discovery/api/nfd -go 1.22.2 -toolchain go1.23.7 +go 1.23.0 + +toolchain go1.24.0 require ( github.com/stretchr/testify v1.8.4 diff --git a/cmd/nfd-master/main.go b/cmd/nfd-master/main.go index 774b47335..ce7e2789d 100644 --- a/cmd/nfd-master/main.go +++ b/cmd/nfd-master/main.go @@ -117,6 +117,8 @@ 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, "node-feature-informer-list-size", 0, + "the list size to use when listing node features to sync informer cache") args.Klog = klogutils.InitKlogFlags(flagset) diff --git a/pkg/nfd-master/nfd-api-controller.go b/pkg/nfd-master/nfd-api-controller.go index a3870f489..9a795fe57 100644 --- a/pkg/nfd-master/nfd-api-controller.go +++ b/pkg/nfd-master/nfd-api-controller.go @@ -57,6 +57,7 @@ type nfdApiControllerOptions struct { ResyncPeriod time.Duration K8sClient k8sclient.Interface NodeFeatureNamespaceSelector *metav1.LabelSelector + ListSize int64 } func init() { @@ -101,6 +102,9 @@ func newNfdController(config *restclient.Config, nfdApiControllerOptions nfdApiC if opts.ResourceVersion == "0" { opts.ResourceVersion = "" } + if nfdApiControllerOptions.ListSize != 0 { + opts.Limit = nfdApiControllerOptions.ListSize + } } featureInformer := nfdinformersv1alpha1.New(informerFactory, "", tweakListOpts).NodeFeatures() if _, err := featureInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ diff --git a/pkg/nfd-master/nfd-master.go b/pkg/nfd-master/nfd-master.go index fbe12e040..0de556ea2 100644 --- a/pkg/nfd-master/nfd-master.go +++ b/pkg/nfd-master/nfd-master.go @@ -45,7 +45,6 @@ import ( restclient "k8s.io/client-go/rest" "k8s.io/client-go/tools/leaderelection" "k8s.io/client-go/tools/leaderelection/resourcelock" - "k8s.io/klog/v2" controller "k8s.io/kubernetes/pkg/controller" taintutils "k8s.io/kubernetes/pkg/util/taints" "sigs.k8s.io/yaml" @@ -122,6 +121,8 @@ type Args struct { Prune bool Options string EnableLeaderElection bool + MetricsPort int + ListSize int64 Overrides ConfigOverrideArgs } @@ -1295,6 +1296,7 @@ func (m *nfdMaster) startNfdApiController() error { ResyncPeriod: m.config.ResyncPeriod.Duration, K8sClient: m.k8sClient, NodeFeatureNamespaceSelector: m.config.Restrictions.NodeFeatureNamespaceSelector, + ListSize: m.args.ListSize, }) if err != nil { return fmt.Errorf("failed to initialize CRD controller: %w", err)