| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
This PR updates the Maven project/module versions across Java Operator SDK and its submodules, presumably in preparation for the next development cycle.
Changes:
Copilot reviewed 17 out of 17 changed files in this pull request and generated 17 comments.
Show a summary per file| File | Description |
|---|---|
| pom.xml | Updates root project version used across the multi-module build. |
| operator-framework-core/pom.xml | Aligns module parent version with the root project version. |
| operator-framework/pom.xml | Aligns module parent version with the root project version. |
| operator-framework-junit/pom.xml | Aligns module parent version with the root project version. |
| operator-framework-bom/pom.xml | Updates BOM artifact version to match the intended release line. |
| micrometer-support/pom.xml | Aligns module parent version with the root project version. |
| caffeine-bounded-cache-support/pom.xml | Aligns module parent version with the root project version. |
| bootstrapper-maven-plugin/pom.xml | Aligns module parent version with the root project version. |
| test-index-processor/pom.xml | Aligns module parent version with the root project version. |
| migration/pom.xml | Aligns module parent version with the root project version. |
| sample-operators/pom.xml | Aligns sample parent version with the root project version. |
| sample-operators/webpage/pom.xml | Aligns sample module parent version with the sample reactor version. |
| sample-operators/tomcat-operator/pom.xml | Aligns sample module parent version with the sample reactor version. |
| sample-operators/operations/pom.xml | Aligns sample module parent version with the sample reactor version. |
| sample-operators/mysql-schema/pom.xml | Aligns sample module parent version with the sample reactor version. |
| sample-operators/leader-election/pom.xml | Aligns sample module parent version with the sample reactor version. |
| sample-operators/controller-namespace-deletion/pom.xml | Aligns sample module parent version with the sample reactor version. |
Sorry, something went wrong.
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>java-operator-sdk</artifactId> | ||
| <version>5.4.1-SNAPSHOT</version> | ||
| <version>999-SNAPSHOT</version> |
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>java-operator-sdk</artifactId> | ||
| <version>5.4.1-SNAPSHOT</version> | ||
| <version>999-SNAPSHOT</version> |
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>java-operator-sdk</artifactId> | ||
| <version>5.4.1-SNAPSHOT</version> | ||
| <version>999-SNAPSHOT</version> |
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>java-operator-sdk</artifactId> | ||
| <version>5.4.1-SNAPSHOT</version> | ||
| <version>999-SNAPSHOT</version> |
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>operator-framework-bom</artifactId> | ||
| <version>5.4.1-SNAPSHOT</version> | ||
| <version>999-SNAPSHOT</version> |
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>sample-operators</artifactId> | ||
| <version>5.4.1-SNAPSHOT</version> | ||
| <version>999-SNAPSHOT</version> |
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>sample-operators</artifactId> | ||
| <version>5.4.1-SNAPSHOT</version> | ||
| <version>999-SNAPSHOT</version> |
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>sample-operators</artifactId> | ||
| <version>5.4.1-SNAPSHOT</version> | ||
| <version>999-SNAPSHOT</version> |
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>sample-operators</artifactId> | ||
| <version>5.4.1-SNAPSHOT</version> | ||
| <version>999-SNAPSHOT</version> |
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>sample-operators</artifactId> | ||
| <version>5.4.1-SNAPSHOT</version> | ||
| <version>999-SNAPSHOT</version> |
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
There was a problem hiding this comment.
Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (17)pom.xml:24
<version>999-SNAPSHOT</version>
operator-framework-core/pom.xml:24
<version>999-SNAPSHOT</version>
operator-framework/pom.xml:24
<version>999-SNAPSHOT</version>
operator-framework-junit/pom.xml:24
<version>999-SNAPSHOT</version>
operator-framework-bom/pom.xml:24
<version>999-SNAPSHOT</version>
migration/pom.xml:24
<version>999-SNAPSHOT</version>
micrometer-support/pom.xml:24
<version>999-SNAPSHOT</version>
caffeine-bounded-cache-support/pom.xml:24
<version>999-SNAPSHOT</version>
bootstrapper-maven-plugin/pom.xml:25
<version>999-SNAPSHOT</version>
test-index-processor/pom.xml:25
<version>999-SNAPSHOT</version>
sample-operators/pom.xml:25
<version>999-SNAPSHOT</version>
sample-operators/webpage/pom.xml:25
<version>999-SNAPSHOT</version>
sample-operators/tomcat-operator/pom.xml:25
<version>999-SNAPSHOT</version>
sample-operators/operations/pom.xml:25
<version>999-SNAPSHOT</version>
sample-operators/mysql-schema/pom.xml:25
<version>999-SNAPSHOT</version>
sample-operators/leader-election/pom.xml:25
<version>999-SNAPSHOT</version>
sample-operators/controller-namespace-deletion/pom.xml:25
<version>999-SNAPSHOT</version>
Sorry, something went wrong.
…us (#3480) Add integration tests that showcases handling explicit state in status. Both for simple managed/secondary resources and using a dependent resource. Signed-off-by: Attila Mészáros <a_meszaros@apple.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot reviewed 28 out of 28 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)pom.xml:24
<version>999-SNAPSHOT</version>
operator-framework/pom.xml:24
<version>999-SNAPSHOT</version>
operator-framework-bom/pom.xml:24
<version>999-SNAPSHOT</version>
Sorry, something went wrong.
* feat: pool informers so controllers and event sources can share them Every InformerEventSource used to create its own SharedIndexInformer, so an operator whose controllers all watch the same secondary type - ConfigMap and Secret being the usual suspects - opened one watch connection and kept one cache per controller for the very same resources. Informers are now handed out by an InformerPool obtained from the ConfigurationService, keyed by an InformerClassifier. Event sources whose classifiers are equal are backed by one informer; the pool reference counts its users and stops the informer once the last one releases it. The classifier is made up of everything that decides what an informer watches and how: the KubernetesClient instance (compared by identity, since two clients for the same API server may still differ in credentials, impersonation or TLS material), the resource class or the group/version/kind for generic resources, the namespace, the label, field and shard selectors, and the item store. Two components are deliberately not part of that identity. The informerListLimit is excluded, so event sources that disagree only on it still share an informer, keeping the limit of whichever one created it and logging a warning. Indexers are excluded because they can be added to a running informer: they are registered under a name qualified with the controller and event source that added them, so index names stay private to an event source while callers keep using their own names, and they are removed again when that event source releases the informer. Two strategies ship: DefaultInformerPool shares as described and is the default, NonSharingInformerPool creates a dedicated informer per event source for anyone wanting to opt out. Either is selected with ConfigurationServiceOverrider#withInformerPool, and a custom strategy extends AbstractInformerPool, which already creates the informers from a classifier, starts them and waits for their caches to sync, leaving the subclass only the question of whether and when an informer is shared. Consequently informer creation and startup moved out of InformerWrapper and InformerManager into the pool, InformerManager acquires and releases informers instead of owning them, and it removes its own event handler and indexers from an informer that keeps running for others. An event source registered dynamically against an already running shared informer needs no special handling: the client replays the cache contents to a newly added handler. Also in support of the above: ConfigurationService#informerPool, an InformerEventSource constructor that no longer needs an EventSourceContext (the one taking it is deprecated), the resource group/version/kind on InformerConfiguration, equality and toString on FieldSelector, and equality of GroupVersionKindPlural made consistent with its hashCode so that an unspecified plural no longer splits informers. The pooling itself is production ready; the configuration API around it is marked experimental and may still change. Covered by unit tests for the pools, the classifier, the wrapper and the manager, and by integration tests for sharing, dynamic registration and de-registration that each run against both strategies. Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
| private final AtomicBoolean blockNextRelease = new AtomicBoolean(true); | ||
|
|
||
| @Override | ||
| public <R extends HasMetadata> Optional<SharedIndexInformer<R>> releaseInformer( |
| } | ||
|
|
||
| @Override | ||
| public <R extends HasMetadata> Optional<SharedIndexInformer<R>> releaseInformer( |
| } | ||
|
|
||
| @Override | ||
| public InformerPool informerPool() { |
| final var configurationService = | ||
| ConfigurationService.newOverriddenConfigurationService( | ||
| this.configurationService, o -> o.withKubernetesClient(client)); |
There was a problem hiding this comment.
Copilot reviewed 88 out of 88 changed files in this pull request and generated no new comments.
Suppressed comments (3)pom.xml:25
private final Map<ClassifierWithName, SharedIndexInformer> informers = new ConcurrentHashMap();
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java:502
@Experimental(
"Only the configuration API around informer pooling could still change in a"
+ " non-backwards-compatible way, the pooling itself is prod ready.")
default InformerPool informerPool() {
return new DefaultInformerPool();
Sorry, something went wrong.
Bumps [org.apache.maven.plugins:maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.5.0 to 3.5.1. - [Release notes](https://github.com/apache/maven-jar-plugin/releases) - [Commits](apache/maven-jar-plugin@maven-jar-plugin-3.5.0...maven-jar-plugin-3.5.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-jar-plugin dependency-version: 3.5.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps `openrewrite.version` from 8.87.5 to 8.87.7. Updates `org.openrewrite:rewrite-java` from 8.87.5 to 8.87.7 - [Release notes](https://github.com/openrewrite/rewrite/releases) - [Commits](openrewrite/rewrite@v8.87.5...v8.87.7) Updates `org.openrewrite:rewrite-maven` from 8.87.5 to 8.87.7 - [Release notes](https://github.com/openrewrite/rewrite/releases) - [Commits](openrewrite/rewrite@v8.87.5...v8.87.7) Updates `org.openrewrite:rewrite-test` from 8.87.5 to 8.87.7 - [Release notes](https://github.com/openrewrite/rewrite/releases) - [Commits](openrewrite/rewrite@v8.87.5...v8.87.7) Updates `org.openrewrite:rewrite-java-17` from 8.87.5 to 8.87.7 - [Release notes](https://github.com/openrewrite/rewrite/releases) - [Commits](openrewrite/rewrite@v8.87.5...v8.87.7) --- updated-dependencies: - dependency-name: org.openrewrite:rewrite-java dependency-version: 8.87.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.openrewrite:rewrite-maven dependency-version: 8.87.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.openrewrite:rewrite-test dependency-version: 8.87.7 dependency-type: direct:development update-type: version-update:semver-patch - dependency-name: org.openrewrite:rewrite-java-17 dependency-version: 8.87.7 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…8.0 to 3.9.0 (#3515) Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This needed to be fixed after rebase. Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
|
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. |
Sorry, something went wrong.
There was a problem hiding this comment.
Copilot reviewed 106 out of 106 changed files in this pull request and generated 1 comment.
Suppressed comments (3)pom.xml:25
<parent>
<groupId>io.javaoperatorsdk</groupId>
<artifactId>java-operator-sdk</artifactId>
<version>999-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
sample-operators/pom.xml:26
Sorry, something went wrong.
This is expected for a pool to set. Event if the underlying implementation would set it, this is the correct way to handle it. Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
There was a problem hiding this comment.
Copilot reviewed 106 out of 106 changed files in this pull request and generated no new comments.
Suppressed comments (2)pom.xml:24
* <p><strong>Implementations must return the same instance on every call.</strong> The pool is
* effectively a per-{@code ConfigurationService} singleton: controllers share informers only if
* they resolve the same pool, and reference counting / informer shutdown are only correct if
* {@code getInformer} and {@code releaseInformer} operate on that same instance. This is
* intentionally not a {@code default} method, since a {@code default} could not cache the result
Sorry, something went wrong.
AbstractWorkflowExecutor called Workflow#getDependentResourcesByName purely to read its size. That allocates a HashMap and walks every node to collect the dependent resources, then discards the map. The executor is constructed on every reconcile and cleanup of a workflow-based reconciler, so use the existing Workflow#size instead.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting. Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe change adds configurable informer pooling, opt-in API-version change detection, a Kotlin operator sample, framework behavior corrections, integration tests, documentation, and build updates. ChangesFramework and informer pooling
Kotlin operator sample
Repository support updates
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant ManagedInformerEventSource
participant InformerManager
participant InformerPool
participant SharedIndexInformer
ManagedInformerEventSource->>InformerManager: start event source
InformerManager->>InformerPool: acquire informer by classifier
InformerPool->>SharedIndexInformer: create or reuse informer
InformerManager->>InformerPool: start and await cache sync
ManagedInformerEventSource->>InformerManager: stop or change namespace
InformerManager->>InformerPool: release informer
InformerPool->>SharedIndexInformer: stop after final release
❌ Failed checks (1 warning, 1 inconclusive)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
…3550) ResourceOperations#desiredForJsonPatch takes an Options argument that it never reads - it only clones the actual resource and applies the operator. All six jsonPatch call sites thread the value in for nothing, which suggests the method still honours the option. Remove the parameter.
No behavior change; each site is replaced by a helper that already exists. - PrimaryUpdateAndCacheUtils#compareResourceVersions (and its private validateResourceVersion) duplicated the entire algorithm of ReconcilerUtilsInternal#validateAndCompareResourceVersions: the length-first compare, the empty check, the leading-zero check and the same exception messages. It had no production caller, so the copy could silently drift from the version all production paths use. Delegate instead. - addFinalizerWithSSA builds its bare SSA skeleton with HasMetadata#initNameAndNamespaceFrom, which ResourceOperations already uses for the same purpose and which is Namespaced-aware. - AbstractInformerPool formats the informer identifier with ReconcilerUtilsInternal#getResourceTypeNameWithVersion instead of concatenating the resource name and version by hand. - EventFilterWindow uses ExtendedResourceEvent#getResourceVersion, which had no callers even though it is exactly the expression used here. - LocallyRunOperatorExtension instantiates reconcilers with Utils#instantiate, so it also supports non-public no-arg constructors and reports the failing class instead of wrapping in a bare RuntimeException.
…3543) The event count is increased at the beginning of the reconciliation, thus waiting for it released the test into the middle of a reconciliation that was still about to remove the finalizer. The subsequent update then raced with that removal and failed with a conflict. Wait for the finalizer removal to actually land, and retry the (optimistically locked) update with a fresh read on conflict.
There was a problem hiding this comment.
Actionable comments posted: 10
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java (1)111-136: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Serialize namespace additions with shutdown.
stop() can complete after changeNamespaces() removes existing sources but before it inserts a new source. The new source then acquires and starts an informer after shutdown, with no owner left to release it.
Two concurrent changeNamespaces() calls can also both observe a missing namespace. Each call acquires a pool reference, but sources.put() retains only one wrapper.
Guard source lookup, acquisition, insertion, and shutdown with one lifecycle lock and a stopped state. Add a race test for stop() concurrent with an added namespace.
Also applies to: 176-205
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java` around lines 111 - 136, Update InformerManager.changeNamespaces and stop to use one shared lifecycle lock and stopped state. Under that lock, serialize source lookup, acquisition, insertion, removal, and shutdown so additions cannot start after stop and concurrent namespace changes cannot acquire duplicate sources; ensure additions are rejected or released once stopped. Add a race test covering stop() concurrent with adding a namespace.
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusIT.java (1)🤖 Prompt for all review comments with AI agentsoperator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusStatus.java (1)76-84: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Remove assertion-restating comments.
The assertions already state the required behavior. Keep comments only for very long or complex logic.
🤖 Prompt for AI Agents
- operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusIT.java#L76-L84: Remove the comments before the size and status-ID assertions.
- operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/externalstateinstatus/ExternalStateInStatusWorkflowIT.java#L83-L93: Remove the equivalent comments before the size and status-ID assertions.
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusIT.java` around lines 76 - 84, Remove the assertion-restating comments in ExternalStateInStatusIT.java (lines 76-84) and ExternalStateInStatusWorkflowIT.java (lines 83-93), specifically those preceding the resource-size and status-ID assertions. Leave the assertions and test behavior unchanged.Source: Coding guidelines
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java (1)18-18: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Remove the unnecessary Javadocs from the simple status models.
- operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusStatus.java#L18-L18: Remove the Javadoc.
- operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/externalstateinstatus/ExternalStateInStatusStatus.java#L18-L18: Remove the Javadoc.
As per coding guidelines, “Do not add comments except for very long or complex logic.”
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusStatus.java` at line 18, Remove the unnecessary Javadoc above ExternalStateInStatusStatus in operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusStatus.java:18-18 and operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/externalstateinstatus/ExternalStateInStatusStatus.java:18-18; leave the simple status model declarations unchanged.Source: Coding guidelines
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/FieldSelector.java (1)79-79: 📐 Maintainability & Code Quality | 🔵 Trivial
Track the deprecation TODO.
// todo deprecate marks unfinished API work on a public interface method. Do you want me to open an issue to track deprecating getGroupVersionKind()?
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java` at line 79, Track the planned deprecation of the public interface method getGroupVersionKind() by creating an issue or equivalent project-tracking item, and retain the existing TODO marker until that work is formally tracked.operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSource.java (1)42-58: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Consider copying fields so the new hash code stays stable.
FieldSelector is now used inside InformerClassifier, which is a HashMap key in DefaultInformerPool. The constructors store the caller's list without a copy, so a later mutation of that list changes hashCode() and makes the pooled informer unreachable by its own key. A defensive copy in the constructors removes that risk and matches the "prefer immutable objects" guideline.
As per coding guidelines: "Prefer immutable objects where possible."
♻️ Proposed change (outside the reviewed range)🤖 Prompt for AI Agentspublic FieldSelector(List<Field> fields) { this.fields = List.copyOf(fields); } public FieldSelector(Field... fields) { this.fields = List.of(fields); }Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/FieldSelector.java` around lines 42 - 58, Update both FieldSelector constructors to defensively copy their inputs: use an immutable list copy for the List<Field> constructor and an immutable varargs list for the Field... constructor. Ensure the stored fields cannot be mutated after construction, keeping equals, hashCode, and toString unchanged.Source: Coding guidelines
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/pool/NonSharingInformerPool.java (1)176-186: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win
Protect the original startup failure from a failing cleanup.
If manager().stop() throws while releasing the already-acquired pooled informers, its exception replaces the real startup failure and the caller loses the root cause. Add the cleanup failure as a suppressed exception.
♻️ Proposed change🤖 Prompt for AI Agentstry { manager().start(); } catch (RuntimeException e) { // The manager acquires a pooled informer for every watched namespace before any of them is // started, so a startup failure has to hand those references back here: super.start() is not // reached, which leaves isRunning() false and makes stop() skip the release entirely. The // pooled informer would then be referenced forever (never stopped, even on a clean shutdown) // and a retried start() would acquire it a second time. - manager().stop(); + try { + manager().stop(); + } catch (RuntimeException cleanupFailure) { + e.addSuppressed(cleanupFailure); + } throw e; }Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSource.java` around lines 176 - 186, Update the RuntimeException catch in ManagedInformerEventSource startup so manager().stop() cleanup failures are added as suppressed exceptions to the original startup exception, then rethrow the original exception. Preserve cleanup execution and the existing startup behavior.operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/deregister/DeregisterPrimaryCustomResource.java (1)57-67: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win
Synchronize releaseInformer to match getInformer and DefaultInformerPool.
getInformer holds the instance monitor across the containsKey/create/put sequence. releaseInformer mutates the same map without that monitor. If a release and an acquisition for the same key overlap, the release can remove and stop an informer that the acquisition just published and returned. DefaultInformerPool.releaseInformer is synchronized, so the two pool implementations also expose different locking contracts today.
🔒 Proposed fix🤖 Prompt for AI Agents`@Override` - public <R extends HasMetadata> Optional<SharedIndexInformer<R>> releaseInformer( + public synchronized <R extends HasMetadata> Optional<SharedIndexInformer<R>> releaseInformer( String controllerName, String name, InformerClassifier<R> classifier) {Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/pool/NonSharingInformerPool.java` around lines 57 - 67, Synchronize NonSharingInformerPool.releaseInformer on the same instance monitor used by getInformer, covering the informer removal, stop, logging, and return flow. Match DefaultInformerPool’s locking contract so release cannot race with acquisition for the same key.24-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Remove redundant Javadocs from simple test types and variants.
These comments do not describe very long or complex logic.
- operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/deregister/DeregisterPrimaryCustomResource.java#L24-L24: Remove the model Javadoc.
- operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/deregister/DeregisterSharedInformerIT.java#L22-L22: Remove the variant Javadoc.
- operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/deregister/DeregisterWatchedCustomResource.java#L24-L27: Remove the model Javadoc.
- operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/deregister/NonSharingInformerPoolDeregisterSharedInformerIT.java#L23-L27: Remove the variant Javadoc.
- operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/dynamic/DynamicSharedInformerPrimaryCustomResource1.java#L24-L24: Remove the model Javadoc.
- operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/dynamic/NonSharingInformerPoolDynamicSharedInformerIT.java#L23-L28: Remove the variant Javadoc.
As per coding guidelines, do not add comments except for very long or complex logic.
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/deregister/DeregisterPrimaryCustomResource.java` at line 24, Remove the redundant Javadocs from the simple test types and variants in operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/deregister/DeregisterPrimaryCustomResource.java:24, DeregisterSharedInformerIT.java:22, DeregisterWatchedCustomResource.java:24-27, NonSharingInformerPoolDeregisterSharedInformerIT.java:23-27, and operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/dynamic/DynamicSharedInformerPrimaryCustomResource1.java:24 and NonSharingInformerPoolDynamicSharedInformerIT.java:23-28; leave the type and test implementations unchanged and do not add replacement comments.Source: Coding guidelines
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/content/en/docs/documentation/eventing.md`:
- Around line 358-364: Update the informer-pool description around “informer
pool” and “SharedIndexInformer” to explicitly limit sharing to controllers and
event sources within the same Operator instance/configuration service; clarify
that separate Operator instances or processes do not share informers.
In
`@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java`:
- Around line 483-503: Change ConfigurationService.informerPool() from a default
method to an abstract method by removing its DefaultInformerPool construction
and configuration logic. Keep the existing cached implementation in
AbstractConfigurationService unchanged so every configuration service returns
the same pool instance.
In
`@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java`:
- Around line 55-63: Update the deprecated InformerEventSource constructor
Javadoc to link with {`@link`
`#InformerEventSource`(InformerEventSourceConfiguration)}. In the constructor path
identified by InformerEventSource and InformerManager, preserve and propagate
context.getClient() instead of discarding the EventSourceContext, ensuring
deprecated callers use their configured client rather than the
ConfigurationService fallback.
In
`@operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/GroupVersionKindTest.java`:
- Around line 105-106: Remove the explanatory comment near the GroupVersionKind
equality test, leaving the test name and assertions unchanged.
In
`@operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/basic/AbstractSharedInformerIT.java`:
- Around line 63-83: Update bothControllersReconcileWatchingConfigMap to record
each reconciler’s execution count after the initial resources are created, then
create or update the watched ConfigMap and await assertions that both
SharedInformerReconciler1 and SharedInformerReconciler2 execution counts
increase. Keep the existing readiness checks and use the ConfigMap fixture/API
already established by the test.
In
`@operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/basic/NonSharingInformerPoolSharedInformerIT.java`:
- Around line 23-26: Remove the redundant comments: delete the class Javadoc and
inline count comment in
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/basic/NonSharingInformerPoolSharedInformerIT.java
lines 23-26; delete the class Javadoc and default-pool inline comment in
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/basic/SharedInformerIT.java
lines 22-25; delete the class Javadoc in
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/dynamic/DynamicSharedInformerIT.java
lines 22-25; and delete the redundant Javadoc in
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/dynamic/DynamicSharedInformerPrimaryCustomResource2.java
line 24. Do not add replacement comments.
In `@README.md`:
- Line 69: Update the project descriptions in README.md: add “is an” to the
Apache Spark Kubernetes Operator entry, remove the conflicting “While ... but”
construction in the entries around lines 75–76, change the line 80 wording to
“not yet released as open source,” and hyphenate “cloud-native” on line 81.
In `@sample-operators/kotlin-operator/k8s/operator.yaml`:
- Around line 53-71: Update the ClusterRole rules in operator.yaml: remove the
customresourcedefinitions rule, limit configmapcopies to informer read verbs
plus status patching, and replace the configmaps wildcard with only the verbs
required for server-side apply.
- Around line 27-32: Update the operator Pod specification around the
serviceAccountName and operator container to define explicit Pod and container
security contexts: enforce non-root execution, set the RuntimeDefault seccomp
profile, drop all capabilities, disable privilege escalation, and use a
read-only root filesystem. If the JVM requires writable temporary storage, add
an emptyDir volume mounted only at the required temporary path.
- Around line 39-41: Update the ServiceAccount subject in the subjects
configuration to include its namespace, using the namespace where the
kotlin-operator ServiceAccount and Pod are created.
---
Outside diff comments:
In
`@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java`:
- Around line 111-136: Update InformerManager.changeNamespaces and stop to use
one shared lifecycle lock and stopped state. Under that lock, serialize source
lookup, acquisition, insertion, removal, and shutdown so additions cannot start
after stop and concurrent namespace changes cannot acquire duplicate sources;
ensure additions are rejected or released once stopped. Add a race test covering
stop() concurrent with adding a namespace.
---
Nitpick comments:
In
`@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/FieldSelector.java`:
- Around line 42-58: Update both FieldSelector constructors to defensively copy
their inputs: use an immutable list copy for the List<Field> constructor and an
immutable varargs list for the Field... constructor. Ensure the stored fields
cannot be mutated after construction, keeping equals, hashCode, and toString
unchanged.
In
`@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java`:
- Line 79: Track the planned deprecation of the public interface method
getGroupVersionKind() by creating an issue or equivalent project-tracking item,
and retain the existing TODO marker until that work is formally tracked.
In
`@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSource.java`:
- Around line 176-186: Update the RuntimeException catch in
ManagedInformerEventSource startup so manager().stop() cleanup failures are
added as suppressed exceptions to the original startup exception, then rethrow
the original exception. Preserve cleanup execution and the existing startup
behavior.
In
`@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/pool/NonSharingInformerPool.java`:
- Around line 57-67: Synchronize NonSharingInformerPool.releaseInformer on the
same instance monitor used by getInformer, covering the informer removal, stop,
logging, and return flow. Match DefaultInformerPool’s locking contract so
release cannot race with acquisition for the same key.
In
`@operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusIT.java`:
- Around line 76-84: Remove the assertion-restating comments in
ExternalStateInStatusIT.java (lines 76-84) and
ExternalStateInStatusWorkflowIT.java (lines 83-93), specifically those preceding
the resource-size and status-ID assertions. Leave the assertions and test
behavior unchanged.
In
`@operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusStatus.java`:
- Line 18: Remove the unnecessary Javadoc above ExternalStateInStatusStatus in
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusStatus.java:18-18
and
operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/externalstateinstatus/ExternalStateInStatusStatus.java:18-18;
leave the simple status model declarations unchanged.
In
`@operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/deregister/DeregisterPrimaryCustomResource.java`:
- Line 24: Remove the redundant Javadocs from the simple test types and variants
in
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/deregister/DeregisterPrimaryCustomResource.java:24,
DeregisterSharedInformerIT.java:22, DeregisterWatchedCustomResource.java:24-27,
NonSharingInformerPoolDeregisterSharedInformerIT.java:23-27, and
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/dynamic/DynamicSharedInformerPrimaryCustomResource1.java:24
and NonSharingInformerPoolDynamicSharedInformerIT.java:23-28; leave the type and
test implementations unchanged and do not add replacement comments.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0eebf96a-6321-4144-877c-743406646182
📥 CommitsReviewing files that changed from the base of the PR and between eb978f9 and 592bad3.
📒 Files selected for processing (111)
Sorry, something went wrong.
| /** | ||
| * The informer pool used to create and (when using the default, sharing pool) share the informers | ||
| * backing the event sources of all controllers managed by this {@code ConfigurationService}. | ||
| * | ||
| * <p><strong>Implementations must return the same instance on every call.</strong> The pool is | ||
| * effectively a per-{@code ConfigurationService} singleton: controllers share informers only if | ||
| * they resolve the same pool, and reference counting / informer shutdown are only correct if | ||
| * {@code getInformer} and {@code releaseInformer} operate on that same instance. This is | ||
| * intentionally not a {@code default} method, since a {@code default} could not cache the result | ||
| * and would hand out a fresh (unshared) pool on each call; {@link AbstractConfigurationService} | ||
| * provides a cached implementation backed by the default sharing pool. | ||
| * | ||
| * @return the informer pool for this configuration service | ||
| */ | ||
| @Experimental( | ||
| "Only the configuration API around informer pooling could still change in a" | ||
| + " non-backwards-compatible way, the pooling itself is prod ready.") | ||
| default InformerPool informerPool() { | ||
| var pool = new DefaultInformerPool(); | ||
| pool.setConfigurationService(this); | ||
| return pool; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Make informerPool() an abstract method.
Line 487 requires the same pool instance on every call. Lines 500-503 create a new pool on every call.
A custom ConfigurationService that relies on this default method will not share informers. Its releases will target different pools.
Keep the cached implementation in AbstractConfigurationService, but remove this default implementation.
Proposed fix- default InformerPool informerPool() {
- var pool = new DefaultInformerPool();
- pool.setConfigurationService(this);
- return pool;
- }
+ InformerPool informerPool();‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * The informer pool used to create and (when using the default, sharing pool) share the informers | |
| * backing the event sources of all controllers managed by this {@code ConfigurationService}. | |
| * | |
| * <p><strong>Implementations must return the same instance on every call.</strong> The pool is | |
| * effectively a per-{@code ConfigurationService} singleton: controllers share informers only if | |
| * they resolve the same pool, and reference counting / informer shutdown are only correct if | |
| * {@code getInformer} and {@code releaseInformer} operate on that same instance. This is | |
| * intentionally not a {@code default} method, since a {@code default} could not cache the result | |
| * and would hand out a fresh (unshared) pool on each call; {@link AbstractConfigurationService} | |
| * provides a cached implementation backed by the default sharing pool. | |
| * | |
| * @return the informer pool for this configuration service | |
| */ | |
| @Experimental( | |
| "Only the configuration API around informer pooling could still change in a" | |
| + " non-backwards-compatible way, the pooling itself is prod ready.") | |
| default InformerPool informerPool() { | |
| var pool = new DefaultInformerPool(); | |
| pool.setConfigurationService(this); | |
| return pool; | |
| /** | |
| * The informer pool used to create and (when using the default, sharing pool) share the informers | |
| * backing the event sources of all controllers managed by this {`@code` ConfigurationService}. | |
| * | |
| * <p><strong>Implementations must return the same instance on every call.</strong> The pool is | |
| * effectively a per-{`@code` ConfigurationService} singleton: controllers share informers only if | |
| * they resolve the same pool, and reference counting / informer shutdown are only correct if | |
| * {`@code` getInformer} and {`@code` releaseInformer} operate on that same instance. This is | |
| * intentionally not a {`@code` default} method, since a {`@code` default} could not cache the result | |
| * and would hand out a fresh (unshared) pool on each call; {`@link` AbstractConfigurationService} | |
| * provides a cached implementation backed by the default sharing pool. | |
| * | |
| * `@return` the informer pool for this configuration service | |
| */ | |
| `@Experimental`( | |
| "Only the configuration API around informer pooling could still change in a" | |
| " non-backwards-compatible way, the pooling itself is prod ready.") | |
| InformerPool informerPool(); |
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java` around lines 483 - 503, Change ConfigurationService.informerPool() from a default method to an abstract method by removing its DefaultInformerPool construction and configuration logic. Keep the existing cached implementation in AbstractConfigurationService unchanged so every configuration service returns the same pool instance.
Sorry, something went wrong.
| /** | ||
| * @deprecated use {@link InformerEventSource(InformerEventSourceConfiguration)} | ||
| */ | ||
| // todo migrate sample, separate PR? | ||
| @Deprecated(forRemoval = true) | ||
| public InformerEventSource( | ||
| InformerEventSourceConfiguration<R> configuration, EventSourceContext<P> context) { | ||
| this(configuration, configuration.getKubernetesClient().orElse(context.getClient())); | ||
| this(configuration); | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain🏁 Script executed:
#!/bin/bash
# Check how the client is resolved now that EventSourceContext is dropped.
fd -t f 'InformerManager.java' -p 'operator-framework-core' | while IFS= read -r f; do
echo "== $f"; rg -n -C4 'getTargetClient|KubernetesClient|getKubernetesClient' "$f"
done
# Any remaining callers passing a context to the deprecated constructor
rg -nP --type=java 'new InformerEventSource<[^>]*>\(' -A3Repository: operator-framework/java-operator-sdk
Length of output: 2541
🏁 Script executed:
#!/bin/bash
set -e
echo '== InformerEventSource.java =='
sed -n '1,150p' operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java
echo '== InformerManager.java client resolution =='
sed -n '55,205p' operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java
echo '== InformerEventSourceConfiguration.java =='
fd -t f 'InformerEventSourceConfiguration.java' . | while IFS= read -r f; do
echo "== $f"
sed -n '1,220p' "$f"
done
echo '== Constructor declarations and usages =='
rg -n -C3 --type=java \
'InformerEventSource\s*\(|new\s+InformerEventSource|InformerEventSourceConfiguration' \
operator-framework-core operator-framework-core/src/test 2>/dev/null || true
echo '== ConfigurationService implementations =='
rg -n -C4 --type=java \
'interface ConfigurationService|class .*ConfigurationService|getKubernetesClient\s*\(' \
. | head -n 300Repository: operator-framework/java-operator-sdk
Length of output: 50393
🏁 Script executed:
#!/bin/bash
set -e
echo '== EventSourceContext and client access =='
rg -n -C5 --type=java \
'interface EventSourceContext|class .*EventSourceContext|getKubernetesClient\s*\(' \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing
echo '== KubernetesDependentResource event-source construction =='
sed -n '195,240p' \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/KubernetesDependentResource.java
echo '== Informer parent setup =='
rg -n -C6 --type=java \
'new InformerManager|setControllerConfiguration|InformerManager<' \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer
echo '== ConfigurationService client contract =='
rg -n -C8 --type=java \
'getKubernetesClient\s*\(' \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config
echo '== Focused constructor call sites =='
rg -n -C3 --type=java \
'new InformerEventSource' \
operator-framework-core/src/main operator-framework-core/src/test
echo '== Available Javadoc tool =='
command -v javadoc || true
javadoc -version 2>&1 || trueRepository: operator-framework/java-operator-sdk
Length of output: 50392
🏁 Script executed:
#!/bin/bash
set -e
echo '== EventSourceContext client implementation =='
sed -n '25,90p' \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/EventSourceContext.java
echo '== Informer configuration builder client propagation =='
sed -n '270,355p' \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java
echo '== Current and parent constructor implementations =='
git show HEAD:operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java \
| sed -n '45,75p'
echo '== Parent revision =='
git show HEAD^:operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java \
| sed -n '45,85p'
echo '== Current and parent InformerManager client resolution =='
git show HEAD:operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java \
| sed -n '168,195p'
echo '== Parent revision =='
git show HEAD^:operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java \
| sed -n '160,190p'
echo '== Javadoc tool =='
command -v javadoc || true
javadoc --version 2>&1 || trueRepository: operator-framework/java-operator-sdk
Length of output: 11605
🌐 Web query:
Java Javadoc @link constructor reference syntax # ClassName(Type)
💡 Result:
In Java Javadoc, a constructor is referenced by using the name of its class followed by its parameter types in parentheses [1][2]. The syntax for the {@link} tag to reference a constructor is: {@link ClassName#ClassName(Type1, Type2,...)} Key details regarding this syntax include: Identification: A constructor is identified by the name of its class [1][2]. Unlike methods, which use the method name, you must repeat the class name to identify the constructor [1][3]. Parameter Types: The list of parameter types must be enclosed in parentheses [1][2]. For example, a constructor in class Foo that takes a String would be referenced as {@link Foo#Foo(String)} [3]. Omitting Parameters: If the constructor is not overloaded and the name does not conflict with a field or enum member, the parameter types and parentheses may be omitted [1][2]. References within the same class: When referencing a constructor within the same class as the documentation comment, the class name prefix (everything up to and including the #) can be omitted [1][2]. However, retaining the '#' is often done for clarity (e.g., {@link #ClassName(Type)}) [1][2]. Whitespace: Within the parameter list of the constructor, whitespace is permitted between tokens, but it is not allowed elsewhere in the reference [1][2]. If you are referencing a constructor in a different package, you must include the fully qualified name of the class (e.g., {@link com.example.MyClass#MyClass(String)}) to ensure the Javadoc tool can locate the element [3].
Citations:
🏁 Script executed:
#!/bin/bash
set -e
echo '== EventSourceContext construction and client identity =='
rg -n -C8 --type=java \
'new\s+EventSourceContext\s*\(' \
operator-framework-core/src/main operator-framework-core/src/test
echo '== EventSourceContext client flow =='
rg -n -C6 --type=java \
'EventSourceContext<|EventSourceContext\s*\(' \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator
echo '== Repository change state =='
git status --short
git diff --stat
git log --oneline -3Repository: operator-framework/java-operator-sdk
Length of output: 232
🏁 Script executed:
#!/bin/bash
echo '== EventSourceContext construction and client identity =='
rg -n -C8 --type=java 'new\s+EventSourceContext\s*\(' . || true
rg -n -C6 --type=java 'EventSourceContext<' . | head -n 240 || true
echo '== Repository change state =='
git status --short
git diff --stat
git log --oneline -3Repository: operator-framework/java-operator-sdk
Length of output: 37740
🏁 Script executed:
#!/bin/bash
set -e
echo '== Controller event-source context client =='
rg -n -C10 --type=java \
'eventSourceContext\s*\(|getClient\s*\(\)' \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/Controller.java \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing \
| head -n 220Repository: operator-framework/java-operator-sdk
Length of output: 31432
🏁 Script executed:
#!/bin/bash
set -e
sed -n '70,145p' \
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/Controller.javaRepository: operator-framework/java-operator-sdk
Length of output: 3769
🏁 Script executed:
#!/bin/bash
set -e
rg -n -C8 --type=java \
'new\s+Controller\s*<|new\s+Controller\s*\(' \
operator-framework-core/src/main/java \
operator-framework-core/src/test/javaRepository: operator-framework/java-operator-sdk
Length of output: 33468
Fix the constructor Javadoc and preserve the context client. Use {@link #InformerEventSource(InformerEventSourceConfiguration)}. The deprecated constructor discards context.getClient(), while InformerManager falls back to ConfigurationService.getKubernetesClient() when no client is configured. These clients are not guaranteed to be identical. Propagate context.getClient() or retain the context-based path for deprecated callers.
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java`
around lines 55 - 63, Update the deprecated InformerEventSource constructor
Javadoc to link with {`@link`
`#InformerEventSource`(InformerEventSourceConfiguration)}. In the constructor path
identified by InformerEventSource and InformerManager, preserve and propagate
context.getClient() instead of discarding the EventSourceContext, ensuring
deprecated callers use their configured client rather than the
ConfigurationService fallback.
Sorry, something went wrong.
| // an unspecified plural is not a wildcard: it carries no plural form, just like the plain | ||
| // GroupVersionKind it compares equal to |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Remove the explanatory comment.
The test name and assertions define this short behavior. Keep the requirement in the test name if more detail is necessary.
Proposed change- // an unspecified plural is not a wildcard: it carries no plural form, just like the plain
- // GroupVersionKind it compares equal toAs per coding guidelines, “Do not add comments except for very long or complex logic.”
📝 Committable suggestion‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // an unspecified plural is not a wildcard: it carries no plural form, just like the plain | |
| // GroupVersionKind it compares equal to |
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/GroupVersionKindTest.java` around lines 105 - 106, Remove the explanatory comment near the GroupVersionKind equality test, leaving the test name and assertions unchanged.
Source: Coding guidelines
Sorry, something went wrong.
| @Test | ||
| void bothControllersReconcileWatchingConfigMap() { | ||
| extension.create(customResource1(TEST_RESOURCE_1)); | ||
| extension.create(customResource2(TEST_RESOURCE_2)); | ||
|
|
||
| // both controllers reconcile, which guarantees their event sources (and thus their informers) | ||
| // have been started | ||
| await() | ||
| .untilAsserted( | ||
| () -> { | ||
| assertThat( | ||
| extension | ||
| .getReconcilerOfType(SharedInformerReconciler1.class) | ||
| .getNumberOfExecutions()) | ||
| .isPositive(); | ||
| assertThat( | ||
| extension | ||
| .getReconcilerOfType(SharedInformerReconciler2.class) | ||
| .getNumberOfExecutions()) | ||
| .isPositive(); | ||
| }); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Exercise the secondary-resource event path.
Lines 65-66 create only primary resources. Those creations make both reconcilers run even if the pooled ConfigMap informer does not dispatch an event to one controller.
Create or update a ConfigMap after recording both reconciliation counts. Then assert that both counts increase. This validates listener registration and shared event dispatch.
As per coding guidelines, add unit and/or integration tests for new functionality whenever reasonably possible.
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/basic/AbstractSharedInformerIT.java` around lines 63 - 83, Update bothControllersReconcileWatchingConfigMap to record each reconciler’s execution count after the initial resources are created, then create or update the watched ConfigMap and await assertions that both SharedInformerReconciler1 and SharedInformerReconciler2 execution counts increase. Keep the existing readiness checks and use the ConfigMap fixture/API already established by the test.
Source: Coding guidelines
Sorry, something went wrong.
| /** | ||
| * Runs {@link AbstractSharedInformerIT} with the {@link NonSharingInformerPool}: informers are | ||
| * never shared, so each of the two controllers watching {@code ConfigMap} gets its own informer. | ||
| */ |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Remove comments that restate direct code behavior.
The added comments repeat class names, selected pool behavior, or method results. Keep comments only where they explain complex logic.
As per coding guidelines, do not add comments except for very long or complex logic.
📍 Affects 4 filesVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/basic/NonSharingInformerPoolSharedInformerIT.java` around lines 23 - 26, Remove the redundant comments: delete the class Javadoc and inline count comment in operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/basic/NonSharingInformerPoolSharedInformerIT.java lines 23-26; delete the class Javadoc and default-pool inline comment in operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/basic/SharedInformerIT.java lines 22-25; delete the class Javadoc in operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/dynamic/DynamicSharedInformerIT.java lines 22-25; and delete the redundant Javadoc in operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/informerpool/dynamic/DynamicSharedInformerPrimaryCustomResource2.java line 24. Do not add replacement comments.
Source: Coding guidelines
Sorry, something went wrong.
| Keycloak operator, built with Quarkus and JOSDK. | ||
| - [Apache Flink Kubernetes operator](https://github.com/apache/flink-kubernetes-operator) is the market leader among Flink operators. | ||
| - [Apache Flink Kubernetes Operator](https://github.com/apache/flink-kubernetes-operator) is the market leader among Flink operators. | ||
| - [Apache Spark Kubernetes Operator](https://github.com/apache/spark-kubernetes-operator) emerging operator for Spark. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the grammar in the project descriptions.
-- [Apache Spark Kubernetes Operator](https://github.com/apache/spark-kubernetes-operator) emerging operator for Spark.
+- [Apache Spark Kubernetes Operator](https://github.com/apache/spark-kubernetes-operator) is an emerging operator for Spark.
-- [Strimzi Access operator](https://github.com/strimzi/kafka-access-operator). While the core Strimzi operator development predates
- JOSDK, but new components like the Access operator is using the framework.
+- [Strimzi Access operator](https://github.com/strimzi/kafka-access-operator). The core Strimzi operator predates
+ JOSDK, but new components like the Access operator use the framework.
-- ... It is not released as an open source yet but ...
+- ... It is not yet released as open source, but ...
-- ... Cloud native solution ...
+- ... Cloud-native solution ...Also applies to: 75-76, 80-81
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` at line 69, Update the project descriptions in README.md: add “is an” to the Apache Spark Kubernetes Operator entry, remove the conflicting “While ... but” construction in the entries around lines 75–76, change the line 80 wording to “not yet released as open source,” and hyphenate “cloud-native” on line 81.
Source: Linters/SAST tools
Sorry, something went wrong.
| spec: | ||
| serviceAccountName: kotlin-operator | ||
| containers: | ||
| - name: operator | ||
| image: kotlin-sample-operator | ||
| imagePullPolicy: Never |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Set an explicit Pod and container security context.
The Pod runs without runAsNonRoot, seccompProfile, capability drops, allowPrivilegeEscalation: false, or a read-only root filesystem. Set these controls explicitly. If the JVM needs writable temporary storage, mount an emptyDir only at that path.
🧰 Tools 🪛 Trivy (0.72.0)[error] 29-31: Root file system is not read-only
Container 'operator' of Pod 'kotlin-operator' should set 'securityContext.readOnlyRootFilesystem' to true
Rule: KSV-0014
(IaC/Kubernetes)
[error] 29-31: Default security context configured
container kotlin-operator in default namespace is using the default security context
Rule: KSV-0118
(IaC/Kubernetes)
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sample-operators/kotlin-operator/k8s/operator.yaml` around lines 27 - 32, Update the operator Pod specification around the serviceAccountName and operator container to define explicit Pod and container security contexts: enforce non-root execution, set the RuntimeDefault seccomp profile, drop all capabilities, disable privilege escalation, and use a read-only root filesystem. If the JVM requires writable temporary storage, add an emptyDir volume mounted only at the required temporary path.
Source: Linters/SAST tools
Sorry, something went wrong.
| subjects: | ||
| - kind: ServiceAccount | ||
| name: kotlin-operator |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain🏁 Script executed:
#!/bin/sh
set -eu
file='sample-operators/kotlin-operator/k8s/operator.yaml'
printf '%s\n' '--- manifest excerpt ---'
nl -ba "$file" | sed -n '1,90p'
printf '%s\n' '--- namespace and ServiceAccount references ---'
rg -n -C 3 'namespace:|kind: ServiceAccount|serviceAccount(Name)?:|ClusterRoleBinding|subjects:' "$file"Repository: operator-framework/java-operator-sdk
Length of output: 782
🏁 Script executed:
#!/bin/sh
set -eu
file='sample-operators/kotlin-operator/k8s/operator.yaml'
printf '%s\n' '--- complete manifest ---'
cat "$file"
printf '%s\n' '--- references to this sample namespace and ServiceAccount ---'
rg -n -C 3 'kotlin-operator|kotlin-sample-operator|operator.yaml' \
sample-operators/kotlin-operator README.md sample-operators 2>/dev/null | head -200Repository: operator-framework/java-operator-sdk
Length of output: 20420
🏁 Script executed:
#!/bin/sh
set -eu
file='sample-operators/kotlin-operator/src/test/kotlin/io/javaoperatorsdk/operator/sample/ConfigMapCopyE2E.kt'
printf '%s\n' '--- Kotlin E2E deployment setup ---'
sed -n '35,85p' "$file"
printf '%s\n' '--- namespace mutation and deployment helpers ---'
rg -n -C 4 'setNamespace|namespace|withOperatorDeployment|ClusterDeployedOperatorExtension' \
sample-operators/kotlin-operator/src/test \
operator-framework 2>/dev/null | head -240Repository: operator-framework/java-operator-sdk
Length of output: 38081
🌐 Web query:
Kubernetes RBAC ClusterRoleBinding ServiceAccount subject namespace required validation
💡 Result:
In Kubernetes, the namespace field for a ServiceAccount subject in a ClusterRoleBinding is mandatory [1][2][3]. Because ServiceAccounts are namespaced resources, the ClusterRoleBinding must explicitly specify which namespace the ServiceAccount belongs to [1][2]. If you omit the namespace field when defining a ServiceAccount subject in a ClusterRoleBinding, the Kubernetes API server will reject the object with an error message similar to: subjects.namespace: Required value [1][2][3]. Key points to understand: - Scoping: ServiceAccounts are specific to a namespace [2]. The namespace field in the subject indicates where that ServiceAccount exists, not which namespaces the binding covers [2]. - No Cross-Namespace Matching: Kubernetes does not support granting permissions to a ServiceAccount with a specific name across all namespaces automatically [4]. If you need to grant permissions to a ServiceAccount in every namespace, you should instead bind the ClusterRole to the group system:serviceaccounts (which includes all service accounts in the cluster) or a namespace-specific group like system:serviceaccounts:<namespace> [5][4]. - API Validation: While some internal controllers might have historically behaved differently, the API server strictly enforces that the namespace field is present for ServiceAccount subjects within both RoleBindings and ClusterRoleBindings [6][7][3]. Attempting to submit a configuration without it will result in a validation failure [1][3].
Citations:
Specify the ServiceAccount namespace.
The Kubernetes API server requires subjects[].namespace for a ServiceAccount subject. Set it to the namespace where the kotlin-operator ServiceAccount and Pod are created.
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sample-operators/kotlin-operator/k8s/operator.yaml` around lines 39 - 41, Update the ServiceAccount subject in the subjects configuration to include its namespace, using the namespace where the kotlin-operator ServiceAccount and Pod are created.
Sorry, something went wrong.
| - apiGroups: | ||
| - "apiextensions.k8s.io" | ||
| resources: | ||
| - customresourcedefinitions | ||
| verbs: | ||
| - '*' | ||
| - apiGroups: | ||
| - "sample.javaoperatorsdk" | ||
| resources: | ||
| - configmapcopies | ||
| - configmapcopies/status | ||
| verbs: | ||
| - '*' | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - configmaps | ||
| verbs: | ||
| - '*' |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Replace wildcard ClusterRole permissions with required verbs.
Remove the customresourcedefinitions rule. Restrict configmapcopies to informer read verbs and status patching. Restrict configmaps to the verbs required for server-side apply. Once the binding is corrected, the current role allows the operator identity to modify or delete arbitrary CRDs, ConfigMaps, and ConfigMapCopy resources across the cluster.
🧰 Tools 🪛 Checkov (3.3.9)[medium] 48-71: Minimize wildcard use in Roles and ClusterRoles
(CKV_K8S_49)
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sample-operators/kotlin-operator/k8s/operator.yaml` around lines 53 - 71, Update the ClusterRole rules in operator.yaml: remove the customresourcedefinitions rule, limit configmapcopies to informer read verbs plus status patching, and replace the configmaps wildcard with only the verbs required for server-side apply.
Source: Linters/SAST tools
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agentsVerify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java`:
- Line 491: Wrap the Javadoc sentence near ConfigurationService so the line
stays within 100 characters, moving the {`@link` AbstractConfigurationService}
reference to the following Javadoc line without changing the text or meaning.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2e9863ae-539b-4cd5-8514-627b967d93ad
📥 CommitsReviewing files that changed from the base of the PR and between eb978f9 and 592bad3.
📒 Files selected for processing (111)
Sorry, something went wrong.
| * effectively a per-{@code ConfigurationService} singleton: controllers share informers only if | ||
| * they resolve the same pool, and reference counting / informer shutdown are only correct if | ||
| * {@code getInformer} and {@code releaseInformer} operate on that same instance. This is | ||
| * intentionally not a {@code default} method, since a {@code default} could not cache the result |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Wrap the Javadoc line to stay within 100 characters.
Line 491 exceeds the Java line-length limit. Move the {@link AbstractConfigurationService} reference to the next Javadoc line.
As per coding guidelines: “Limit Java source lines to 100 characters.”
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java`
at line 491, Wrap the Javadoc sentence near ConfigurationService so the line
stays within 100 characters, moving the {`@link` AbstractConfigurationService}
reference to the following Javadoc line without changing the text or meaning.
Source: Coding guidelines
Sorry, something went wrong.
Add an opt-in, experimental detectApiVersionChange option on @KubernetesDependent that records the API version the operator applies in the javaoperatorsdk.io/last-applied-api-version annotation. The regular matcher then detects a mismatch when that marker differs from (or is missing relative to) the currently applied API version, causing a one-time update without triggering repeated reconciliations once the resource is up-to-date. Disabled by default, so existing behavior and matching are unaffected unless explicitly enabled. Guard against a null or immutable annotations map (e.g. Map.of(...)) on the desired resource when detectApiVersionChange is enabled, since writing the last-applied-api-version marker (and the pre-existing previous-annotation bookkeeping that runs alongside it) requires a mutable map. Also rename a misleadingly-named test helper and replace a no-op assertion on a primitive boolean with a concrete expectation. Addresses Copilot review feedback on PR #3536. Add DetectApiVersionChangeIT covering the end-to-end scenario: a ConfigMap dependent resource configured with detectApiVersionChange is marked with the current API version on creation (without triggering an update), and a stale marker annotation left on the actual resource (simulating an older operator/CRD version) is detected and corrected with exactly one update, after which no further reconciliation loop occurs. Signed-off-by: hej090224 <fc49854985@gmail.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
InformerManager is generic over C extends Informable, but getTargetClient type-tested for InformerEventSourceConfiguration to find out whether a specific (e.g. remote cluster) client was configured. Informable has two implementors and only one could answer the question, so a third configuration type wanting its own client would be ignored silently rather than failing to compile. Move the default getKubernetesClient() up from InformerEventSourceConfiguration to Informable and let InformerManager ask the configuration directly. The default still returns Optional.empty(), so existing implementations are unaffected. As a side effect the ConfigurationService client is now only created when no specific client is configured, instead of being created and then discarded.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/detectapiversionchange/ConfigMapDependentResource.java (1)🤖 Prompt for all review comments with AI agents39-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Use var for these non-short local declarations.
- operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/detectapiversionchange/ConfigMapDependentResource.java#L39-L46: Change ConfigMap configMap to var configMap.
- operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/KubernetesDependentConverterTest.java#L86-L93: Change the ControllerConfiguration and ConfigurationService locals to var.
- operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/KubernetesDependentResourceApiVersionChangeTest.java#L287-L298: Change the Context and ControllerConfiguration locals to var.
As per coding guidelines, “Prefer var over explicit type declarations except for short types such as int, long, and String.”
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/detectapiversionchange/ConfigMapDependentResource.java` around lines 39 - 46, Replace the non-short explicit local type declarations with var at all affected sites: ConfigMapDependentResource.java lines 39-46 for configMap, KubernetesDependentConverterTest.java lines 86-93 for the ControllerConfiguration and ConfigurationService locals, and KubernetesDependentResourceApiVersionChangeTest.java lines 287-298 for the Context and ControllerConfiguration locals. Leave short types such as String unchanged.Source: Coding guidelines
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/detectapiversionchange/DetectApiVersionChangeReconciler.java`: - Around line 20-21: Replace the wildcard import from io.javaoperatorsdk.operator.api.reconciler in DetectApiVersionChangeReconciler with explicit named imports for each reconciler API class referenced in the file, while retaining simple class names and the existing Dependent import. --- Nitpick comments: In `@operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/detectapiversionchange/ConfigMapDependentResource.java`: - Around line 39-46: Replace the non-short explicit local type declarations with var at all affected sites: ConfigMapDependentResource.java lines 39-46 for configMap, KubernetesDependentConverterTest.java lines 86-93 for the ControllerConfiguration and ConfigurationService locals, and KubernetesDependentResourceApiVersionChangeTest.java lines 287-298 for the Context and ControllerConfiguration locals. Leave short types such as String unchanged.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 26077978-c224-4816-b647-d1c91970527e
📥 CommitsReviewing files that changed from the base of the PR and between 592bad3 and d4bd3da.
📒 Files selected for processing (12)
Sorry, something went wrong.
| import io.javaoperatorsdk.operator.api.reconciler.*; | ||
| import io.javaoperatorsdk.operator.api.reconciler.dependent.Dependent; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Replace the wildcard import with named imports.
Import each reconciler API class used by this file. This keeps dependencies explicit.
As per coding guidelines, “Import classes at the top of the file and use simple class names; use fully qualified names only when necessary to avoid naming collisions.”
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/detectapiversionchange/DetectApiVersionChangeReconciler.java` around lines 20 - 21, Replace the wildcard import from io.javaoperatorsdk.operator.api.reconciler in DetectApiVersionChangeReconciler with explicit named imports for each reconciler API class referenced in the file, while retaining simple class names and the existing Dependent import.
Source: Coding guidelines
Sorry, something went wrong.
There was a problem hiding this comment.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/Informable.java (2)🤖 Prompt for all review comments with AI agents36-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Confirm that the new Javadoc is allowed.
Lines 36-39 add comments to a short method. This conflicts with the rule that comments should only describe very long or complex logic. Remove the block unless public API Javadocs are explicitly exempted.
As per coding guidelines, **/*.java: Do not add comments except for very long or complex logic.
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/Informable.java` around lines 36 - 39, Remove the newly added Javadoc block associated with the Informable method, since it documents a short method and violates the Java comment guideline; leave the method and surrounding API unchanged.Source: Coding guidelines
40-42: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Add coverage for both Kubernetes client selection paths.
Test the default Optional.empty() behavior and a custom Optional<KubernetesClient>. Assert that InformerManager selects the custom client and otherwise uses the controller configuration client.
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/Informable.java` around lines 40 - 42, Add tests covering Informable.getKubernetesClient() returning Optional.empty() and a custom Optional<KubernetesClient>. Verify that InformerManager uses the custom client when provided and falls back to the controller configuration client when absent.Source: Coding guidelines
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Nitpick comments: In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/Informable.java`: - Around line 36-39: Remove the newly added Javadoc block associated with the Informable method, since it documents a short method and violates the Java comment guideline; leave the method and surrounding API unchanged. - Around line 40-42: Add tests covering Informable.getKubernetesClient() returning Optional.empty() and a custom Optional<KubernetesClient>. Verify that InformerManager uses the custom client when provided and falls back to the controller configuration client when absent.
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 34b82110-8f2e-494c-9025-e89921bfc387
📥 CommitsReviewing files that changed from the base of the PR and between d4bd3da and b5022e2.
📒 Files selected for processing (3)
Sorry, something went wrong.
- GenericKubernetesResourceMatcher allocated the path-prefix lists (List.of(SPEC), List.of(METADATA), the labels/annotations pair, List.of(STATUS)) once per JSON-diff node while matching, and nodeIsChildOf built a stream per call. Both run for every node of every match, so hoist the lists to constants and use an indexed loop. - SSABasedGenericKubernetesResourceMatcher#sanitizeState nested the StatefulSet volume-claim-template handling four levels deep inside the type ladder; extract it into sanitizeVolumeClaimTemplates so the ladder reads as one dispatch per resource kind.
There was a problem hiding this comment.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/SSABasedGenericKubernetesResourceMatcher.java (1)🤖 Prompt for all review comments with AI agents226-248: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Add regression tests for both sanitization branches.
The helper now exits when actual and desired volumeClaimTemplates counts differ. Add or verify tests for:
- Equal counts with omitted volumeMode and status.
- Different counts with no sanitization and a non-match result.
Verify the adjacent SSABasedGenericKubernetesResourceMatcherTest coverage:
#!/bin/bash set -euo pipefail test_file="operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/SSABasedGenericKubernetesResourceMatcherTest.java" rg -n -C 4 'volumeClaimTemplates|volumeMode|status' "$test_file"As per coding guidelines, **/*.{java,xml} files require unit and/or integration tests for new functionality whenever reasonably possible.
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/SSABasedGenericKubernetesResourceMatcher.java` around lines 226 - 248, Add regression coverage in SSABasedGenericKubernetesResourceMatcherTest for equal-sized volumeClaimTemplates where omitted volumeMode and status are sanitized, and for differing sizes where sanitization is skipped and matching returns false. Reuse the existing matcher test setup and assert both branches through the public matching behavior.
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Nitpick comments: In `@operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/SSABasedGenericKubernetesResourceMatcher.java`: - Around line 226-248: Add regression coverage in SSABasedGenericKubernetesResourceMatcherTest for equal-sized volumeClaimTemplates where omitted volumeMode and status are sanitized, and for differing sizes where sanitization is skipped and matching returns false. Reuse the existing matcher test setup and assert both branches through the public matching behavior.
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a0f9eb21-dc75-4b5c-8555-9cb631e63bb6
📥 CommitsReviewing files that changed from the base of the PR and between b5022e2 and 484727d.
📒 Files selected for processing (2)
Sorry, something went wrong.
- addresses deprecations - addresses late PR comments for Informer Pools: #3325 Signed-off-by: Attila Mészáros <a_meszaros@apple.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: Attila Mészáros <a_meszaros@apple.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@docs/content/en/docs/documentation/operations/configuration.md`: - Line 87: Update the documentation example using withNamespacesInheritedFromController() to call the builder method without the obsolete context argument, while preserving the surrounding configuration chain and build() call.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0edfdbb5-0760-43f0-bcca-14fc8185e5f2
📥 CommitsReviewing files that changed from the base of the PR and between 484727d and 51490a2.
📒 Files selected for processing (50)
Sorry, something went wrong.
markEventReceived and unMarkEventReceived took a boolean that only ever selects which IllegalStateException guards apply, and every EventProcessor call site supplied it by re-reading the same controller configuration value. It can never differ between calls for a given processor, but nothing enforced that: a call site passing the wrong value would silently change which state transitions are legal, and the state machine could not be read without also reading its callers. Decide it once at the edge: ResourceStateManager takes the flag at construction (EventProcessor already knows it there) and passes it to each ResourceState, which keeps it as a final field. Both types are package-private, so this is self-contained.
- Mappers#fromMetadata resolved the primary GroupVersionKind on every secondary event, although it only depends on the primary type. Hoist it out of the lambda and compare the encoded string before falling back to parsing the annotation value. - Mappers.SecondaryToPrimaryFromDefaultAnnotation built a whole new mapper on every invocation; hold a single delegate instead. The primaryResourceType field becomes unused and is dropped. - InformerEventSource#start walked the entire informer cache to seed the primary-to-secondary index even when that index is the no-op implementation (i.e. whenever a primaryToSecondaryMapper is configured), which is pure startup latency proportional to the number of cached secondaries. - ExternalResourceCachingEventSource#getSecondaryResources looked the primary up in the cache a second time although the value was already in a local. - PerResourcePollingEventSource#getAndCacheResource derived the same ResourceID twice in adjacent statements.
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
| Back | FazBrowse Home | New Git URL |
Summary by CodeRabbit
New Features
Bug Fixes
Documentation