Skip to content

Strange behavior if kopf-operator gets restarted. #1185

@tikr7

Description

@tikr7

Long story short

In case the kopf-operator has been restarted, it seems old CR's are not really under control anymore.
I cant't delete the CR's because they still have the finalizer (of course I dont wanna patch the finalizer manually with kubectl all the time).

See logs below, it looks like it is doing the on.resume for all old CR's but only for 2 it goes beyond the first line of code.

A nice workaround would be, if I could delete the finalizer in kopf under on.resume.

Btw, If I delete CR it never goes into on.delete for the old CR's.

@nolar would be great to get some assistance here. Maybe I am doing something wrong...

Kopf version

1.38.0

Kubernetes version

1.32.6

Python version

3.13

Code

@kopf.on.resume('projectannotationdonecheckers')
def resume_handler_new(spec, name, logger, annotations, patch, body, **_):
    logger.warning(f"on.resume for '{name}'.")
    logger.warning(f"on.resume for '{name}'. finalizer: '{body['metadata']['finalizers']}'")
    #patch.annotations["finalizers"] = ""
    patch.metadata["finalizers"] = ["huhu"]
    patch.metadata.finalizers = ["huhu"]

Logs

[2025-09-10 16:03:15,626] kopf.objects         [WARNING ] [sitelens/kopf-padc-062199c1-6f910a55-2023-06-22] on.resume for 'kopf-padc-062199c1-6f910a55-2023-06-22'.
[2025-09-10 16:03:15,626] kopf.objects         [WARNING ] [sitelens/kopf-padc-062199c1-6f910a55-2023-06-23] on.resume for 'kopf-padc-062199c1-6f910a55-2023-06-23'.
[2025-09-10 16:03:15,627] kopf.objects         [WARNING ] [sitelens/kopf-padc-062199c1-6f910a55-2023-06-24] on.resume for 'kopf-padc-062199c1-6f910a55-2023-06-24'.
[2025-09-10 16:03:15,628] kopf.objects         [WARNING ] [sitelens/kopf-padc-062199c1-6f910a55-2023-06-26] on.resume for 'kopf-padc-062199c1-6f910a55-2023-06-26'.
[2025-09-10 16:03:15,629] kopf.objects         [WARNING ] [sitelens/kopf-padc-062199c1-6f910a55-2023-06-29] on.resume for 'kopf-padc-062199c1-6f910a55-2023-06-29'.
[2025-09-10 16:03:15,630] kopf.objects         [WARNING ] [sitelens/kopf-padc-062199c1-6f910a55-2023-06-22] on.resume for 'kopf-padc-062199c1-6f910a55-2023-06-22'. finalizer: '['kopf.zalando.org/KopfFinalizerMarker']'
[2025-09-10 16:03:15,630] kopf.objects         [WARNING ] [sitelens/kopf-padc-062199c1-6f910a55-2023-06-23] on.resume for 'kopf-padc-062199c1-6f910a55-2023-06-23'. finalizer: '['kopf.zalando.org/KopfFinalizerMarker']'

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions