Convert per-resource registries to all-resource registries #622
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As a preparatory refactoring, the per-resource registries cease to exist and are replaced by all-resource registries. The matching now additionally include resource matching — in addition to labels, annotations, callbacks, and other filters.
The final goal is that the resources are split into resource selectors (criteria) & actual resources (specifics) so that one spec could match multiple refs — within one and only one handler. In this context, such "all-resource" structure of registries becomes unavoidable.
[SEMI-BREAKING] The old way of accessing the registries by resources-as-keys is supported for backward compatibility, but it returns the whole all-resource registry itself, which may contain handlers unrelated to the requested resource — proper methods should be used instead, which check for resource spec. If this is not done, handlers for unrelated resources can be exposed. Nevertheless, this edge-case breakage is acceptable: registries were exposed by mistake (they are not the value that this framework delivers), and are already deprecated.