From 5c6be580f46da21b25ce7e99c1fe318ebb895434 Mon Sep 17 00:00:00 2001 From: Talor Itzhak Date: Tue, 21 Feb 2023 21:43:43 +0200 Subject: [PATCH] reactive updates: add an option to disable the feature Access to the kubelet state directory may raise concerns in some setups, added an option to disable it. The feature is enabled by default. Signed-off-by: Talor Itzhak --- .../topology-updater-commandline-reference.md | 2 ++ pkg/nfd-topology-updater/nfd-topology-updater.go | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/reference/topology-updater-commandline-reference.md b/docs/reference/topology-updater-commandline-reference.md index f5e9581c87..f4d8764b6e 100644 --- a/docs/reference/topology-updater-commandline-reference.md +++ b/docs/reference/topology-updater-commandline-reference.md @@ -165,6 +165,8 @@ nfd-topology-updater -pods-fingerprint The `-kubelet-state-dir` specifies the path to the Kubelet state directory, where state and checkpoint files are stored. The files are mount as read-only and cannot be change by the updater. +Enabled by default. +Passing an empty string will disable the watching. Default: /host-var/lib/kubelet diff --git a/pkg/nfd-topology-updater/nfd-topology-updater.go b/pkg/nfd-topology-updater/nfd-topology-updater.go index 35a152e3a5..5e9b10825d 100644 --- a/pkg/nfd-topology-updater/nfd-topology-updater.go +++ b/pkg/nfd-topology-updater/nfd-topology-updater.go @@ -96,11 +96,13 @@ type nfdTopologyUpdater struct { // NewTopologyUpdater creates a new NfdTopologyUpdater instance. func NewTopologyUpdater(args Args, resourcemonitorArgs resourcemonitor.Args, policy, scope string) (NfdTopologyUpdater, error) { eventSource := make(chan kubeletnotifier.Info) - ntf, err := kubeletnotifier.New(resourcemonitorArgs.SleepInterval, eventSource, args.KubeletStateDir) - if err != nil { - return nil, err + if args.KubeletStateDir != "" { + ntf, err := kubeletnotifier.New(resourcemonitorArgs.SleepInterval, eventSource, args.KubeletStateDir) + if err != nil { + return nil, err + } + go ntf.Run() } - go ntf.Run() nfd := &nfdTopologyUpdater{ args: args, resourcemonitorArgs: resourcemonitorArgs,