Commit Graph

501 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
99c194e033
go.mod: move indirects, and update integration go.mod to 1.18
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-02 12:02:13 +02:00
Maksym Pavlenko
871b6b6a9f Use testify
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-01 18:17:58 -07:00
Akihiro Suda
11a31320bb
go.mod: github.com/opencontainers/runc v1.1.1
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-04-01 15:16:08 +09:00
Phil Estes
3633cae64b
Merge pull request #6706 from kzys/typeurl-upgrade
Use typeurl.Any instead of github.com/gogo/protobuf/types.Any
2022-03-25 10:38:46 -04:00
Kazuyoshi Kato
96b16b447d Use typeurl.Any instead of github.com/gogo/protobuf/types.Any
This commit upgrades github.com/containerd/typeurl to use typeurl.Any.
The interface hides gogo/protobuf/types.Any from containerd's Go client.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-03-24 20:50:07 +00:00
Mike Brown
a51da91c1d moving up to go-cni v1.1.4
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2022-03-23 22:16:51 +00:00
Sebastiaan van Stijn
36612d692f
go.mod: remove replace and update github.com/gogo/googleapis v1.4.1
gogo/googleapis has a single dependency (github.com/gogo/protobuf), which is
currently the same version as we use, and we have a separate replace for that
dependency, so removing this override should not make a difference there.

gogo/googleapis v1.4.1 Includes updated protos with the gogo/protobuf fixes for
[CVE-2021-3121](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3121)

Change logs and diffs for each release:

- v1.3.3
  generate grpc service for google/longrunning/operations.proto
  full diff: https://github.com/gogo/googleapis/compare/v1.3.2...v1.3.3
- v1.4.0
  Add google geo type
  full diff: https://github.com/gogo/googleapis/compare/v1.3.3...v1.4.0
- v1.4.1
  This release contains sources generated with the version of gogo/protobuf
  containing a fix for the "skippy peanut butter" issue.
  full diff: https://github.com/gogo/googleapis/compare/v1.4.0...v1.4.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-23 16:56:30 +01:00
Kazuyoshi Kato
388ee880d2 Upgrade containerd/imgcrypt and opencontainers/image-spec
- Upgrade github.com/containerd/imgcrypt to prepare for typeurl upgrade
  (see https://github.com/containerd/imgcrypt/pull/72)
- Upgrade github.com/opencontainers/image-spec since imgcrypto needs at
  least 1.0.2.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-03-22 21:17:18 +00:00
Michael Crosby
0c701654a1
Merge pull request #6690 from estesp/update-prom-dep
Update prometheus client vendor
2022-03-18 12:40:57 -04:00
Phil Estes
c568752335
Update prometheus client vendor
Signed-off-by: Phil Estes <estesp@amazon.com>
2022-03-17 13:33:07 -04:00
Sebastiaan van Stijn
9aadef1bee
vendor: golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd
full diff: 32db794688...3147a52a75

This version contains a fix for CVE-2022-27191 (not sure if it affects us).

From the golang mailing list:

    Hello gophers,

    Version v0.0.0-20220315160706-3147a52a75dd of golang.org/x/crypto/ssh implements
    client authentication support for signature algorithms based on SHA-2 for use with
    existing RSA keys.

    Previously, a client would fail to authenticate with RSA keys to servers that
    reject signature algorithms based on SHA-1. This includes OpenSSH 8.8 by default
    and—starting today March 15, 2022 for recently uploaded keys.

    We are providing this announcement as the error (“ssh: unable to authenticate”)
    might otherwise be difficult to troubleshoot.

    Version v0.0.0-20220314234659-1baeb1ce4c0b (included in the version above) also
    fixes a potential security issue where an attacker could cause a crash in a
    golang.org/x/crypto/ssh server under these conditions:

    - The server has been configured by passing a Signer to ServerConfig.AddHostKey.
    - The Signer passed to AddHostKey does not also implement AlgorithmSigner.
    - The Signer passed to AddHostKey does return a key of type “ssh-rsa” from its PublicKey method.

    Servers that only use Signer implementations provided by the ssh package are
    unaffected. This is CVE-2022-27191.

    Alla prossima,

    Filippo for the Go Security team

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-17 14:13:41 +01:00
Fu Wei
79d7df70d6
Merge pull request #6681 from Juneezee/test/t.TempDir 2022-03-16 14:54:16 +08:00
Eng Zer Jun
18ec2761c0
test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-15 14:03:50 +08:00
Henry Wang
2e080bf491 Add shared content label to namespaces
Signed-off-by: Henry Wang <henwang@amazon.com>
2022-03-11 23:37:02 -08:00
Paul "TBBle" Hampson
6a25be94e9 CRI integration test for Windows Device mounts
This test takes advantage of the fact that when you tell Windows to
mount the GUID_DEVINTERFACE_DISPLAY_ADAPTER class, it will also mount
the host's device store into the container, even if there is no real GPU
on the host.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2022-03-12 08:16:43 +11:00
Phil Estes
8047eb2fca
Merge pull request #6635 from gabriel-samfira/fix-deadline-exceeded-in-daemon-restart
[Windows] Fix deadline exceeded in daemon restart
2022-03-10 12:30:38 -05:00
Gabriel Adrian Samfira
80bc32f069
Use temp file for export/import test
Using a bytes buffer for this test increases the memory usage on Windows
to over 3 GB. Using a temporary file as a destination for the image
keeps memory usage at a reasonable level.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-03-10 11:48:38 +02:00
Phil Estes
b521429b67
Merge pull request #6495 from thaJeztah/improve_versions
strip path-info from `-v` (version) output, and implement -v flag for containerd-shim
2022-03-08 13:57:34 -05:00
Gabriel Adrian Samfira
14901335c1
Increase wait timeout for TestDaemonRestart
Windows needs a bit more time to finish the restarting containerd. With
the current 2 second timeout, we run the risk of exceeding that
deadline.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-03-08 18:09:42 +02:00
Paul "TBBle" Hampson
5b78a9a8f1 Remove hardcoded /tmp in tempfile paths
There's no specific need mentioned at the points it was added, and it
makes the Windows-hosted test run setup slightly weird.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2022-03-06 17:32:25 +11:00
Phil Estes
5427aec4f1
Merge pull request #6595 from zhsj/fix-cri-test
cri: fix integration test on cgroupsv2 system
2022-03-04 13:20:45 -05:00
Phil Estes
ab2f7dcdbc
Merge pull request #6568 from katiewasnothere/cri_integration_tests_windows
Update TestContainerSymlinkVolumes to use windows path
2022-03-03 10:19:56 -05:00
Shengjing Zhu
775facd573 cri: fix integration test on cgroupsv2 system
TestUpdateContainerResources_MemoryLimit still uses old method to
check memlimit in cgroup.

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2022-02-28 21:27:53 +08:00
Shengjing Zhu
f1f69d4eeb integration: remove duplicated util pkg
Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2022-02-28 20:36:01 +08:00
Shengjing Zhu
ea3d2e6433 go.mod: update to github.com/tchap/go-patricia/v2 v2.3.1
Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2022-02-26 05:04:55 +08:00
Phil Estes
2b2372d43e
Merge pull request #6337 from thaJeztah/bump_go_restful
go.mod: update to github.com/emicklei/go-restful/v3 v3.7.3
2022-02-22 17:33:37 -05:00
Shengjing Zhu
f4f41296c2 Replace golang.org/x/net/context with std library
Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2022-02-22 02:27:05 +08:00
Kathryn Baldauf
a3303e7214 Update TestContainerSymlinkVolumes to use windows path
Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
2022-02-18 16:21:40 -08:00
Sebastiaan van Stijn
481fb923c5
go.mod: update to github.com/emicklei/go-restful/v3 v3.7.3
full diff: https://github.com/emicklei/go-restful/compare/v2.9.5...v3.7.3

- Switch to using go modules
- Add check for wildcard to fix CORS filter
- Add check on writer to prevent compression of response twice
- Add OPTIONS shortcut WebService receiver
- Add Route metadata to request attributes or allow adding attributes to routes
- Add wroteHeader set
- Enable content encoding on Handle and ServeHTTP
- Feat: support google custom verb
- Feature: override list of method allowed without content-type
- Fix Allow header not set on '405: Method Not Allowed' responses
- Fix Go 1.15: conversion from int to string yields a string of one rune
- Fix WriteError return value
- Fix: use request/response resulting from filter chain
- handle path params with prefixes and suffixes
- HTTP response body was broken, if struct to be converted to JSON has boolean value
- List available representations in 406 body
- Support describing response headers
- Unwrap function in filter chain + remove unused dispatchWithFilters

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-18 21:54:27 +01:00
Phil Estes
39afc6fd47
Merge pull request #6515 from gabriel-samfira/enable-restart-monitor
[Windows][Integration] Enable TestRestartMonitor
2022-02-16 10:37:29 -05:00
Sebastiaan van Stijn
1a31772a7a
go.mod: github.com/moby/sys/signal v0.7.0
full diff: https://github.com/moby/sys/compare/signal/v0.6.0...signal/v0.7.0

- add LCOW supported signals to windows signal map

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-15 14:17:17 +01:00
Sebastiaan van Stijn
b1881bdc04
go.mod: github.com/moby/sys/mountinfo v0.6.0
full diff: https://github.com/moby/sys/compare/mountinfo/v0.5.0...mountinfo/v0.6.0

- Add MountedFast (Note: most users should keep using Mounted, which already
  incorporates all optimizations from MountedFast)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-15 14:15:32 +01:00
Sebastiaan van Stijn
b6a6757c11
go.mod: github.com/fsnotify/fsnotify v1.5.1
full diff: https://github.com/fsnotify/fsnotify/compare/v1.4.9...v1.5.1

Relevant changes:

- Fix unsafe pointer conversion
- Drop support/testing for Go 1.11 and earlier
- Update x/sys to latest
- add //go:build lines
- add go 1.17 to test matrix

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-15 14:11:18 +01:00
Maksym Pavlenko
7efd485b6e
Merge pull request #6543 from dmcgowan/update-cni-v1.1.2
Update go-cni to v1.1.3
2022-02-14 17:03:54 -08:00
Derek McGowan
fa19714db9
Update go-cni to v1.1.3
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-02-14 10:37:31 -08:00
Derek McGowan
c0f8188469
Update go-cni to v1.1.2
Fixes panic when exec is nil

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-02-10 12:40:51 -08:00
Gabriel Adrian Samfira
4f0d5f0ee3 Enable TestContainerPTY and TestContainerUsername
Enables TestContainerPTY and TestContainerUsername on Windows.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-02-10 06:46:42 +00:00
Gabriel Adrian Samfira
b63000c65d
[Windows][Integration] Enable TestRestartMonitor
With the release of hcsshim v0.9.2, this test should pass without
issues on Windows.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-02-04 17:27:14 +02:00
Michael Crosby
9a08d6fcde
Merge pull request #6457 from kzys/otel-http
tracing: use OTLP/HTTP in addition to OTLP/gRPC
2022-02-02 14:24:15 -05:00
Derek McGowan
8d69c041c5
Update cgroups to v1.0.3
Pull in latest cgroups to pick up leak fixes

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-02-01 16:57:51 -08:00
Sebastiaan van Stijn
e79aba10d4
integration/images/volume-ownership: strip path information from usage output
POSIX guidelines describes; https://www.gnu.org/prep/standards/html_node/_002d_002dversion.html#g_t_002d_002dversion

> The program’s name should be a constant string; don’t compute it from argv[0].
> The idea is to state the standard or canonical name for the program, not its
> file name.

We don't have a const for this, but let's make a start and just remove the path info.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-31 21:07:00 +01:00
Kazuyoshi Kato
e751f1f44f tracing: support OTLP/HTTP in addition to gRPC
This change adds OTLP/HTTP, specifically http/protobuf support.

http/protobuf is recommended in
https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/protocol/exporter.md.

However kube-apiserver and CRI-O use gRPC, kubelet may support
gRPC in future. So we should support gRPC as well.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-01-29 00:41:18 +00:00
Wei Fu
31a710c492 fix: should not send 137 code event if cmd is notfound
ShimV2 has shim.Delete command to cleanup task's temporary resource,
like bundle folder. Since the shim server exits and no persistent store
is for task's exit code, the result of shim.Delete is always 137 exit
code, like the task has been killed.

And the result of shim.Delete can be used as task event only when the
shim server is killed somehow after container is running. Therefore,
dockerd, which watches task exit event to update status of container,
can report correct status.

Back to the issue #6429, the container is not running because the
entrypoint is not found. Based on this design, we should not send
137 exitcode event to subscriber.

This commit is aimed to remove shim instance first and then the
`cleanupAfterDeadShim` should not send event.

Similar Issue: #4769
Fix #6429

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-01-22 00:58:33 +08:00
Michael Crosby
f2c2d07683
Merge pull request #6458 from dcantah/change-to-constant-win2022
Integration: Change to Windows Server 2022 build number constant
2022-01-19 16:19:00 -05:00
Daniel Canter
7d7064e6b4 Integration: Change to Windows Server 2022 build number constant
The build number used to determine whether we need to pull the Windows
Server 2022 image for the integration tests was previously hardcoded as there
wasn't an hcsshim release with the build number. Now that there is and it's
vendored in, this change just swaps to it.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-01-19 11:54:22 -08:00
Derek McGowan
2898004a5b
Update kubernetes vendor to 0.22.5
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-01-19 11:24:12 -08:00
Derek McGowan
5089b12100
Merge pull request #6439 from dmcgowan/remove-submodule-go-mod
Remove submodule go mod
2022-01-19 11:20:04 -08:00
Phil Estes
778da8bae9
Merge pull request #6453 from dcantah/bump-hcsshim-0.9.2
go.mod: Update hcsshim to v0.9.2
2022-01-19 08:34:46 -05:00
Akihiro Suda
f0afdea2ad
Merge pull request #6375 from AkihiroSuda/runc-1.1.0
update runc to v1.1.0
2022-01-19 15:19:59 +09:00
Daniel Canter
af39d2ad71 go.mod: Update hcsshim to v0.9.2
This tag brings in some bug fixes related to waiting for containers to terminate and
trying to kill an already terminated process, as well as tty support (exec -it) for
Windows Host Process Containers.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-01-18 17:34:52 -08:00
Derek McGowan
fcb7bd6997
Remove api go submodule
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-01-18 14:48:33 -08:00
Akihiro Suda
21a748e381
go.mod: github.com/opencontainers/runc v1.1.0
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-01-18 13:35:22 +09:00
Brian Goff
d5e8edf2df Do not automatically inject client traces
This is a effective revert of 294143bf38
The one thing that makes it not a total revert is this keeps the usage
of chain interceptors, which prevents us from overwriting interceptors
passed into client options.

The automatic trace injection is unnecessary overhead since callers of
this function can add the necessary interceptors when creating the
client.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2022-01-13 22:11:18 +00:00
Phil Estes
c3177caf0c
Merge pull request #6435 from alunsin/dev/build-image-for-ppc64le
Add ppc64 support for test images
2022-01-12 14:44:49 -05:00
Aurelien Lun-Sin
c0a31a7a40
Add ppc64 support for test images
Signed-off-by: Aurelien Lun-Sin <alunsin@us.ibm.com>
2022-01-11 19:58:31 +01:00
宁明晓10296073
b35fb7d447 remove io/ioutil
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2022-01-11 16:07:23 +08:00
Derek McGowan
468513820d
Merge pull request #6351 from adisky/update-k/k-1.23
Updates CRI API & Kubernetes to 1.23
2022-01-07 15:26:44 -08:00
Derek McGowan
647308bc47
Merge pull request #6410 from AkihiroSuda/update-go-mod-20220107
go.mod: update github.com/containerd/{continuity,go-cni,imgcrypt}
2022-01-07 12:34:44 -08:00
Akihiro Suda
d3724a6c17
go.mod: update github.com/containerd/{continuity,go-cni,imgcrypt}
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-01-07 18:54:15 +09:00
haoyun
bbe46b8c43 feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: zounengren <zouyee1989@gmail.com>
2022-01-07 10:27:03 +08:00
Aditi Sharma
e43d4206af Update k/k to 1.23.0
Signed-off-by: Aditi Sharma <adi.sky17@gmail.com>
2022-01-06 11:18:23 +05:30
Markus Lehtonen
eba1048163 Update dependencies
Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
2022-01-04 09:27:54 +02:00
Claudiu Belu
894af07e37 integration: Adds Windows equivalent for TestSandboxRemoveWithoutIPLeakage
Adds an equivalent TestSandboxRemoveWithoutIPLeakage for Windows, in which
we assert that the IPs are not leaked when a Pod's HNS namespace dissapears
and the Pod is deleted afterwards.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2022-01-03 00:26:47 -08:00
Fu Wei
3ab676ce22
Merge pull request #6395 from jonyhy96/fix-abstract 2021-12-28 18:13:34 +08:00
haoyun
85326d76f4 fix: only test abstract unix socket on linux
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-12-28 17:07:19 +08:00
Akihiro Suda
1a078e6893
Merge pull request #6390 from gabriel-samfira/fix-restart-container-test
Fix restart container test
2021-12-24 18:29:57 +09:00
Gabriel Adrian Samfira
653b8b02ad
Expect ErrorNotFound on Windows after Kill()
The "notready-sandbox" array will only have a CONTAINER_CREATED
and a CONTAINER_EXITED in the sandbox. So there will be no running
task to send a Kill() to. This means that on Windows, it will always
return an ErrorNotFound.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2021-12-21 11:17:49 +02:00
Michael Crosby
3ae95e78a1
Merge pull request #6384 from dcantah/fix-nodaemon
Fix no-daemon flag for integration/client tests
2021-12-20 13:26:57 -05:00
Gabriel Adrian Samfira
0ff87a8929
Replace tskill with taskkill
This offers a more reliable way of killing a process. The /IM flag
allows us to specify the "image name" of the process we're killing.
This means we can use wildcards, foce kill a process and all the child
processes it may have spawned.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2021-12-20 18:33:36 +02:00
Gabriel Adrian Samfira
aadae6d50b
Fix flakiness on Windows for list stats
This change fixes flakiness on Windows for TestContainerListStatsWithSandboxIdFilter

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2021-12-17 17:38:37 +02:00
Daniel Canter
d53c431334 Fix no-daemon flag for integration/client tests
The global &daemon{} object only gets an address assigned if you call
start() on it, which only gets called if you don't pass no-daemon. The
aftermath of this is that running the integration tests with no-daemon
just has them fail trying to create a client for containerd.
This change just assigns whatever address is passed to the binary even in
the no-daemon case so you can run the integration tests against an already
running containerd instance.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-12-17 08:58:39 -05:00
Kazuyoshi Kato
5c2edeffbc Upgrade k8s.io/klog/v2 from 2.9.0 to 2.20.0
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-12-16 23:10:06 +00:00
Kazuyoshi Kato
2ee3ce510c Use insecure.NewCredentials instead of grpc.WithInsecure
grpc.WithInsecure is being deprecated.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-12-16 23:10:06 +00:00
Kazuyoshi Kato
2fb739aa21 Upgrade OpenTelemetry dependencies
This commit upgrades the packages under go.opentelemetry.io/.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-12-16 22:35:57 +00:00
Daniel Canter
abcf7c2f6a Disable TestContainerHook on Windows
OCI hooks aren't implemented on Windows. The test will, and has been,
actuallyrunning fine on Windows because the Github runners seem to have
a 'ps' binary in the users PATH, but there's not any actual hook
functionality being tested as any of the OCI fields are ignored for
Windows containers.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-12-14 17:35:02 -08:00
Phil Estes
949db57213
Merge pull request #6320 from endocrimes/dani/cri-swap
cri: add support for configuring swap
2021-12-14 15:02:28 -05:00
Derek McGowan
0def0dbecb
Merge pull request #6275 from gabriel-samfira/enable-volume-ownership-test
Integration: Enable TestVolumeOwnership on Windows
2021-12-14 09:33:24 -08:00
Wei Fu
9e9ee66bfd integration: deflake TestContainerdRestart
The CRI-plugin will setup watcher for each container after
StartContainer or RunPodSandbox. It will cleanup task(container/sandbox)
if received the exit event from watcher.

The original test design is to `Delete` sandbox container to get
NOT_READY state and expect to receive NotFound error. It depends on that
CRI-plugin cleanups container after `Delete` API. If not, the shim will
be cleanup and test code will receive `ttrpc: closed: unknown` or other
unknown error. It is flaky.

In this patch, the test will only send the kill signal and wait for the
exit event. When sandbox exits, the state will and must be NOT_READY.

```plain
// test fail log

=== RUN TestContainerdRestart
restart_test.go:92: Make sure no sandbox is running before test
restart_test.go:97: Start test sandboxes and containers
common.go:115: Image "k8s.gcr.io/pause:3.6" already exists, not pulling.
common.go:115: Image "k8s.gcr.io/pause:3.6" already exists, not pulling.
restart_test.go:139:
Error Trace: restart_test.go:139
Error: Should be true
Test: TestContainerdRestart
Messages: delete should return not found error but returned failed to delete task: ttrpc: closed: unknown
--- FAIL: TestContainerdRestart (4.25s)

// containerd log

&TaskExit{ContainerID:4b4c1d1d303c14a2cc759631d163f153ba8536e9ea6821744a509e4a17346184,ID:4b4c1d1d303c14a2cc759631d163f153ba8536e9ea6821744a509e4a17346184,Pid:28430,ExitStatus:137,ExitedAt:2021-12-12 07:56:01.400753012 +0000 UTC,XXX_unrecognized:[],}"
time="2021-12-12T07:56:01.401120516Z" level=debug msg="event forwarded" ns=k8s.io topic=/tasks/exit type=containerd.events.TaskExit
time="2021-12-12T07:56:01.418934208Z" level=debug msg="event forwarded" ns=k8s.io topic=/tasks/delete type=containerd.events.TaskDelete
time="2021-12-12T07:56:01.419192910Z" level=info msg="shim disconnected" id=4b4c1d1d303c14a2cc759631d163f153ba8536e9ea6821744a509e4a17346184
time="2021-12-12T07:56:01.419235911Z" level=warning msg="cleaning up after shim disconnected" id=4b4c1d1d303c14a2cc759631d163f153ba8536e9ea6821744a509e4a17346184 namespace=k8s.io
time="2021-12-12T07:56:01.419247711Z" level=info msg="cleaning up dead shim"
time="2021-12-12T07:56:01.419235311Z" level=error msg="failed sending message on channel" error="write unix /run/containerd/s/18afde7fcde70236eb31b9f43f3bd92af1dc1186583c501aa1396255f87f95d4->@: write: broken pipe"
time="2021-12-12T07:56:01.419354712Z" level=debug msg="failed to delete task" error="ttrpc: closed" id=4b4c1d1d303c14a2cc759631d163f153ba8536e9ea6821744a509e4a17346184
```

CI Link: `https://pipelines.actions.githubusercontent.com/G4SighzWVVZ6vsyiz7FFMFjLjRzveJHseEnVyibkSq87Cl2x4O/_apis/pipelines/1/runs/9501/signedlogcontent/76?urlExpires=2021-12-12T08%3A42%3A08.0765750Z&urlSigningMethod=HMACV1&urlSignature=pH93isMSFdZUo1ndnZynJpZbPGrEyvt12MO03fgUU7I%3D`

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-12-13 23:43:26 +08:00
Derek McGowan
552a27081c
Disable restart monitor test in Windows
Skip this test until this error can be evaluated and the appropriate
test fix or environment configuration can be determined.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-12-10 11:43:23 -08:00
Maksym Pavlenko
95b83fa54f
Merge pull request #6355 from dmcgowan/integration-client-restart-daemon-output
Update restart monitor test to output daemon logs on failure
2021-12-09 13:51:01 -08:00
Derek McGowan
2c96d5b067
Run windows parallel integration test as short
This prevents tests which spawn daemons from running at
the same time as the first integration test.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-12-09 11:45:38 -08:00
Derek McGowan
807213fd32
Update restart monitor test to output daemon logs on failure
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-12-09 11:45:37 -08:00
Sebastiaan van Stijn
fc8138468f
go.mod: update image-spec to latest (v1.0.3-dev)
The OCI image spec did a v1.0.2 security release for CVE-2021-41190, however
commit 09c9270fee, depends on MediaTypes that
have not yet been released by the OCI image-spec, so using current "main" instead.

full diff: 5ad6f50d62...693428a734

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-12-09 17:50:09 +01:00
Gabriel Adrian Samfira
77a321a073 Replace find with native Go code
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2021-12-07 11:04:38 +00:00
Gabriel Adrian Samfira
22dc60e059 Enable TestVolumeOwnership on Windows
This change enables the TestVolumeOwnership on Windows. The test
assumes that the volume-ownership image is built on Windows, thus
ensuring that Windows file security info (ACLs and ownership info)
are attached to the C:\volumes\test_dir path.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2021-12-07 10:47:13 +00:00
Akihiro Suda
c9d1e155c7
go.mod: github.com/opencontainers/runc v1.0.3
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-12-06 15:12:22 +09:00
Maksym Pavlenko
d06bce4d3d
Merge pull request #6314 from dcantah/ws2022-ci
Add Windows Server 2022 CI runs
2021-12-03 10:51:00 -08:00
Phil Estes
d742453086
Merge pull request #6324 from gabriel-samfira/set-explicit-acl
Set explicit ACL on test files
2021-12-03 13:14:04 -05:00
Gabriel Adrian Samfira
392f604eba
Use a single RUN command
Run test file creation in single RUN command.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2021-12-03 18:10:39 +02:00
Danielle Lancashire
533dd1c0ee fixup: check for swap accounting
Signed-off-by: Danielle Lancashire <dani@builds.terrible.systems>
2021-12-03 16:04:01 +01:00
Sebastiaan van Stijn
f33d38c7cb
integration: align tags of test images
I noticed we were using some different versions of the same test
images, so changing them to be the same (can help with find/replace
if we need to update them).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-12-03 15:14:09 +01:00
Danielle Lancashire
c5b0a18b6e fixup: handle diff between cgroupsv1 and v2
Signed-off-by: Danielle Lancashire <dani@builds.terrible.systems>
2021-12-03 14:35:00 +01:00
Gabriel Adrian Samfira
9cc0d1f073
Set explicit ACL on test files
It seems that the default ACLs inherited from the parent folder
on Windows Server 2022, does not include "CREATOR OWNER" as it
does on Windows Server 2019. This sets explicit ACLs on test
files.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2021-12-03 14:16:28 +02:00
Daniel Canter
ff77dd1121 Add Windows Server 2022 CI runs
GA for ws2022 github actions VMs launched a couple weeks ago so seems like
it's time to try out the CI on this new SKU.

This involved adding new ws2022 runs for the OS matrices in the CI, fixing up
a test in the platforms package and adding a mapping for the ws2022 container image in
integration/client.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-12-02 16:18:25 -08:00
Gabriel Adrian Samfira
fd0850e9ef
Update continuity dependency
This change ensures that Windows security info is
copied.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2021-12-03 00:26:45 +02:00
Gabriel Adrian Samfira
ff9d7aef32
Update volume test images
Update volume test images to version 2.1. This enables Windows
volume tests.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2021-12-03 00:02:45 +02:00
Phil Estes
08812f3fb7
Merge pull request #6201 from dmcgowan/test-restart-monitor-check-timestamp
Update TestRestartMonitor expected time check
2021-12-02 15:30:27 -05:00
Danielle Lancashire
2fa4e9c0e2 cri: add support for configuring swap
Signed-off-by: Danielle Lancashire <dani@builds.terrible.systems>
2021-12-02 21:25:33 +01:00
Phil Estes
8063fdab08
Merge pull request #6319 from dmcgowan/update-windows-integration-image-to-ghcr
Move test volume images from gcr to ghcr
2021-12-02 15:02:22 -05:00
Derek McGowan
bae0d88ae7
Add error logging on cleanup
Check the errors for task and container deletion during restart test
cleanup.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-12-02 11:47:14 -08:00
Maksym Pavlenko
6bccd67e84 Revert shim plugin migration
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-02 10:35:15 -08:00
Derek McGowan
665877a5bf
Move volume images from gcr to ghcr
With the ghcr images now built and working, switch over to
use these new images and update the default name.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-12-02 10:29:44 -08:00
Daniel Canter
2a6857d060 Skip TestExportAndImportMultiLayer on Windows
This change skips the TestExportAndImportMultiLayer in integration/client
for the time being. It seems the image was updated recently and no longer
has a Windows entry in the manifest so the test will always fail. This should
be reverted when we figure out what happened to the image, but this is to
unblock PRs for the time being.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-12-01 16:58:52 -08:00
Phil Estes
3d1c85d954
Merge pull request #6274 from gabriel-samfira/build-image-on-windows
Build volume test images on Windows
2021-11-30 09:49:08 -05:00
Wei Fu
8de1117c99 integration: add stats result in error message
```
// from  https://github.com/containerd/containerd/pull/6150#issuecomment-974747473

container_stats_test.go:364:
        	Error Trace:	container_stats_test.go:364
        	Error:      	Received unexpected error:
        	            	unexpected stats length
        	            	github.com/containerd/containerd/integration.TestContainerListStatsWithIdSandboxIdFilter.func4
        	            		/home/runner/work/containerd/containerd/integration/container_stats_test.go:371
        	            	github.com/containerd/containerd/integration.Eventually
        	            		/home/runner/work/containerd/containerd/integration/main_test.go:324
        	            	github.com/containerd/containerd/integration.TestContainerListStatsWithIdSandboxIdFilter
        	            		/home/runner/work/containerd/containerd/integration/container_stats_test.go:364
        	            	testing.tRunner
        	            		/opt/hostedtoolcache/go/1.17.3/x64/src/testing/testing.go:1259
        	            	runtime.goexit
        	            		/opt/hostedtoolcache/go/1.17.3/x64/src/runtime/asm_amd64.s:1581
        	Test:       	TestContainerListStatsWithIdSandboxIdFilter
```

Add stats result for the purpose of debug.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-11-28 16:57:40 +08:00
Gabriel Adrian Samfira
1698d061c3 Build volume test images on Windows
* Adds Windows dockerfile for volume-ownership image
  * Build volume-copy-up on Windows
  * Adds a helper tool that fetches the owner username and SID of
a file or folder
  * Adds README
  * Remove 2004 from Windows versions
  * Add ltsc2022 to Windows versions

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2021-11-25 09:54:35 +00:00
Takumasa Sakao
2b28dd363b Fix wrong make target on documentation
Signed-off-by: Takumasa Sakao <sakataku7@gmail.com>
2021-11-23 03:42:08 +09:00
Derek McGowan
f5863e22f4
Update API version in go.mod
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-11-18 16:21:19 -08:00
Daniel Canter
b103bee4cc go.mod: Bump hcsshim to v0.9.1
This tag contains some changes for the Windows shim for retrying
stdio named pipe connections if containerd restarts. It also is built with v1.1.0 of
ttrpc which has some fixes for a deadlock we'd observed on Windows.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-11-10 16:26:18 -08:00
Daniel Canter
920b24793d go.mod: Bump ttrpc to 1.1.0
This tag contains a fix for a deadlock observed when there are multiple
simultaneous requests from the same client connection.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-11-10 10:20:14 -08:00
Sebastiaan van Stijn
97073c9437
go.mod: github.com/moby/sys/mountinfo v0.5.0
full diff: https://github.com/moby/sys/compare/95edfa939201...mountinfo/v0.5.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-11-05 13:10:26 +01:00
Sebastiaan van Stijn
19d9d0d2a5
go.mod: github.com/moby/sys/signal v0.6.0
full diff: https://github.com/moby/sys/compare/8a51b5cc8879...signal/v0.6.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-11-05 13:08:07 +01:00
Sebastiaan van Stijn
9c455ded61
go.mod: github.com/moby/sys/symlink v0.2.0
full diff: https://github.com/moby/sys/compare/symlink/v0.1.0...symlink/v0.2.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-11-05 13:05:38 +01:00
Sebastiaan van Stijn
fa12f4e696
go.mod: golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359
full diff: ed5796bab1...69cdffdb93

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-11-05 13:03:15 +01:00
Derek McGowan
54c0cdae60
Update TestRestartMonitor expected time check
Use the time for the last non-running status to determine
whether the restart did not occur as expected. The
current timestamp only accounts for when the running
status was seen, however, the restart would have always
occurred in between the previous check and latest check.
Therefore, it makes more sense to use the previous check
to determine whether a failure was seen from the restart
monitor not restarting as expected.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-11-04 09:42:58 -07:00
Maksym Pavlenko
b5b83e0512
Merge pull request #5918 from mxpv/shim-manager
Decouple task manager
2021-11-04 16:29:52 +02:00
David Porter
b69bbe25ac Vendor latest k8s.io/cri-api and netlink
* Bump k8s.io/cri-api to latest version - v0.23.0-alpha.4
* Vendor github.com/vishvananda/netlink for network stats

Signed-off-by: David Porter <porterdavid@google.com>
2021-11-03 17:52:05 -07:00
Derek McGowan
1e36eaf11f
Merge pull request #6200 from bobbypage/restart_integration_test
test: Add grace period for restart monitor test
2021-11-03 14:53:09 -07:00
Phil Estes
fd07d74d6d
Merge pull request #6179 from claudiubelu/integration/enable-test-runtime-handler
integration: Enables TestRuntimeHandler for Windows
2021-11-03 14:14:33 -07:00
David Porter
9bfec3980b test: Add grace period for restart monitor test
restart monitor test was failing due to occasionally taking past the
deadline on windows tests. Add a small additional grace period to
deflake the test.

Signed-off-by: David Porter <porterdavid@google.com>
2021-11-03 14:07:11 -07:00
Maksym Pavlenko
6fa1bb4a5c Fix build after rebase
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-11-01 09:22:50 -07:00
Maksym Pavlenko
2cec3a34b1 Migrate task directory
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-11-01 07:37:01 -07:00
Maksym Pavlenko
a3d298193c Fix backward compatibility with old task shims
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-11-01 07:37:01 -07:00
Maksym Pavlenko
7c4ead285d Add task manager
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-11-01 07:36:58 -07:00
Claudiu Belu
fb4432c24a integration: Enables TestVolumeCopyUp for Windows
The image that the test is used for Windows has busybox included,
which means we can use sleep.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-10-07 19:30:42 -07:00
Claudiu Belu
0ba3532f54 integration: Enables TestRuntimeHandler for Windows
Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-10-07 18:20:59 -07:00
Derek McGowan
d97b40c300
Merge pull request #6085 from claudiubelu/integration/enables-windows-tests
integration: Enable some tests for Windows
2021-10-28 13:30:23 -07:00
Claudiu Belu
6020189003 integration: Enable some tests for Windows
Some of the tests in containerd/integration/client/ are not
currently being run on Windows, even though they can pass.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-10-13 16:04:46 +03:00
Claudiu Belu
830b3c26ec integration: Enable some tests for Windows (part 2)
Some of the tests that are currently running only on Linux can be made
to run on Windows with a few changes.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-10-07 08:13:01 -07:00
Claudiu Belu
96018b7db9 vendor: Updates go-cni
This update will allow us to forcefully delete a Windows sandbox if its
endpoint cannot be found anymore.

Fixes: #6135

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-10-06 05:35:53 -07:00
Derek McGowan
0d0fb68589
Merge pull request #6149 from ukontainer/vendor-moby-sys
vendor: update moby/sys for darwin support
2021-10-25 15:20:10 -07:00
Hajime Tazaki
b8f3ebb03b vendor: update moby/sys for darwin support
The mount package of darwin requires to retrive mountinfo to check if
the target of unmount if still mounted or not.  Thus pull the upstreamed
version of moby/sys to support this operation.

Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
2021-10-23 07:48:17 +09:00
Derek McGowan
45c5298700
Merge pull request #6144 from dmcgowan/prepare-v1.6.0-beta.1
Prepare v1.6.0-beta.1
2021-10-22 14:39:38 -07:00
Derek McGowan
37720fc6fd
Update api vendor
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-10-22 13:37:45 -07:00
zounengren
a217b5ac8f bump CNI to spec v1.0.0
Signed-off-by: zounengren <zouyee1989@gmail.com>
2021-10-22 10:58:40 +08:00
Brian Goff
294143bf38 Inject otel traces to grpc client.
This uses the global trace provider.
If a trace provider is not set, a no-op provider is used.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-10-21 16:08:15 +00:00
zounengren
1f1cad3912 io/ioutil package has been deprecated in Go 1.16 that replaces io/ioutil functions
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-10-13 09:18:31 +08:00
Derek McGowan
63b7e5771e
Merge pull request #5973 from Juneezee/deprecate-ioutil
refactor: move from io/ioutil to io and os package
2021-10-01 10:52:06 -07:00
Akihiro Suda
fbdcddedc0
Merge pull request #6076 from jonyhy96/cleanup-import
cleanup: import from k8s.io/utils/clock instead
2021-10-01 14:18:34 +09:00
haoyun
6484fab1e0 cleanup: import from k8s.io/utils/clock instead
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-09-30 23:27:20 +08:00
haoyun
d16942cf16 feat: enable cri remote client to call with grpc calloptions
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-09-30 23:02:53 +08:00
Kohei Tokunaga
09c9270fee images: enable converter to uncompress zstd
Currently uncompress converter only supports gzip. This commit fixes it to
support zstd as well.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-09-27 11:08:44 +09:00
Phil Estes
5162238c7d
Merge pull request #5853 from claudiubelu/integration/windows-hostprocess
integration: Adds Windows HostProcess tests
2021-09-26 20:35:00 -04:00
Claudiu Belu
2bc77b8a28 Adds Windows resource limits support
This will allow running Windows Containers to have their resource
limits updated through containerd. The CPU resource limits support
has been added for Windows Server 20H2 and newer, on older versions
hcsshim will raise an Unimplemented error.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-09-25 13:20:55 -07:00
Derek McGowan
c5947557d8
Add error message to in TestContainerdRestart integration test
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-10-11 08:23:31 -07:00
Derek McGowan
18d483b236
Update cgroups to v1.0.2
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-10-08 17:48:33 -07:00
Derek McGowan
cb6fb93af5
Merge pull request #6011 from crosbymichael/schedcore
add runc shim support for sched core
2021-10-08 10:42:16 -07:00
Derek McGowan
60ffa3ff7d
Merge pull request #5579 from claudiubelu/integration/restart-containerd
integration: Enables Windows containerd restart test
2021-10-08 10:33:10 -07:00
Michael Crosby
f1054dbbde
fix integration client vendor
Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-10-08 16:20:21 +00:00
Daniel Canter
46b152f81b vendor: Bump hcsshim to 0.9.0
This change bumps hcsshim to 0.9.0. Main thing this tag contains is support for
Kubernetes Host Process containers
See: https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-10-07 21:00:35 -07:00
Phil Estes
e648fa2e81
Merge pull request #5933 from claudiubelu/integration/import-multilayer
integration: Adds test for multilayer image import
2021-10-07 14:09:25 -04:00
Derek McGowan
2d48b6a864
Merge pull request #6031 from fuweid/carry-5648
runtime: should fail fast if dial error on shim
2021-10-07 09:43:10 -07:00
zounengren
3a713811be run gofmt with Go 1.17
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-10-07 20:16:59 +08:00
Brian Goff
1ee2bff0e0 Update go otel 1.0.1
This fixes the issue with the usage of the deprecated attribute.Any
function that original caused build issues.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-10-06 00:42:56 +00:00
Kohei Tokunaga
2244540628 Fix main branch build is broken
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-09-25 11:48:14 +09:00
Claudiu Belu
7a7a9a282c integration: Adds test for multilayer image import
This test will make sure there aren't any issues with multilayered
images during import. Keep in mind that in the case of multilayered
images, they have to be unpacked first in order to be usable.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-09-22 10:03:16 -07:00
Wei Fu
f7658e37d9 runtime: should fail fast if dial error on shim
In linux platform, the shim server always listens on the socket before
the containerd task manager dial it. It is unlikely that containerd task
manager should handle reconnect because the shim can't restart. For this
case, the containerd task manager should fail fast if there is ENOENT or
ECONNREFUSED error.

And if the socket file is deleted during cleanup the exited task, it
maybe cause that containerd task manager takes long time to reload the
dead shim. For that task.v2 manager, the race case is like:

```
TaskService.Delete
  TaskManager.Delete(runtime/v2/manager.go)
    shim.delete(runtime/v2/shim.go)
      shimv2api.Shutdown(runtime/v2/task/shim.pb.go)

      <- containerd has been killed or restarted somehow

      bundle.Delete
```

The shimv2api.Shutdown will cause that the shim deletes socket file
(containerd-shim-runc-v2 does). But the bundle is still there. During
reloading, the containerd will wait for the socket file appears again
in 100 seconds. It is not reasonable. The Reconnect should prevent this
case by fast fail.

Closes: #5648.
Fixes: #5597.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-09-23 00:00:28 +08:00
Eng Zer Jun
50da673592
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-09-21 09:50:38 +08:00
Derek McGowan
3e72e335fe
Use github images for integration tests
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-09-20 13:35:13 -07:00
wllenyj
6d961f9673 CI: Switch to available latest images
`mirror.gcr.io/library/busybox:1.32` is unavailable.

```console
$ curl -s https://mirror.gcr.io//v2/library/busybox/tags/list | jq '.tags'
[
      "1.26.2",
      "1.27.2",
      "1.28",
      "1.29",
      "1.29.2",
      "1.29.3",
      "1.30",
      "1.30.1",
      "1.31",
      "1.31.0",
      "1.31.1",
      "1.32.0"
]
```

Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
2021-09-14 11:59:19 +08:00
Claudiu Belu
e087b47e98 import: Raise error if the imported image is filtered out
During import, if an image does not match the host's platform,
it won't have any children labels set, which will result in the
Garbage Collector deleting its content later, resulting in an
unusable image. In this case, we should fail early.

This can still be bypassed by using ctr import --all-platforms.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-09-13 11:19:48 -07:00
Phil Estes
a4fa3a7162
Merge pull request #6017 from thaJeztah/fix_main_nomodules
update open go.opentelemetry.io v1.0.0 to fix import path
2021-09-23 15:07:41 -04:00
Derek McGowan
d0bedc5bd1
Merge pull request #5979 from TianTianBigWang/fix/err-string-fmt
fix error string format
2021-09-22 15:12:18 -07:00
Sebastiaan van Stijn
483d2e947f
go.mod: update opentelemetry modules to v1.0.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-09-22 16:24:17 +02:00
zounengren
7854e0bffe bump continuity and console version that remove pkg/errors
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-09-21 21:56:18 +08:00
Zilong Wang
498e5b27f7 fix error string format
Signed-off-by: zilong.wang <zilong.wang@daocloud.io>
2021-09-14 18:17:27 +08:00
Akihiro Suda
3d734d0345
Merge pull request #5976 from ukontainer/pr-continuity
vendor: update continuity for darwin support
2021-09-11 20:32:48 +09:00
Fu Wei
d9f921e4f0
Merge pull request #5906 from thaJeztah/replace_os_exec 2021-09-11 10:38:53 +08:00
Fu Wei
8766f2118c
Merge pull request #5972 from zouyee/labels 2021-09-11 09:42:43 +08:00
Hajime Tazaki
8ff8b1b823 vendor: update continuity for darwin support
This picks a fix to properly handle images containing symlinks
inside which point to an unexisting file.

Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
2021-09-11 08:32:37 +09:00
zounengren
16cd6ed137 Additional integration tests for pulling image with labels
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-09-10 20:16:57 +08:00
Michael Crosby
d040ca3845
Merge pull request #5861 from kzys/restart-monitor
integration: investigate TestRestartMonitor's failure
2021-09-09 10:56:40 -04:00
Claudiu Belu
f42513112f integration: Adds Windows HostProcess tests
Windows HostProcess containers can run containerized workloads on a Windows host.
These containers operate as normal processes but have access to the host network
namespace, storage, and devices when given the appropriate user privileges.

HostProcess containers support the ability to run as one of the following Windows
service accounts: LocalSystem, LocalService, NetworkService.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-09-07 00:30:28 -07:00
Claudiu Belu
abf4de4985 integration: Enables Windows containerd restart test
The test sets container's Linux.SecurityContext.NamespaceOptions.Pid = NamespaceMode_CONTAINER,
which will ensure that the container keeps running even if the sandbox container dies. We do
not have that option on Windows.

Adds additional logging in the test, so it is easier to figure out which assertion failed.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-09-04 13:52:33 -07:00
Daniel Canter
1dd0d59b73 go.mod: Update hcsshim to v0.8.21
This version brings in some bug fixes to layer handling. The actual fix isn't
present in the diff as it's not used here, but the Windows shim is built from
the tag present in go.mod, so the fix will be in the Windows shim on a new release
of Containerd if this tag is in.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-08-31 15:09:35 -07:00
Adelina Tuvenie
6d3d34b85d Update Pause image in tests & config
With the introduction of Windows Server 2022, some images have been updated
to support WS2022 in their manifest list. This commit updates the test images
accordingly.

Signed-off-by: Adelina Tuvenie <atuvenie@cloudbasesolutions.com>
2021-08-31 19:42:57 +03:00
Sebastiaan van Stijn
2ac9968401
replace uses of os/exec with golang.org/x/sys/execabs
Go 1.15.7 contained a security fix for CVE-2021-3115, which allowed arbitrary
code to be executed at build time when using cgo on Windows. This issue also
affects Unix users who have “.” listed explicitly in their PATH and are running
“go get” outside of a module or with module mode disabled.

This issue is not limited to the go command itself, and can also affect binaries
that use `os.Command`, `os.LookPath`, etc.

From the related blogpost (ttps://blog.golang.org/path-security):

> Are your own programs affected?
>
> If you use exec.LookPath or exec.Command in your own programs, you only need to
> be concerned if you (or your users) run your program in a directory with untrusted
> contents. If so, then a subprocess could be started using an executable from dot
> instead of from a system directory. (Again, using an executable from dot happens
> always on Windows and only with uncommon PATH settings on Unix.)
>
> If you are concerned, then we’ve published the more restricted variant of os/exec
> as golang.org/x/sys/execabs. You can use it in your program by simply replacing

This patch replaces all uses of `os/exec` with `golang.org/x/sys/execabs`. While
some uses of `os/exec` should not be problematic (e.g. part of tests), it is
probably good to be consistent, in case code gets moved around.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-25 18:11:09 +02:00
Fu Wei
ebe8f8c6be
Merge pull request #5899 from AkihiroSuda/runc-v1.0.2
bump up runc v1.0.2
2021-08-24 23:04:36 +08:00
Fu Wei
6fa9588531
Merge pull request #5903 from AkihiroSuda/gofmt117
Run `go fmt` with Go 1.17
2021-08-24 23:01:41 +08:00
Akihiro Suda
e185167677
go.mod: update runc to v1.0.2
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-08-23 23:24:45 +09:00
Sebastiaan van Stijn
4292969106
go.mod: github.com/pelletier/go-toml v1.9.3
full diff: https://github.com/pelletier/go-toml/compare/v1.8.1...v1.9.3

- v1.9.3: Clarify license and comply with Apache 2.0
- v1.9.2: Add Encoder.CompactComments to omit extra new line
- v1.9.1: Fix empty trees line counting

v1.9.0
-------------------

The highlight of this version is that the whole toml.Tree structure has been made
public in a backward compatible way. This allows everyone using v1.x to fully
access the data and metadata in the tree to extend the library.

This is hopefully the last release in the v1.x track, as go-toml v2 is the main
focus of development.

What's new

- TOML 1.0.0-rc.3
- Improved default tag for durations
- Provide Tree and treeValue public aliases
- Expose MarshalOrder
- Value string representation public function

Fixed bugs

- Do not allow T-prefix on local dates
- toml.Unmarshaler supports leaf nodes
- Fix date lexer to only support 4-digit year
- Fix ToMap for tables in mixed-type arrays
- Fix ToMap for tables in nested mixed-type arrays
- Support literal multiline marshal

Performance

- Remove date regexp
- Remove underscore regexps

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-23 15:38:29 +02:00
Akihiro Suda
d3aa7ee9f0
Run go fmt with Go 1.17
The new `go fmt` adds `//go:build` lines (https://golang.org/doc/go1.17#tools).

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-08-22 09:31:50 +09:00
Kazuyoshi Kato
f7b1ceb9f6 integration: investigate TestRestartMonitor's failure
- task.Kill() might fail in theory
- Giving a longer timeout may help us understand whether the failure is
  a timing issue or not.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-08-19 11:38:53 -07:00
Kazuyoshi Kato
acb81bbdaf integration: fix TestContainerPids
task.Pids returns the task's processes, but the order is not guaranteed.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-08-19 09:56:22 -07:00
Daniel Canter
e634f04d8c go.mod: update kubernetes to v1.22.0
This brings in some cri api changes for cgroups, Windows pod sandbox security
context changes and some new fields for the Windows version of a privileged
container.

This also unfortunately bumps the prometheus client, grpc middleware, bolt
and klog :(

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-08-09 16:16:54 -04:00
Derek McGowan
6f027e38a8
Remove redundant build tags
Remove build tags which are already implied by the name of the file.
Ensures build tags are used consistently

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-08-05 22:27:46 -07:00
Alakesh Haloi
3c5424454b [otel-tracing] vendor and go modules changes
This tracks all the vendor file changes and changes to go modules due
to OpenTelemetry support

Signed-off-by: Alakesh Haloi <alakeshh@amazon.com>
2021-08-04 14:25:12 -07:00
Jayme Howard
ce437864b2 mergo: Upgrade to 0.3.12 to fix panic
Signed-off-by: Jayme Howard <g.prime@gmail.com>

Run `go mod tidy`

Signed-off-by: Jayme Howard <g.prime@gmail.com>

Follow correct procedure by running `make vendor`

Signed-off-by: Jayme Howard <g.prime@gmail.com>
2021-07-29 12:20:09 -05:00
Derek McGowan
caf9e256b7
Merge pull request #5693 from kzys/sigrtmin
Support SIGRTMIN+n signals
2021-07-27 11:58:57 -07:00
Derek McGowan
6d31cdda50
Merge pull request #5716 from dims/add-new-go-module-for-api-directory
Introduce a new go module - containerd/api for use in standalone clients
2021-07-27 09:37:10 -07:00
Davanum Srinivas
494b940f14
Introduce a new go module - containerd/api for use in standalone clients
In containerd 1.5.x, we introduced support for go modules by adding a
go.mod file in the root directory. This go.mod lists all the things
needed across the whole code base (with the exception of
integration/client which has its own go.mod). So when projects that
need to make calls to containerd API will pull in some code from
containerd/containerd, the `go mod` commands will add all the things
listed in the root go.mod to the projects go.mod file. This causes
some problems as the list of things needed to make a simple API call
is enormous. in effect, making a API call will pull everything that a
typical server needs as well as the root go.mod is all encompassing.
In general if we had smaller things folks could use, that will make it
easier by reducing the number of things that will end up in a consumers
go.mod file.

Now coming to a specific problem, the root containerd go.mod has various
k8s.io/* modules listed. Also kubernetes depends on containerd indirectly
via both moby/moby (working with docker maintainers seperately) and via
google/cadvisor. So when the kubernetes maintainers try to use latest
1.5.x containerd, they will see the kubernetes go.mod ending up depending
on the older version of kubernetes!

So if we can expose just the minimum things needed to make a client API
call then projects like cadvisor can adopt that instead of pulling in
the entire go.mod from containerd. Looking at the existing code in
cadvisor the minimum things needed would be the api/ directory from
containerd. Please see proof of concept here:
github.com/google/cadvisor/pull/2908

To enable that, in this PR, we add a go.mod file in api/ directory. we
split the Protobuild.yaml into two, one for just the things in api/
directory and the rest in the root directory. We adjust various targets
to build things correctly using `protobuild` and also ensure that we
end up with the same generated code as before as well. To ensure we
better take care of the various go.mod/go.sum files, we update the
existing `make vendor` and also add a new `make verify-vendor` that one
can run locally as well in the CI.

Ideally, we would have a `containerd/client` either as a standalone repo
or within `containerd/containerd` as a separate go module. but we will
start here to experiment with a standalone api go module first.

Also there are various follow ups we can do, for example @thaJeztah has
identified two tasks we could do after this PR lands:

github.com/containerd/containerd/pull/5716#discussion_r668821396

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-07-27 07:34:59 -04:00
Derek McGowan
b5b5dcc273
Merge pull request #5162 from claudiubelu/integration-test-images
integration: Windows volume-copy-up images
2021-07-26 17:29:40 -07:00
Kazuyoshi Kato
1d3d08026d Support SIGRTMIN+n signals
systemd uses SIGRTMIN+n signals, but containerd didn't support the signals
since Go's sys/unix doesn't support them.

This change introduces SIGRTMIN+n handling by utilizing moby/sys/signal.

Fixes #5402.

https://www.freedesktop.org/software/systemd/man/systemd.html#Signals

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-07-26 09:36:43 -07:00
Kazuyoshi Kato
00d52bb159 integration: log all processes to investigate the test failure
The test is failing on
https://github.com/containerd/containerd/runs/3129202049#step:10:43.

I'd like to know whether the order of the array is the cause, or
the result is completely off.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-07-21 16:54:04 -07:00
Akihiro Suda
a12c7bd1cf
go.mod: runc v1.0.1
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-07-18 20:39:34 +09:00
Derek McGowan
18321f539c
Move loop check to before sleep
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-07-13 12:07:21 -07:00
Derek McGowan
2e8a572dfd
Add timestamp to flaky restart monitor test
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-07-13 12:07:21 -07:00
Akihiro Suda
55fd2ab5d6
integration/client: go mod tidy
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-07-13 14:36:02 +09:00
Maksym Pavlenko
d38c186d9d
Merge pull request #5578 from claudiubelu/integration/failed-container
test integration: Adds a test that restarts a failed container
2021-07-09 12:08:20 -07:00
Phil Estes
cf600abecc
Merge pull request #5619 from mikebrow/cri-add-v1-proxy-alpha
[CRI] move up to CRI v1 and support v1alpha in parallel
2021-07-09 14:07:24 -04:00