Conversation
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Open
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces initial scaffolding for “event source pooling” (starting with informers) under processing.event.source.pool, likely to enable sharing/reuse of informers across components/controllers.
Changes:
- Added
EventSourcePoolinterface andAbstractEventSourcePoolbase type. - Added
InformerClassifierrecord to key pooled informers by selector/namespace/resource type. - Added initial (currently incomplete)
InformerPoolimplementation and a minor whitespace cleanup inInformerManager.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/pool/InformerPool.java |
Adds a new pool for SharedIndexInformer<?> instances (currently stubbed/incomplete). |
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/pool/InformerClassifier.java |
Adds a classifier record intended as the cache key for pooled informers. |
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/pool/EventSourcePool.java |
Introduces a generic pool interface for event sources. |
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/pool/AbstractEventSourcePool.java |
Adds a base class placeholder for pool implementations. |
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java |
Removes an extraneous whitespace line in createEventSource. |
Comment on lines
+3
to
+10
| import io.fabric8.kubernetes.api.model.HasMetadata; | ||
| import io.javaoperatorsdk.operator.api.config.informer.FieldSelector; | ||
|
|
||
| public record InformerClassifier( | ||
| String labelSelector, | ||
| String namespaceIdentifier, | ||
| Class<? extends HasMetadata> resourceClass, | ||
| FieldSelector fieldSelector) {} |
Comment on lines
+24
to
+33
| var actual = informers.get(classifier); | ||
| if (actual == null) { | ||
| actual = null; // create Informer | ||
| } | ||
| incrementCounter(actual); | ||
| return null; | ||
| } | ||
|
|
||
| private synchronized void incrementCounter(SharedIndexInformer<?> actual) { | ||
| counters.compute(actual, (k, v) -> new AtomicInteger(v == null ? 0 : v.incrementAndGet())); |
| } | ||
|
|
||
| private synchronized void incrementCounter(SharedIndexInformer<?> actual) { | ||
| counters.compute(actual, (k, v) -> new AtomicInteger(v == null ? 0 : v.incrementAndGet())); |
Comment on lines
+24
to
+35
| var actual = informers.get(classifier); | ||
| if (actual == null) { | ||
| actual = null; // create Informer | ||
| } | ||
| incrementCounter(actual); | ||
| return null; | ||
| } | ||
|
|
||
| private synchronized void incrementCounter(SharedIndexInformer<?> actual) { | ||
| counters.compute(actual, (k, v) -> new AtomicInteger(v == null ? 0 : v.incrementAndGet())); | ||
| } | ||
|
|
Comment on lines
+33
to
+37
| counters.compute(actual, (k, v) -> new AtomicInteger(v == null ? 0 : v.incrementAndGet())); | ||
| } | ||
|
|
||
| @Override | ||
| public void removeEventSource(SharedIndexInformer<?> informerEventSource) {} |
Comment on lines
+23
to
+37
| public SharedIndexInformer<?> getEventSource(InformerClassifier classifier) { | ||
| var actual = informers.get(classifier); | ||
| if (actual == null) { | ||
| actual = null; // create Informer | ||
| } | ||
| incrementCounter(actual); | ||
| return null; | ||
| } | ||
|
|
||
| private synchronized void incrementCounter(SharedIndexInformer<?> actual) { | ||
| counters.compute(actual, (k, v) -> new AtomicInteger(v == null ? 0 : v.incrementAndGet())); | ||
| } | ||
|
|
||
| @Override | ||
| public void removeEventSource(SharedIndexInformer<?> informerEventSource) {} |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Will put here early impl so we can discuss on the community meeting. Also will expand design description in the issue.