Skip to content

Commit

Permalink
Add more example code of using finalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
willise committed Oct 25, 2018
1 parent 0e67e88 commit d904596
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/book/beyond_basics/using_finalizers.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err
// The object is being deleted
if containsString(instance.ObjectMeta.Finalizers, myFinalizerName) {
// our finalizer is present, so lets handle our external dependency
err := r.deleteExternalDependency(instance)
if err != nil {
if err := r.deleteExternalDependency(instance); err != nil {
// if fail to delete the external dependency here, return with error
// so that it can be retried
return reconcile.Result{}, err
Expand All @@ -59,6 +58,9 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err
return reconcile.Result{Requeue: true}, nil
}
}

// Our finalizer has finished, so the reconciler can do nothing.
return reconcile.Result{}, nil
}
....
....
Expand Down

0 comments on commit d904596

Please sign in to comment.