nolar / kopf

A Python framework to write Kubernetes operators in just a few lines of code

Home Page:https://kopf.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Finalizers from other controllers conflicting with kopf finalizer

mkjpryor opened this issue · comments

Long story short

I have been chasing down a frustrating bug that I think might be down to the way that kopf applies its finalizer.

I have a number of custom operators based on kopf, and it is great. However I have some common cleanup functionality that I need to apply to a number of CRDs - some from my kopf operators and some from third-party operators written using the Go SDK.

In order to avoid replicating code in all my operators, and possibly having to implement changes in third-party operators, I have written a generic operator, again using kopf, that adds an additional finalizer to the objects that is removed once the cleanup is done. This operator uses exclusively kopf.on.event handlers, with changes made by a Kubernetes client outside of kopf's remit.

This is working perfectly for the third-party operators that use the Go SDK. However with the kopf-based operators I am seeing my generic operator fighting with kopf as to which finalizers are present - the kopf finalizer comes and goes from the object, and in particular does not seem to be present at some critical times such as when the object is deleted.

Is this expected behaviour? If not, is there something better I can do?

Kopf version

1.37.1

Kubernetes version

1.29

Python version

3.10

Code

No response

Logs

No response

Additional information

No response