example code to be tested for decomission_controller.go:86
return ctrl.Result{}, k8sclient.IgnoreNotFound(retry.RetryOnConflict(retry.DefaultRetry, func() error {
node := &corev1.Node{}
if err := r.Get(ctx, req.NamespacedName, node); err != nil {
return err
}
nodeBase := node.DeepCopy()
if controllerutil.AddFinalizer(node, decommissionFinalizerName) {
return r.Patch(ctx, node, k8sclient.MergeFromWithOptions(
nodeBase, k8sclient.MergeFromWithOptimisticLock{}))
}
return nil
}))