Skip to content

Commit

Permalink
ConfigureOVS: Ensure stale interfaces matching the iface-id are remov…
Browse files Browse the repository at this point in the history
…ed before creating a new pod networking

Do not try to configure the OVS, if the interface matching the iface-id cannot be garbage-collected.
Otherwise pods might enter the CrashLoopBackOff state, because the related ct-zone disappears from the bridge interface.

Signed-off-by: Rafael Chicoli <[email protected]>
  • Loading branch information
rchicoli committed Jul 23, 2023
1 parent 9214487 commit 86f2e2d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions go-controller/pkg/cni/helper_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,15 @@ func ConfigureOVS(vsClient client.Client, ctx context.Context, namespace, podNam
foundID, ok := iface.ExternalIDs["iface-id"]
return ok && foundID == ifaceID
}
if err := libovsdbops.DeleteInterfacesWithPredicate(vsClient, p); err != nil {
klog.Warningf("Failed to delete stale OVS ports with iface-id %q from br-int: %v", ifaceID, err)
if err := wait.PollUntilContextCancel(ctx, 3*time.Second, true, func(context.Context) (done bool, err error) {

Check failure on line 388 in go-controller/pkg/cni/helper_linux.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: wait (typecheck)
if err := libovsdbops.DeleteInterfacesWithPredicate(vsClient, p); err != nil {
klog.Warningf("Failed to delete stale OVS ports with iface-id %q from br-int: %v", ifaceID, err)
return false, nil
}
// success
return true, nil
}); err != nil {
return err
}

// if the specified interface was created for other Pod/NAD, return error
Expand Down

0 comments on commit 86f2e2d

Please sign in to comment.