1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

topology-updater: add kubelet-state-dir flag

On different Kubernetes flavors like OpenShift for exmaple,
the Kubelet state directory path is different. make it configurable
for maximum flexability.

Signed-off-by: Talor Itzhak <titzhak@redhat.com>
This commit is contained in:
Talor Itzhak 2023-01-05 15:12:23 +02:00
parent 0f65b87329
commit 175e0c81aa
3 changed files with 9 additions and 5 deletions

View file

@ -21,6 +21,7 @@ import (
"fmt"
"net/url"
"os"
"path"
"time"
"k8s.io/klog/v2"
@ -40,6 +41,8 @@ const (
kubeletSecurePort = 10250
)
var DefaultKubeletStateDir = path.Join(string(hostpath.VarDir), "lib", "kubelet")
func main() {
flags := flag.NewFlagSet(ProgramName, flag.ExitOnError)
@ -140,6 +143,7 @@ func initFlags(flagset *flag.FlagSet) (*topology.Args, *resourcemonitor.Args) {
flagset.StringVar(&args.ConfigFile, "config", "/etc/kubernetes/node-feature-discovery/nfd-topology-updater.conf",
"Config file to use.")
flagset.BoolVar(&resourcemonitorArgs.PodSetFingerprint, "pods-fingerprint", false, "Compute and report the pod set fingerprint")
flagset.StringVar(&args.KubeletStateDir, "kubelet-state-dir", DefaultKubeletStateDir, "Kubelet state directory path for watching state and checkpoint files")
klog.InitFlags(flagset)

View file

@ -33,7 +33,6 @@ const (
FSUpdate EventType = "fsUpdate"
)
// TODO make path configurable
var stateFiles = sets.NewString(
"cpu_manager_state",
"memory_manager_state",

View file

@ -47,10 +47,11 @@ const (
// Args are the command line arguments
type Args struct {
NoPublish bool
Oneshot bool
KubeConfigFile string
ConfigFile string
NoPublish bool
Oneshot bool
KubeConfigFile string
ConfigFile string
KubeletStateDir string
Klog map[string]*utils.KlogFlagVal
}