Action based on metadata/annotations #3895
-
I have an operator which watches for the status of pods, job and services. Whenever an annotation is noticed (applied through external factor kubectl patch...) on the job, the reconciler kicks in and performs the action I wanted (Delete a certain pod). But immediately after this action, I want to reset/update the annotation so that the reconciliation doesn't trigger infinitely. I tried to update the job's metadata/annotation from the reconciliation loop but it doesn't reflect when I do |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, It seems that the problem you're facing is related to implementing non-idempotent logic. This approach does not align well with the operator pattern and controller-runtime principles. The foundational rule in these designs is to clearly declare the desired state and ensure that your implementations are idempotent. This means that no matter how many times the reconciliation loop executes, it should consistently produce the same results without unintended side effects. So, you need think in something like: Always, when has not the annotation to do A and etc.
I hope that the info provided help you out. |
Beta Was this translation helpful? Give feedback.
Hi,
It seems that the problem you're facing is related to implementing non-idempotent logic. This approach does not align well with the operator pattern and controller-runtime principles. The foundational rule in these designs is to clearly declare the desired state and ensure that your implementations are idempotent. This means that no matter how many times the reconciliation loop executes, it should consistently produce the same results without unintended side effects.
So, you need think in something like:
Always, when has not the annotation to do A and etc.
For further information, I would like to suggest you check out the following links.