Skip to content

Select resources to handle via a callable selector#1235

Merged
nolar merged 1 commit into
mainfrom
callable-selectors
Feb 3, 2026
Merged

Select resources to handle via a callable selector#1235
nolar merged 1 commit into
mainfrom
callable-selectors

Conversation

@nolar

@nolar nolar commented Feb 2, 2026

Copy link
Copy Markdown
Owner

Example:

import kopf

def kex_selector(resource: kopf.Resource) -> bool:
    return resource.plural == 'kopfexamples' and resource.preferred

@kopf.on.event(kex_selector)
def fn(**_):
    pass

TODOs:

  • Tests.

Closes #1187, closes #1194 (supersedes it), closes #1013.

@nolar nolar added the enhancement New feature or request label Feb 2, 2026
@nolar nolar force-pushed the callable-selectors branch 2 times, most recently from 9158b80 to eff9acc Compare February 2, 2026 20:37
@nolar nolar marked this pull request as ready for review February 2, 2026 20:37
@nolar nolar force-pushed the callable-selectors branch 3 times, most recently from e32e329 to 2f65107 Compare February 3, 2026 14:22
Signed-off-by: Sergey Vasilyev <nolar@nolar.info>
@nolar nolar force-pushed the callable-selectors branch from 2f65107 to 7ace19a Compare February 3, 2026 14:26
@nolar nolar merged commit 961ec66 into main Feb 3, 2026
38 checks passed
@nolar nolar deleted the callable-selectors branch February 3, 2026 14:44
@nolar nolar changed the title Select resource to handle via a callable selector Select resources to handle via a callable selector Feb 7, 2026
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

Successfully merging this pull request may close these issues.

Handler rules not register all resources Resource scanning is skipping resources that don't have the "preferred" version in an api group

1 participant