Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-0.11] topology-updater: continue looping on scan error #941

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
topology-updater: continue looping on scan error
Scanning podresources can temporarily fail; the previous code was
mistakenly not rearming the loop condition when this occurred,
effectively stopping the monitoring.

Rather, we should always pool and bail out on unrecoverable
error or when asked to stop.

Signed-off-by: Francesco Romani <fromani@redhat.com>
  • Loading branch information
ffromani authored and k8s-infra-cherrypick-robot committed Oct 31, 2022
commit 053d9176fcb3063b764a77921e2119de8d260846
12 changes: 4 additions & 8 deletions pkg/nfd-client/topology-updater/nfd-topology-updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ func (w *nfdTopologyUpdater) Run() error {
return err
}

crTrigger := time.After(0)
crTrigger := time.NewTicker(w.resourcemonitorArgs.SleepInterval)
for {
select {
case <-crTrigger:
klog.Infof("Scanning\n")
case <-crTrigger.C:
klog.Infof("Scanning")
podResources, err := resScan.Scan()
utils.KlogDump(1, "podResources are", " ", podResources)
if err != nil {
klog.Warningf("Scan failed: %v\n", err)
klog.Warningf("Scan failed: %v", err)
continue
}
zones = resAggr.Aggregate(podResources)
Expand All @@ -147,10 +147,6 @@ func (w *nfdTopologyUpdater) Run() error {
return nil
}

if w.resourcemonitorArgs.SleepInterval > 0 {
crTrigger = time.After(w.resourcemonitorArgs.SleepInterval)
}

case <-w.certWatch.Events:
klog.Infof("TLS certificate update, renewing connection to nfd-master")
w.Disconnect()
Expand Down