Skip to content

Commit

Permalink
Restart device plugin pod after node policy applied
Browse files Browse the repository at this point in the history
We need to restart device plugin pod after node policy applied
and all SR-IOV Network Config Daemon plugins finished. E.g.:

Generic plugin applies SR-IOV Network Node Policy and creates
VFs. That's mean we need to restart device plugin pod to found
newly created devices.

Related k8snetworkplumbingwg/sriov-network-device-plugin#276
  • Loading branch information
e0ne committed Sep 7, 2021
1 parent 182f3d0 commit 856e295
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,15 +518,6 @@ func (dn *Daemon) nodeStateSyncHandler(generation int64) error {
return nil
}

// restart device plugin pod
if reqDrain || latestState.Spec.DpConfigVersion != dn.nodeState.Spec.DpConfigVersion {
glog.Info("nodeStateSyncHandler(): restart device plugin pod")
if err := dn.restartDevicePluginPod(); err != nil {
glog.Errorf("nodeStateSyncHandler(): fail to restart device plugin pod: %v", err)
return err
}
}

if anno, ok := dn.node.Annotations[annoKey]; ok && (anno == annoDraining || anno == annoMcpPaused) {
if err := dn.completeDrain(); err != nil {
glog.Errorf("nodeStateSyncHandler(): failed to complete draining: %v", err)
Expand All @@ -544,6 +535,13 @@ func (dn *Daemon) nodeStateSyncHandler(generation int64) error {
syncStatus: "Succeeded",
lastSyncError: "",
}

// restart device plugin pod after node policy applied
glog.Info("nodeStateSyncHandler(): restart device plugin pod")
if err := dn.restartDevicePluginPod(); err != nil {
glog.Errorf("nodeStateSyncHandler(): fail to restart device plugin pod: %v", err)
return err
}
// wait for writer to refresh the status
<-dn.syncCh
return nil
Expand Down

0 comments on commit 856e295

Please sign in to comment.