Skip to content

Commit

Permalink
Merge pull request #1848 from marquiz/devel/leader-elect
Browse files Browse the repository at this point in the history
nfd-master: proper shutdown of nfd api informers
  • Loading branch information
k8s-ci-robot committed Aug 20, 2024
2 parents 5a5b9e3 + 2bb8a72 commit 4db3216
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pkg/nfd-master/nfd-api-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ func (c *nfdController) updateOneNode(typ string, obj metav1.Object) {
klog.ErrorS(err, "failed to determine node name for object", "type", typ, "object", klog.KObj(obj))
return
}
c.updateOneNodeChan <- nodeName
select {
case c.updateOneNodeChan <- nodeName:
case <-c.stopChan:
}
}

func (c *nfdController) updateAllNodes() {
Expand All @@ -217,7 +220,10 @@ func (c *nfdController) updateAllNodes() {
}

func (c *nfdController) updateNodeFeatureGroup(nodeFeatureGroup string) {
c.updateNodeFeatureGroupChan <- nodeFeatureGroup
select {
case c.updateNodeFeatureGroupChan <- nodeFeatureGroup:
case <-c.stopChan:
}
}

func (c *nfdController) updateAllNodeFeatureGroups() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/nfd-master/nfd-master.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func (m *nfdMaster) Run() error {

// Update all nodes when the configuration changes
if m.nfdController != nil && nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.NodeFeatureAPI) {
m.nfdController.updateAllNodesChan <- struct{}{}
m.nfdController.updateAllNodes()
}

case <-m.stop:
Expand Down

0 comments on commit 4db3216

Please sign in to comment.