Skip to content

improve: add sharding sample as integration test#3460

Merged
csviri merged 2 commits into
operator-framework:nextfrom
csviri:shard-sample
Jul 1, 2026
Merged

improve: add sharding sample as integration test#3460
csviri merged 2 commits into
operator-framework:nextfrom
csviri:shard-sample

Conversation

@csviri

@csviri csviri commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Signed-off-by: Attila Mészáros a_meszaros@apple.com

Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Copilot AI review requested due to automatic review settings July 1, 2026 12:30
@openshift-ci openshift-ci Bot requested review from metacosm and xstefank July 1, 2026 12:30

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 sharding-focused sample integration test under operator-framework to demonstrate splitting reconciliation responsibility across multiple operator instances using shard selectors (leveraging Kubernetes’ ShardedListAndWatch feature gate).

Changes:

  • Introduces a new ShardSelectorITS sample test that starts two Operator instances with different shard selectors and asserts a resource is reconciled by exactly one of them.
  • Adds a minimal custom resource type (ShardSelectorTestCustomResource) used by the sample test.
  • Adds a simple reconciler (ShardSelectorTestReconciler) that counts executions to support assertions in the test.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/shardselector/ShardSelectorITS.java New sample test that runs two operators with different shard selectors and verifies exclusive reconciliation.
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/shardselector/ShardSelectorTestCustomResource.java Test custom resource definition used by the sharding sample.
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/shardselector/ShardSelectorTestReconciler.java Test reconciler that increments an execution counter for assertions.

kubeAPIVersion = "1.36.*",
apiServerFlags = {"--feature-gates=ShardedListAndWatch=true"},
updateKubeConfigFile = true)
class ShardSelectorITS {

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.

@csviri is this intentional?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Well was, but changed it, fits better to IT.

kubeAPIVersion = "1.36.*",
apiServerFlags = {"--feature-gates=ShardedListAndWatch=true"},
updateKubeConfigFile = true)
class ShardSelectorITS {

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.

@csviri is this intentional?

Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
@csviri csviri merged commit c209dfd into operator-framework:next Jul 1, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants