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

Skip config if policy not applied yet #287

Merged
merged 1 commit into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions controllers/sriovnetworknodepolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ func (r *SriovNetworkNodePolicyReconciler) syncSriovNetworkNodeState(np *sriovne
return fmt.Errorf("failed to get SriovNetworkNodeState: %v", err)
}
} else {
if len(found.Status.Interfaces) == 0 {
adrianchiris marked this conversation as resolved.
Show resolved Hide resolved
logger.Info("SriovNetworkNodeState Status Interfaces are empty. Skip update of policies in spec",
"namespace", ns.Namespace, "name", ns.Name)
return nil
}

logger.Info("SriovNetworkNodeState already exists, updating")
newVersion := found.DeepCopy()
newVersion.Spec = ns.Spec
Expand Down
13 changes: 13 additions & 0 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,19 @@ func (dn *Daemon) nodeStateSyncHandler(generation int64) error {
return nil
}

if latestState.GetGeneration() == 1 && len(latestState.Spec.Interfaces) == 0 {
glog.V(0).Infof("nodeStateSyncHandler(): Name: %s, Interface policy spec not yet set by controller", latestState.Name)
if latestState.Status.SyncStatus != "Succeeded" {
dn.refreshCh <- Message{
syncStatus: "Succeeded",
lastSyncError: "",
}
// wait for writer to refresh status
<-dn.syncCh
}
return nil
}

dn.refreshCh <- Message{
syncStatus: "InProgress",
lastSyncError: "",
Expand Down