Skip to content

Commit a91dcf5

Browse files
authored
fix: CNS should ignore NNCs that are being deleted (#2798) (#2850)
Signed-off-by: Evan Baker <[email protected]>
1 parent 5ab954c commit a91dcf5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

cns/kubecontroller/nodenetworkconfig/reconciler.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager, node *v1.Node) error {
180180
return ue.ObjectOld.GetGeneration() == ue.ObjectNew.GetGeneration()
181181
},
182182
}).
183+
WithEventFilter(predicate.NewPredicateFuncs(func(object client.Object) bool {
184+
// only process events on objects that are not being deleted.
185+
return object.GetDeletionTimestamp().IsZero()
186+
})).
183187
Complete(r)
184188
if err != nil {
185189
return errors.Wrap(err, "failed to set up reconciler with manager")

cns/service/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,9 @@ func reconcileInitialCNSState(ctx context.Context, cli nodeNetworkConfigGetter,
11731173
}
11741174

11751175
logger.Printf("Retrieved NNC: %+v", nnc)
1176+
if !nnc.DeletionTimestamp.IsZero() {
1177+
return errors.New("failed to init CNS state: NNC is being deleted")
1178+
}
11761179

11771180
// If there are no NCs, we can't initialize our state and we should fail out.
11781181
if len(nnc.Status.NetworkContainers) == 0 {

0 commit comments

Comments
 (0)