Skip to content

Commit

Permalink
Fix systemd service configuration in vanilla K8S
Browse files Browse the repository at this point in the history
  • Loading branch information
e0ne committed Oct 31, 2022
1 parent b280fb8 commit 48e249d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cmd/sriov-network-config-daemon/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,26 @@ func runServiceCmd(cmd *cobra.Command, args []string) {
Status: sriovv1.SriovNetworkNodeStateStatus{Interfaces: ifaceStatuses},
}

// Set "In Progress" state by to indicate work is started
sriovResult := &systemd.SriovResult{
Generation: nodeStateSpec.Generation,
SyncStatus: "In Progress",
LastSyncError: "",
}

err = systemd.WriteSriovResult(sriovResult)
if err != nil {
glog.Errorf("sriov-config-service failed to write sriov result file with content %v error: %v", *sriovResult, err)
return
}

_, _, err = genericPlugin.OnNodeStateChange(nodeState)
if err != nil {
glog.Errorf("sriov-config-service failed to run OnNodeStateChange to update the generic plugin status %v", err)
return
}

sriovResult := &systemd.SriovResult{
sriovResult = &systemd.SriovResult{
Generation: nodeStateSpec.Generation,
SyncStatus: "Succeeded",
LastSyncError: "",
Expand Down
7 changes: 7 additions & 0 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,13 @@ func (dn *Daemon) nodeStateSyncHandler() error {
return nil
}
} else {
// Ensure config file is created
_, err := systemd.WriteConfFile(latestState)
if err != nil {
glog.Errorf("nodeStateSyncHandler(): failed to write configuration file for systemd mode: %v", err)
return err
}

sriovResult, err := systemd.ReadSriovResult()
if err != nil {
glog.Errorf("failed to load sriov result file")
Expand Down

0 comments on commit 48e249d

Please sign in to comment.