26 Commits
Author SHA1 Message Date
Etienne PerotandgVisor bot 4e53fafea2 Use //:release rather than //runsc target for all gVisor test usage
PiperOrigin-RevId: 973178774
2026-08-29 12:57:17 -07:00
Zach KoopmansandgVisor bot 7240f68868 Integrate custom TaskService on shim boot if enabled. Add integration tests.
PiperOrigin-RevId: 959911888
2026-08-05 15:53:20 -07:00
gVisor bot 93e9c1dc82 Merge pull request #13727 from EtiennePerot:gvisorbinaries-refactor
PiperOrigin-RevId: 949945872
2026-07-17 23:24:21 -07:00
Zach KoopmansandgVisor bot 8d5cd43fea Remove containerd-shim-runsc-v2 target.
PiperOrigin-RevId: 943506487
2026-07-06 14:54:44 -07:00
Zach KoopmansandgVisor bot 00a406eb38 Add integration tests for the runsc metric-server in the containerd shim.
This CL introduces a comprehensive set of integration tests for the runsc
metric-server within the containerd shim test suite. The tests verify that
the metric-server can correctly discover, scrape, and export Prometheus
metrics from sandboxes under various scenarios.

Specifically, we add the following tests in a new file, metric_server_test.go:
- TestMetricServer: A basic smoke test verifying metric-server startup,
  Unix socket binding, and basic metrics export containing the sandbox ID.
- TestMetricServerMultipleSandboxes: Verifies concurrent scraping of multiple
  sandboxes sharing a runsc root directory.
- TestMetricServerMultiContainer: Verifies that adding and killing
  sub-containers inside a sandbox does not break metrics export, and that the
  metric-server remains responsive.
- TestMetricServerLifecycle: Verifies that the metric-server dynamically
  updates the active running sandbox count (1 -> 0 -> 1) as sandboxes start
  and stop.

All tests are executed in two variants:
- default: Shim grouping is OFF.
- grouping: Shim grouping is ON (standard Kubernetes/Pod setup).

We also refactored the existing shim_test.go to extract a shared setupSandbox
helper, which eliminated ~150 lines of duplicate setup code across the entire
test suite.

PiperOrigin-RevId: 938121065
2026-06-25 12:11:48 -07:00
Zach KoopmansandgVisor bot 2e2c11bc98 feat(gvisor): add shim integration tests and event-driven wait system
- Added TestPauseResumeSandbox, TestPidsSandbox, TestDeleteContainer,
  and TestExecContainer integration tests in shim_test.go.
- Configured each MockContainerd instance to launch a unique local TTRPC
  events server on a short Unix socket path under /tmp.
- Refactored TestPauseResumeSandbox to reactively assert container state changes
  by waiting on TaskPaused and TaskResumed events from the event channel.
- Refactored killAndWaitForContainer helper to wait on TaskExit event.
- Patched gVisor shim State RPC to map container "paused" status to PAUSED.
- Registered specs.Process in typeurl registry to allow marshaling for Exec RPC.
- Gracefully handled rootless "operation not permitted" umount errors on Delete.

PiperOrigin-RevId: 938091357
2026-06-25 11:18:21 -07:00
Ayush RanjanandgVisor bot 12e27764f0 Deflake TestCreateSandboxWithContainer in shim/tests:shim_test.
Increase the timeout from 2s to 10s.

PiperOrigin-RevId: 922267552
2026-05-27 12:03:27 -07:00
Zach KoopmansandgVisor bot 5cf0eff3c3 Add test for creating a container within a sandbox.
Refactor TestCreateSandbox to use helper functions for creating, starting, and
killing containers, which wait for the expected task states. Add
TestCreateSandboxWithContainer to verify the workflow of creating a sandbox,
then creating and starting a container inside it, and finally killing
the sandbox. Update shimutils.NewContainerSpec to accept a sandboxID.

PiperOrigin-RevId: 919866693
2026-05-22 14:42:47 -07:00
Zach KoopmansandgVisor bot 7820345dc2 Implement framework for basic shim tests.
PiperOrigin-RevId: 919764925
2026-05-22 11:10:58 -07:00
Jing ChenandgVisor bot 09ecb96788 Integrate runsc shim with containerd 2.1.
PiperOrigin-RevId: 916119129
2026-05-15 12:06:54 -07:00
Jing ChenandgVisor bot 942bd0f240 Modernize gVisor shim bootstrap to RunManager.
The gVisor shim is registere as containerd TTRPC plugin.

The change removes global `id` filed from runsc task service, which transitions
the shim from a single container per shim assumption to multi continers per
shim architecture.

This CL modernizes the gVisor `runsc` shim by transitioning from the legacy
`containerdshim.Run` to the modern `containerdshim.RunManager` bootstrap flow.
Since the containerdshim.Run is removed in containerd 2.0 and later, it allows
us to migrate gVisor to integrate with containerd 2.0+.

This aligns the `runsc` shim with the `runc` architecture and allows it to be
loaded natively as a containerd plugin.

PiperOrigin-RevId: 912797962
2026-05-08 19:03:27 -07:00
Zach KoopmansandgVisor bot 1195132b26 Add stub binary for the v2 shim
PiperOrigin-RevId: 748317333
2025-04-16 09:22:57 -07:00
gVisor bot 2504c29b77 Merge pull request #11473 from Champ-Goblem:shim-add-cgroup-v2-metrics-support
PiperOrigin-RevId: 730560110
2025-02-25 14:52:09 -08:00
gVisor bot 07107984b0 Internal change.
PiperOrigin-RevId: 691911396
2024-10-31 13:17:28 -07:00
Adin ScannellandgVisor bot 2911d8c3b8 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Adin ScannellandgVisor bot c3529344a8 Add internal staging tags to //runsc and //shim binaries.
PiperOrigin-RevId: 367328273
2021-04-07 17:13:11 -07:00
Fabricio VoznikaandgVisor bot 29ebab9ef0 Delete shim v1
gvisor-containerd-shim is not compatible with containerd 1.1 or earlier.
Starting from containerd 1.2, shim v2 is the preferred interface.

PiperOrigin-RevId: 351485556
2021-01-12 17:54:10 -08:00
Adin ScannellandgVisor bot 0dab30d83f Fix simple mistakes identified by goreportcard.
These are primarily simplification and lint mistakes. However, minor
fixes are also included and tests added where appropriate.

PiperOrigin-RevId: 351425971
2021-01-12 12:38:22 -08:00
Adin ScannellandgVisor bot 56dd1e2544 Remove legacy bazel configurations.
Using the newer bazel rules necessitates a transition from proto1 to
proto2. In order to resolve the incompatibility between proto2 and
gogoproto, the cri runtimeoptions proto must be vendored.

Further, some of the semantics of bazel caching changed during the
transition. It is now necessary to:

- Ensure that :gopath depends only on pure library targets, as the
  propagation of go_binary build attributes (pure, static) will
  affected the generated files (though content remains the same,
  there are conflicts with respect to the gopath).
- Update bazel.mk to include the possibility of binaries in the
  bazel-out directory, as it will now put runsc and others there.
  This required some refinements to the mechanism of extracting
  paths, since some the existing regex resulted in false positives.
- Change nogo rules to prevent escape generation on binary targets.
  For some reason, the newer version of bazel attempted to run the
  nogo analysis on the binary targets, which fails due to the fact
  that objdump does not work on the final binary. This must be due
  to a change in the semantics of aspects in bazel3.

PiperOrigin-RevId: 337958324
2020-10-19 16:28:40 -07:00
Adin ScannellandgVisor bot 8ed0ce1893 Include shim in individual released binaries.
The debian rules are also moved to the top-level, since they
apply to binaries outside the //runsc directory.

Fixes #3665

PiperOrigin-RevId: 328379709
2020-08-25 12:24:32 -07:00
Andrei VaginandgVisor bot edf7b7e632 Remove doc rules for non-existent files
These files have been deleted by cl/324775563.

PiperOrigin-RevId: 325543067
2020-08-07 18:01:06 -07:00
Ian LewisandgVisor bot ae7ef2b2cd Add shim documentation to the website.
Add three new doc pages to the website.

- A containerd quick start covering containerd 1.2. This is limited to shim v2
  and runtime class as the docs would get too complicated explaining all the
  combinations that are possible. We want folks to use shim v2 and runtime
  class anyway.
- An advanced configuration page. This covers containerd and
  containerd-shim-runsc-v1's configuration options.
- A page for old versions (i.e. containerd 1.1). Notes that this is deprecated
  and supported on a best-effort basis.

Fixes #3279

PiperOrigin-RevId: 324775563
2020-08-04 02:43:44 -07:00
gVisor bot 517ba1fffe Merge pull request #2672 from amscanne:shim-integrated
PiperOrigin-RevId: 321053634
2020-07-13 16:10:58 -07:00
Adin Scannell 8c1e2ee569 Update shim to build using bazel.
The go.mod dependency tree for the shim was somehow contradictory. After
resolving these issues (e.g. explicitly imported k8s 1.14, pulling a
specific dbus version), and adding all dependencies, the shim can now be
build as part of the regular bazel tree.

As part of this process, minor cleanup was done in all the source files:
headers were standardized (and include "The gVisor Authors" in addition
to the "The containerd Authors" if originally derived from containerd
sources), and comments were cleaned up to meet coding standards.

This change makes the containerd installation dynamic, so that multiple
versions can be tested, and drops the static installer for the VM image
itself.

This change also updates test/root/crictl_test.go and related utilities,
so that the containerd tests can be run on any version (and in cases
where it applies, they can be run on both v1 and v2 as parameterized
tests).
2020-07-09 17:39:47 -07:00
Adin Scannell d93c23d63a Update canonical paths. 2020-07-09 16:59:42 -07:00
Adin Scannell 1d5c1ab60e Restructure shim packages for merging. 2020-05-19 21:24:22 -07:00