Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document explicitly that timer/daemon override request for no finalizer. #1074

Open
GrahamDumpleton opened this issue Nov 3, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@GrahamDumpleton
Copy link

Problem

Using:

@kopf.on.delete("example.com", "v1alpha1", "example", optional=True)
def example_delete(**_):
    pass

with expectation that a finalizer will not be added for kopf operator to resource.

At the same time using @kopf.timer on same resource type.

Use of @kopf.timer overrides optional=True in @kopf.on.delete and makes finalizer mandatory.

See

kopf/kopf/on.py

Line 764 in 91e8fd6

initial_delay=initial_delay, requires_finalizer=True,

Not even speculating on why that is required for a timer, but I can't seem to find a warning on docs for timer that using it will cause optional=True in @kopf.on.delete to be ignored.

Proposal

Add warning in docs if analysis is correct and this is a requirement for using @kopf.timer. IOW, warn that optional argument to @kopf.on.delete will be overridden.

Code

No response

Additional information

The @kopf.daemon also overrides requirement for finalizer. The docs for it have section https://kopf.readthedocs.io/en/stable/daemons/#deletion-prevention and finalizers are mentioned, although still isn't explicit in saying that optional=True will be ignored in @kopf.on.delete as a result.

@GrahamDumpleton GrahamDumpleton added the enhancement New feature or request label Nov 3, 2023
@GrahamDumpleton
Copy link
Author

Section https://kopf.readthedocs.io/en/stable/handlers/#state-changing-handlers in docs where mentions optional=True should also perhaps note that this will be ignored in case of @kopf.timer and @kopf.daemon being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant