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

Handlers for resuming only unmodified/idling/sleeping resources #241

Open
kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Open

Handlers for resuming only unmodified/idling/sleeping resources #241

kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Labels
archive enhancement New feature or request good first issue Good for newcomers

Comments

@kopf-archiver
Copy link

kopf-archiver bot commented Aug 18, 2020

An issue by nolar at 2019-11-18 20:48:46+00:00
Original URL: zalando-incubator/kopf#241
 

Background

As discussed in #223 comments (#223 (comment) and below), there is one type of handlers is missing: when an operator restarts, it should process all the objects that existed before, but were neither updated, nor deleted.

Originally, this was a technical solution for @kopf.on.resume() handlers in #96. But then it was intentionally changed to #105 & 0.16 to make the resuming handlers for task/thread spawning, i.e. executed no matter what was the object's state on the operator startup (created/updated/deleted). And later fixed in #230 & 0.23rc1 to be actually executed as intended.

Goal

However, the use-case of "unmodified only" handlers is missing now, and cannot be simulated with any combination of the existing handlers.

Find a good name for it. @kopf.on.notice()? @kopf.on.recall()? @kopf.on.existence()? Anything else?

Add such a handler for "unmodified only" cases on the operator startup.

It must be triggered only if CREATE/UPDATE/DELETE cause reasons are not applicable. For all these causes, their relevant handlers will be executed, plus on-resume mixed-in handlers.

Related

A use-case described for these handlers (#223 (comment)) is basically a reconciliation, and may be related to #150 and #19.

In this case, however, the resource should be processed on the operator restarts — but should remain separated from the creation/update/deletion handlers for clarity, unlike @kopf.on.resume(), which is mixed in with all of them.

Implementation hints

This should be easy. First, see kopf.reactor.causation.Reason.RESUME — probably, must be renamed to something else to not be confused with the resuming handlers. Second, add a decorator in kopf.on with reason=WHATEVERITISNAMED, initial=True. This should be enough. Try in action. Add few tests (look for on.resume and Reason.RESUME tests). Add the docs.


Commented by pshchelo at 2019-11-19 15:02:25+00:00
 

first, thanks for your help with our use-case 👍

as for naming, I'd suggest on.exists, but whatever floats your boat :-)

@kopf-archiver kopf-archiver bot closed this as completed Aug 18, 2020
@kopf-archiver kopf-archiver bot changed the title [archival placeholder] Handlers for resuming only unmodified/idling/sleeping resources Aug 19, 2020
@kopf-archiver kopf-archiver bot added enhancement New feature or request good first issue Good for newcomers labels Aug 19, 2020
@kopf-archiver kopf-archiver bot reopened this Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archive enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

0 participants