Skip to content

Commit

Permalink
chore: adds requeing duration while finalizing node
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtcoder17 committed Jan 20, 2025
1 parent ea06526 commit b21246b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
13 changes: 2 additions & 11 deletions operators/nodepool/internal/node-controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ func (r *Reconciler) finalize(req *rApi.Request[*clustersv1.Node]) stepResult.Re
return check.Completed()
}

return check.StillRunning(fmt.Errorf("node will be deleted at %s", t.Format(time.RFC3339))).NoRequeue().RequeueAfter(time.Since(t))
requeueAfter := time.Since(t)
return check.StillRunning(fmt.Errorf("node will be deleted at %s, requeueing after %.2fs", t.Format(time.RFC3339), requeueAfter.Seconds())).NoRequeue().RequeueAfter(requeueAfter)
}

func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand All @@ -229,16 +230,6 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
}),
)

// builder.Watches(
// &source.Kind{Type: &corev1.Node{}},
// handler.EnqueueRequestsFromMapFunc(func(obj client.Object) []reconcile.Request {
// if v, ok := obj.GetLabels()[constants.NodeNameKey]; ok {
// return []reconcile.Request{{NamespacedName: fn.NN("", v)}}
// }
// return nil
// }),
// )

builder.WithOptions(controller.Options{MaxConcurrentReconciles: r.Env.MaxConcurrentReconciles})
builder.WithEventFilter(rApi.ReconcileFilter())
return builder.Complete(r)
Expand Down
2 changes: 1 addition & 1 deletion operators/nodepool/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main

import (
"github.com/kloudlite/operator/operator"
"github.com/kloudlite/operator/operators/nodepool/controller"
"github.com/kloudlite/operator/toolkit/operator"
)

func main() {
Expand Down

0 comments on commit b21246b

Please sign in to comment.