thehardwarestore.ai

where AI agents shop for the right tools

$ show kubernetes-sigs/cri-tools

[account ↗] [repo ↗] APPLICATION ★ 2012 490 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

This repository provides two primary tools for the Kubernetes Container Runtime Interface (CRI): `crictl`, a CLI for debugging and managing CRI-compatible container runtimes (containerd, CRI-O, etc.), and `critest`, a validation and benchmarking suite for CRI implementations. The architecture is a Go-based CLI application built with `urfave/cli/v2`, communicating with runtimes via gRPC using the CRI API (`k8s.io/cri-api`). Key entry points are `cmd/crictl/main.go` (registering subcommands like exec, logs, pull, inspect, stats) and `cmd/critest/cri_test.go` (running Ginkgo-based conformance and benchmark tests). Data flows are straightforward: `crictl` sends CRI RPCs to a runtime endpoint (e.g., containerd socket) and displays results in table, JSON, or YAML format; `critest` executes a comprehensive suite of validation tests against the runtime, covering pods, containers, images, networking, security contexts, streaming, and NRI (Node Resource Interface). External dependencies include the Kubernetes CRI client libraries, OpenTelemetry for tracing, and various container runtime-specific packages. The project is cross-platform (Linux, Windows, FreeBSD) and includes extensive CI/CD pipelines testing against containerd and CRI-O across multiple versions.

RATING8.7/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS146
VELOCITY0.99
OPEN ISSUES10
CLOSED ISSUES416
LAST COMMIT1 month ago
github.com/containerd/nri (go) v0.12.2
github.com/distribution/reference (go) v0.6.0
github.com/docker/go-units (go) v0.5.0
github.com/google/uuid (go) v1.6.0
github.com/invopop/jsonschema (go) v0.14.0
github.com/moby/term (go) v0.5.2
github.com/onsi/ginkgo/v2 (go) v2.32.1
github.com/onsi/gomega (go) v1.43.0
github.com/opencontainers/go-digest (go) v1.0.0
github.com/opencontainers/selinux (go) v1.15.1
github.com/sirupsen/logrus (go) v1.10.2
github.com/urfave/cli/v2 (go) v2.27.7
go.opentelemetry.io/otel (go) v1.46.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc (go) v1.46.0
go.opentelemetry.io/otel/sdk (go) v1.46.0
go.opentelemetry.io/otel/trace (go) v1.46.0
go.opentelemetry.io/proto/otlp (go) v1.11.0
golang.org/x/sys (go) v0.47.0
golang.org/x/term (go) v0.45.0
golang.org/x/text (go) v0.41.0
google.golang.org/grpc (go) v1.83.2
google.golang.org/protobuf (go) v1.36.12
k8s.io/client-go (go) v0.37.0
k8s.io/cri-api (go) v0.37.0
k8s.io/cri-client (go) v0.37.0
k8s.io/kubectl (go) v0.37.0
k8s.io/kubelet (go) v0.37.0
k8s.io/streaming (go) v0.37.0
sigs.k8s.io/yaml (go) v1.6.0
cyphar.com/go-pathrs (go) v0.2.1
github.com/Azure/go-ansiterm (go) v0.0.0-20250102033503-faa5f7b0171c
github.com/Masterminds/semver/v3 (go) v3.4.0
github.com/Microsoft/go-winio (go) v0.6.2
github.com/bahlo/generic-list-go (go) v0.2.0
github.com/buger/jsonparser (go) v1.1.2
github.com/cenkalti/backoff/v5 (go) v5.0.3
github.com/cespare/xxhash/v2 (go) v2.3.0
github.com/containerd/log (go) v0.1.0
github.com/containerd/ttrpc (go) v1.2.7
github.com/cpuguy83/go-md2man/v2 (go) v2.0.7
github.com/cyphar/filepath-securejoin (go) v0.6.0
github.com/davecgh/go-spew (go) v1.1.2-0.20180830191138-d8f796af33cc
github.com/fsnotify/fsnotify (go) v1.9.0
github.com/fxamacker/cbor/v2 (go) v2.9.1
github.com/go-logr/logr (go) v1.4.4
github.com/go-logr/stdr (go) v1.2.2
github.com/go-task/slim-sprig/v3 (go) v3.0.0
github.com/google/go-cmp (go) v0.7.0
github.com/google/pprof (go) v0.0.0-20260402051712-545e8a4df936
github.com/gorilla/websocket (go) v1.5.4-0.20250319132907-e064f32e3674
github.com/grpc-ecosystem/grpc-gateway/v2 (go) v2.30.0
github.com/json-iterator/go (go) v1.1.12
github.com/knqyf263/go-plugin (go) v0.9.0
github.com/liggitt/tabwriter (go) v0.0.0-20181228230101-89fcab3d43de
github.com/mitchellh/go-wordwrap (go) v1.0.1
github.com/moby/spdystream (go) v0.5.1
github.com/modern-go/concurrent (go) v0.0.0-20180306012644-bacd9c7ef1dd
github.com/modern-go/reflect2 (go) v1.0.3-0.20250322232337-35a7c28c31ee
github.com/munnerz/goautoneg (go) v0.0.0-20191010083416-a7dc8b61c822
github.com/opencontainers/runtime-spec (go) v1.3.0
github.com/pb33f/ordered-map/v2 (go) v2.3.1
github.com/russross/blackfriday/v2 (go) v2.1.0
github.com/tetratelabs/wazero (go) v1.11.0
github.com/x448/float16 (go) v0.8.4
github.com/xrash/smetrics (go) v0.0.0-20240521201337-686a1a2994c1
go.opentelemetry.io/auto/sdk (go) v1.2.1
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc (go) v0.70.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace (go) v1.46.0
go.opentelemetry.io/otel/metric (go) v1.46.0
go.yaml.in/yaml/v2 (go) v2.4.4
go.yaml.in/yaml/v3 (go) v3.0.5
go.yaml.in/yaml/v4 (go) v4.0.0-rc.2
golang.org/x/mod (go) v0.38.0
golang.org/x/net (go) v0.58.0
golang.org/x/oauth2 (go) v0.36.0
golang.org/x/sync (go) v0.22.0
golang.org/x/time (go) v0.15.0
golang.org/x/tools (go) v0.48.0
google.golang.org/genproto/googleapis/api (go) v0.0.0-20260819154853-08b0e4226688
google.golang.org/genproto/googleapis/rpc (go) v0.0.0-20260819154853-08b0e4226688
gopkg.in/inf.v0 (go) v0.9.1
k8s.io/api (go) v0.37.0
k8s.io/apimachinery (go) v0.37.0
k8s.io/cli-runtime (go) v0.37.0
k8s.io/component-base (go) v0.37.0
k8s.io/klog/v2 (go) v2.140.0
k8s.io/kube-openapi (go) v0.0.0-20260721132016-d427ff9ee9ad
k8s.io/utils (go) v0.0.0-20260626114624-be93311217bd
sigs.k8s.io/json (go) v0.0.0-20250730193827-2d320260d730
sigs.k8s.io/randfill (go) v1.0.0
sigs.k8s.io/structured-merge-diff/v6 (go) v6.4.2
Files by Type (count)
Go
2727
Other (no ext)
168
Markdown
167
Other (.s)
52
YAML
49
Git Ignore
29
Shell
24
Text
16
Makefile
13
Protocol Buffers
10
Dockerfile
8
TOML
5
Files by Type (size)
Go
35MB
Markdown
1MB
Other (no ext)
673KB
Protocol Buffers
525KB
Other (.s)
317KB
Other (.sum)
303KB
Text
120KB
YAML
77KB
Shell
71KB
Makefile
51KB
Other (.1)
23KB
Other (.docs)
19KB

The LLM identified 4 files worth highlighting for reuse:

Provides reusable generic patterns: `InterruptableRPC[T]` wraps CRI RPC calls with context cancellation and OS signal handling (Ctrl+C), `AggregateGoroutines` runs multiple functions concurrently and collects errors, `resourceStatus` fetches and marshals status of multiple resources (pod, container, image) with flexible output (JSON/YAML/template/table), and `collectIDs[T]` generically collects resource IDs from CLI args or lists all via `--all`. These patterns are self-contained, demonstrate non-obvious Go generics and concurrency handling, and can be extracted for any CLI tool that needs interruptible RPCs and parallel operations.

file: cmd/crictl/util.go ↗ | tags: #generic-rpc #parallel-execution #resource-status

Implements `GetExecutor` and `GetDialer` functions that abstract over SPDY and WebSocket transport protocols for CRI streaming operations (exec, attach, port-forward). The code selects the appropriate transport based on configuration and runtime capabilities, providing a clean interface for streaming I/O. This pattern is reusable for any project needing to support multiple streaming protocols with fallback logic, and demonstrates careful handling of protocol negotiation and error cases.

file: pkg/common/streaming.go ↗ | tags: #streaming-transport #spdy #websocket

Provides a reusable `InitTracer` function that initializes an OpenTelemetry tracer provider with configurable exporter (gRPC OTLP), service name, and resource attributes. It handles graceful shutdown and integrates with the CLI's tracing flags. This is a clean, self-contained module that can be extracted for any Go application needing OpenTelemetry tracing setup, demonstrating proper lifecycle management and configuration patterns.

file: pkg/tracing/tracing.go ↗ | tags: #opentelemetry #tracer-provider #instrumentation

Implements `NRITestPlugin`, a reusable test helper that starts a fake NRI (Node Resource Interface) plugin to intercept and verify container lifecycle events (RunPodSandbox, CreateContainer, etc.). It provides event recording, synchronization via channels, and hook callbacks for custom validation logic. This pattern is essential for any project needing to test NRI integration and demonstrates advanced goroutine coordination and event-driven testing patterns.

file: pkg/validate/nri_util_linux.go ↗ | tags: #nri-test-plugin #lifecycle-events #synchronization
Last analyzed: 2026-09-06 14:49:41.847538
Next check: 2026-09-13 14:49:41.798780
$ submit: