test: sample for virtual threads - #3554
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Requires Java 21, therefore the module is only part of the build when the JDK used is at least version 21. Configures both the framework executors (reconciliation and workflow) and the Kubernetes client task executor with a virtual thread per task executor.
e194717 to
a928c52
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new sample operator demonstrating how to run JOSDK reconciliations and Fabric8 client async callbacks on Java virtual threads (Java 21+), along with documentation and CI updates so the sample is built/tested appropriately.
Changes:
- Introduces a new
sample-operators/virtual-threadsMaven module (Java 21+) with a reconciler, CRD types, logging config, and an E2E test. - Adds a JDK-activated Maven profile in
sample-operators/pom.xmlto include the sample only on JDK 21+. - Updates docs and the E2E GitHub Actions workflow to reference and test the new sample.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sample-operators/virtual-threads/src/test/resources/log4j2.xml | Adds test logging configuration for the virtual threads sample. |
| sample-operators/virtual-threads/src/test/java/io/javaoperatorsdk/operator/sample/VirtualThreadsOperatorE2E.java | Adds an E2E test validating parallel reconciliations and virtual-thread execution. |
| sample-operators/virtual-threads/src/main/resources/log4j2.xml | Adds runtime logging configuration for the sample operator. |
| sample-operators/virtual-threads/src/main/java/io/javaoperatorsdk/operator/sample/VirtualThreadsStatus.java | Adds CR status fields used by the sample to report observed value and virtual-thread usage. |
| sample-operators/virtual-threads/src/main/java/io/javaoperatorsdk/operator/sample/VirtualThreadsSpec.java | Adds CR spec schema for the sample. |
| sample-operators/virtual-threads/src/main/java/io/javaoperatorsdk/operator/sample/VirtualThreadsReconciler.java | Implements a reconciler that simulates blocking work and patches status. |
| sample-operators/virtual-threads/src/main/java/io/javaoperatorsdk/operator/sample/VirtualThreadsOperator.java | Adds the sample operator entry point wiring virtual-thread executors and client config. |
| sample-operators/virtual-threads/src/main/java/io/javaoperatorsdk/operator/sample/VirtualThreadsCustomResource.java | Defines the sample CustomResource type and group/version metadata. |
| sample-operators/virtual-threads/src/main/java/io/javaoperatorsdk/operator/sample/VirtualThreads.java | Centralizes virtual-thread configuration for both framework executors and Fabric8 client task executor. |
| sample-operators/virtual-threads/README.md | Documents the sample, Java 21+ requirement, and how to run it. |
| sample-operators/virtual-threads/pom.xml | Introduces the new Java 21+ sample module build and dependencies. |
| sample-operators/virtual-threads/k8s/virtual-threads-custom-resource.yaml | Adds a sample CR manifest for running the operator manually. |
| sample-operators/virtual-threads/k8s/operator.yaml | Adds a deployment + RBAC manifest used by remote E2E mode. |
| sample-operators/pom.xml | Adds a JDK>=21-activated profile to include the new sample module. |
| docs/content/en/docs/getting-started/bootstrap-and-samples.md | Adds the virtual-threads sample to the list of available samples. |
| docs/content/en/docs/documentation/operations/configuration.md | Documents how to run JOSDK on virtual threads (framework + client executor). |
| .github/workflows/e2e-test.yml | Adds the new sample module to the E2E workflow matrix (running on JDK 25). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @Override | ||
| public void onClose(Executor executor) { | ||
| ((ExecutorService) executor).shutdownNow(); | ||
| } | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| can be replaced with virtual threads, so that a reconciliation waiting on a remote call does not | ||
| occupy a platform thread: |
There was a problem hiding this comment.
| can be replaced with virtual threads, so that a reconciliation waiting on a remote call does not | |
| occupy a platform thread: | |
| can be replaced with virtual threads. |
Each virtual thread always runs on platform thread in the background.
Adds sample (serves as a smoke test) for virtual threads setup of JOSDK.
TODO: