Skip to content

CRI List Streaming Operations#2099

Open
bitoku wants to merge 2 commits into
kubernetes-sigs:masterfrom
bitoku:cri-list
Open

CRI List Streaming Operations#2099
bitoku wants to merge 2 commits into
kubernetes-sigs:masterfrom
bitoku:cri-list

Conversation

@bitoku

@bitoku bitoku commented May 26, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds --stream option to crictl, and test cases using CRIListStreaming.
Skips if containerd (PR is not yet merged containerd/containerd#13187)

Which issue(s) this PR fixes:

Special notes for your reviewer:

Assisted-by: Claude

Does this PR introduce a user-facing change?

Support CRI list streaming operations in crictl, and adds related tests in critest.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label May 26, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bitoku
Once this PR has been reviewed and has the lgtm label, please assign mrunalp for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 26, 2026
@bitoku bitoku force-pushed the cri-list branch 2 times, most recently from aa96bf3 to ad01ffb Compare May 26, 2026 12:15
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 29, 2026
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 2, 2026
bitoku added 2 commits June 2, 2026 09:57
Add an enable-streaming config option and --stream CLI flag to crictl.
When enabled, the streaming API is used for runtime and image service
list operations instead of the default unary RPCs.
Adds 17 test cases covering all 6 streaming list APIs:
ListPodSandbox, ListContainers, ListContainerStats,
ListPodSandboxStats, ListPodSandboxMetrics, and ListImages.

Tests are skipped on containerd until it supports the streaming
list APIs.
Comment thread cmd/crictl/config.go
disable-pull-on-run: Disable pulling image on run requests (default: false)
max-retries: Max retries for connecting to an explicitly set endpoint (default: 3, 0 to disable, negative for infinite)`,
max-retries: Max retries for connecting to an explicitly set endpoint (default: 3, 0 to disable, negative for infinite)
enable-streaming: Enable streaming API for list operations (default: false)`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this will be a temporary setting, right? We will switch to streaming everywhere. Do you see this as "try streaming first" setting or like a "force-streaming"?

In general I see no use for this configuration parameter as crictl users should not care


version, err := rc.Version(ctx, "")
Expect(err).NotTo(HaveOccurred())
// TODO: remove once containerd supports streaming list APIs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

let's not skip based on runtime name and will skip based on whether it works or not

)

BeforeEach(func(ctx SpecContext) {
client, err := framework.LoadCRIClientWithStreaming()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

as far as I remember setting streaming to true will still allow to fallback to non-streaming. Is it right? If this is true, is only option for this test is to go to gRPC level?

@SergeyKanzhelev SergeyKanzhelev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

when I am thinking about tests for Streaming, I am thinking of a conformance tests that will exceed the size of a regular List calls. Introducing the conformance test that ensures that a certain number of pods/images/etc. is supported will be a good way to validate that List is working. It may be hard though and requires some experimentation

@bitoku

bitoku commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

@SergeyKanzhelev That makes sense. Thank you for the review.
I'll redesign it to use streaming by default and add a conformance test to verify if it hits grpc size limit.

@saschagrunert saschagrunert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two minor items on top of the existing review feedback.

Comment thread .gitignore
!.github/
!.skills/

crictl

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/crictl at line 37 already ignores the root binary. This entry (without the leading slash) is either redundant or unintentionally broader in scope. Should be dropped.

Comment thread pkg/framework/util.go

// LoadCRIClientWithStreaming creates an InternalAPIClient with streaming
// list operations explicitly enabled, regardless of the --enable-streaming flag.
func LoadCRIClientWithStreaming() (*InternalAPIClient, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a near-exact duplicate of LoadCRIClient() above, differing only in the final boolean argument. Consider extracting a shared helper:

func loadCRIClient(streaming bool) (*InternalAPIClient, error) { ... }
func LoadCRIClient() (*InternalAPIClient, error) { return loadCRIClient(false) }
func LoadCRIClientWithStreaming() (*InternalAPIClient, error) { return loadCRIClient(true) }

If streaming becomes the default per the redesign, this helper may not be needed at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants