Skip to content

Commit 5d88534

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

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
@@ -175,6 +175,10 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager, node *v1.Node) error {
175175
return ue.ObjectOld.GetGeneration() == ue.ObjectNew.GetGeneration()
176176
},
177177
}).
178+
WithEventFilter(predicate.NewPredicateFuncs(func(object client.Object) bool {
179+
// only process events on objects that are not being deleted.
180+
return object.GetDeletionTimestamp().IsZero()
181+
})).
178182
Complete(r)
179183
if err != nil {
180184
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
@@ -1058,6 +1058,9 @@ func reconcileInitialCNSState(ctx context.Context, cli nodeNetworkConfigGetter,
10581058
}
10591059

10601060
logger.Printf("Retrieved NNC: %+v", nnc)
1061+
if !nnc.DeletionTimestamp.IsZero() {
1062+
return errors.New("failed to init CNS state: NNC is being deleted")
1063+
}
10611064

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

0 commit comments

Comments
 (0)