Skip to content

Commit

Permalink
topology-updater: initialize properly with -no-publish
Browse files Browse the repository at this point in the history
We need to parse kubeconfig (and initialize the apihelper) even with
-no-publish as the PodResourcesScanner accesses the k8s API even if
we're not publishing/updating NRTs.
  • Loading branch information
marquiz committed Jan 22, 2024
1 parent d80e4f7 commit b452ab6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/nfd-topology-updater/nfd-topology-updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,12 @@ func (w *nfdTopologyUpdater) Run() error {
return fmt.Errorf("failed to get PodResource Client: %w", err)
}

if !w.args.NoPublish {
kubeconfig, err := apihelper.GetKubeconfig(w.args.KubeConfigFile)
if err != nil {
return err
}
w.apihelper = apihelper.K8sHelpers{Kubeconfig: kubeconfig}
kubeconfig, err := apihelper.GetKubeconfig(w.args.KubeConfigFile)
if err != nil {
return err

Check warning on line 136 in pkg/nfd-topology-updater/nfd-topology-updater.go

View check run for this annotation

Codecov / codecov/patch

pkg/nfd-topology-updater/nfd-topology-updater.go#L134-L136

Added lines #L134 - L136 were not covered by tests
}
w.apihelper = apihelper.K8sHelpers{Kubeconfig: kubeconfig}

Check warning on line 139 in pkg/nfd-topology-updater/nfd-topology-updater.go

View check run for this annotation

Codecov / codecov/patch

pkg/nfd-topology-updater/nfd-topology-updater.go#L138-L139

Added lines #L138 - L139 were not covered by tests
if err := w.configure(); err != nil {
return fmt.Errorf("faild to configure Node Feature Discovery Topology Updater: %w", err)
}
Expand Down

0 comments on commit b452ab6

Please sign in to comment.