Skip to content

[node-labeler] Do not return an error if the node does not exist #16832

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

Merged
merged 2 commits into from
Mar 13, 2023
Merged
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
11 changes: 10 additions & 1 deletion components/node-labeler/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ var runCmd = &cobra.Command{
client,
}

c, err := controller.New("pod-watcher", mgr, controller.Options{Reconciler: r})
c, err := controller.New("pod-watcher", mgr, controller.Options{
Reconciler: r,
MaxConcurrentReconciles: 20,
})
if err != nil {
log.WithError(err).Fatal("unable to bind controller watch event handler")
}
Expand Down Expand Up @@ -188,6 +191,12 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req reconcile.Request) (r
time.Sleep(1 * time.Second)
err := updateLabel(labelToUpdate, false, nodeName, r)
if err != nil {
// this is a edge case when cluster-autoscaler removes a node
// (all the running pods will be removed after that)
if errors.IsNotFound(err) {
return reconcile.Result{}, nil
}

log.WithError(err).Error("unexpected error removing node label")
return reconcile.Result{RequeueAfter: time.Second * 10}, err
}
Expand Down