Skip to content

Get reason, why reconciler was called (resource creation / update / deletion?) #2179

Closed Answered by DirectXMan12
tim-hilt asked this question in Support
Discussion options

You must be logged in to vote

It's generally considered bad practice to do different actions on Create vs Update -- for example, an Update event could appear as a Create due to a re-list. Reconcile should generally observe current state & diff with desired state to figure out what to do.

For delete, you've got two options:

  1. You can check for NotFound when you try to get the object as you note above. This is good if you just want to log or something.
  2. If you need to consistently perform some action just before deletion (e.g. you want to decommission cloud resources, etc), you can use a finalizer, and look for deletion timestamps instead. This will mean an object cannot be fully deleted until your controller processes th…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@tim-hilt
Comment options

@camilamacedo86
Comment options

@roopeshsn
Comment options

Answer selected by camilamacedo86
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
4 participants