-
I have a question wrt setting finalizers, the book example sets in the controller reconcile loop but I do have the impression that setting the finalizer in the mutating webhook (if you already have one) is also an option What other people think? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
I would recommend you add it after you fetch the CR and ensure that it exists. You might want to check here: https://sdk.operatorframework.io/docs/building-operators/golang/advanced-topics/#external-resources some examples |
Beta Was this translation helpful? Give feedback.
-
@Segflow There can be always two places to update a resource object, in controller reconcile or in mutating webhook. My suggestion is, do it in controller reconcile as much as possible, unless the object has to be modified during its request to APIServer. So back to your question, it depends on what you want to do with the finalizers.
Usually most cases are (2). |
Beta Was this translation helpful? Give feedback.
-
@FillZpp I like that approach of thinking thanks! One other pros I can found when doing the initialization (e.g setting finalizers) in the controller is that it also work if you have webhook disabled (e.g when doing local dev) |
Beta Was this translation helpful? Give feedback.
-
Closing since it is answered. |
Beta Was this translation helpful? Give feedback.
@Segflow There can be always two places to update a resource object, in controller reconcile or in mutating webhook. My suggestion is, do it in controller reconcile as much as possible, unless the object has to be modified during its request to APIServer.
So back to your question, it depends on what you want to do with the finalizers.