Skip to content

test: sample for virtual threads - #3554

Draft
csviri wants to merge 2 commits into
operator-framework:nextfrom
csviri:virtual-threads
Draft

test: sample for virtual threads#3554
csviri wants to merge 2 commits into
operator-framework:nextfrom
csviri:virtual-threads

Conversation

@csviri

@csviri csviri commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Adds sample (serves as a smoke test) for virtual threads setup of JOSDK.

TODO:

  • check logging / thread local handling

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e6fdac0d-13b6-4df3-af4f-3f9ff690efcf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 11, 2026
@csviri
csviri changed the base branch from main to next August 11, 2026 15:49
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.
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 11, 2026
@csviri csviri linked an issue Aug 11, 2026 that may be closed by this pull request
@csviri csviri changed the title Sample for virtual threads improve: sample for virtual threads Aug 11, 2026
@csviri
csviri marked this pull request as ready for review August 12, 2026 06:49
Copilot AI lite review requested due to automatic review settings August 12, 2026 06:49
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 12, 2026
@openshift-ci
openshift-ci Bot requested review from metacosm and xstefank August 12, 2026 06:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-threads Maven module (Java 21+) with a reconciler, CRD types, logging config, and an E2E test.
  • Adds a JDK-activated Maven profile in sample-operators/pom.xml to 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.

Comment thread docs/content/en/docs/getting-started/bootstrap-and-samples.md Outdated
Comment on lines +66 to +70
@Override
public void onClose(Executor executor) {
((ExecutorService) executor).shutdownNow();
}
}
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@csviri
csviri marked this pull request as draft August 12, 2026 08:54
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 12, 2026
Comment on lines +30 to +31
can be replaced with virtual threads, so that a reconciliation waiting on a remote call does not
occupy a platform thread:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

@csviri csviri changed the title improve: sample for virtual threads test: sample for virtual threads Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Virtual Threads

3 participants