Skip to content

Commit 0f82f88

Browse files
authored
[node-labeler] Do not return an error if the node does not exist (#16832)
* [node-labeler] Do not return an error if the node does not exist * Increase maxConcurrentReconciles to 20
1 parent 2272f18 commit 0f82f88

File tree

1 file changed

+10
-1
lines changed
  • components/node-labeler/cmd

1 file changed

+10
-1
lines changed

components/node-labeler/cmd/run.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ var runCmd = &cobra.Command{
7272
client,
7373
}
7474

75-
c, err := controller.New("pod-watcher", mgr, controller.Options{Reconciler: r})
75+
c, err := controller.New("pod-watcher", mgr, controller.Options{
76+
Reconciler: r,
77+
MaxConcurrentReconciles: 20,
78+
})
7679
if err != nil {
7780
log.WithError(err).Fatal("unable to bind controller watch event handler")
7881
}
@@ -188,6 +191,12 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req reconcile.Request) (r
188191
time.Sleep(1 * time.Second)
189192
err := updateLabel(labelToUpdate, false, nodeName, r)
190193
if err != nil {
194+
// this is a edge case when cluster-autoscaler removes a node
195+
// (all the running pods will be removed after that)
196+
if errors.IsNotFound(err) {
197+
return reconcile.Result{}, nil
198+
}
199+
191200
log.WithError(err).Error("unexpected error removing node label")
192201
return reconcile.Result{RequeueAfter: time.Second * 10}, err
193202
}

0 commit comments

Comments
 (0)