Commit Graph

639 Commits

Author SHA1 Message Date
Wei Fu
6b7e237fc7 chore: use go fix to cleanup old +build buildtag
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-12-29 14:25:14 +08:00
Rodrigo Campos
ca69ae2656 Add integration tests for CRI userns
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2022-12-27 22:01:12 -03:00
Derek McGowan
47fee791f6
Add sandbox store plugin type
Moves the sandbox store plugin under the plugins packages and adds a
unique plugin type for other plugins to depend on it.
Updates the sandbox controller plugin to depend on the sandbox store
plugin.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-12-20 23:05:14 -08:00
Samuel Karp
3233d5d6f5
Merge pull request #7845 from dcantah/fix-noip-onrestart
Fixes https://github.com/containerd/containerd/issues/7843
2022-12-20 14:28:54 -08:00
Danny Canter
3ee6dd5c1b CRI: Fix no CNI info for pod sandbox on restart
Due to when we were updating the pod sandboxes underlying container
object, the pointer to the sandbox would have the right info, but
the on-disk representation of the data was behind. This would cause
the data returned from loading any sandboxes after a restart to have
no CNI result or IP information for the pod.

This change does an additional update to the on-disk container info
right after we invoke the CNI plugin so the metadata for the CNI result
and other networking information is properly flushed to disk.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2022-12-20 13:20:27 -08:00
Kazuyoshi Kato
d5dd11dcdc Enable checkRename test
One of the cases wouldn't work on overlayfs, but other cases and/or
snapshotters should be tested.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-12-19 22:06:07 +00:00
Sebastiaan van Stijn
ce4ea26953
go.mod: update fuzz-headers and fuzz-build
Slowly chipping away non-tagged golang.org/x/ packages

diffs:

- b2031950a3...5330a85ea6
- 3345c89a7c...d395f97c48

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-15 17:36:05 +01:00
Maksym Pavlenko
373c26d585
Merge pull request #7709 from lucacome/bump-grpc
Bump grpc to v1.51.0
2022-12-13 22:21:00 -08:00
Phil Estes
ecf00ffe84
Merge pull request #7783 from inspektor-gadget/qasim/cri-disable-swap
cri: make swapping disabled with memory limit
2022-12-13 15:21:51 -05:00
Luca Comellini
d7507c3c13
Bump grpc to v1.51.0
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2022-12-12 09:16:53 -08:00
Mike Brown
4f4fa9b497
Merge pull request #7791 from fuweid/follow-up-7073
integration: increase timeout in container_event_test.go
2022-12-09 12:43:05 -06:00
Phil Estes
a7428f4473
Merge pull request #7732 from AkihiroSuda/sha256-simd
digest: use github.com/minio/sha256-simd
2022-12-09 09:37:37 -05:00
Wei Fu
423f4388b4 integration: increase timeout in container_event_test.go
Follow-up: https://github.com/containerd/containerd/pull/7073#discussion_r1044142416

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-12-09 15:26:49 +08:00
Fu Wei
f2cf411b79
Merge pull request #7073 from ruiwen-zhao/event
Add container event support to containerd
2022-12-09 15:24:23 +08:00
ruiwen-zhao
a338abc902 Add container event support to containerd
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
2022-12-08 19:30:39 +00:00
Maksym Pavlenko
3bc8fc4d30 Cleanup build constraints
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-12-08 09:36:20 -08:00
Qasim Sarfraz
69975b92bb cri: make swapping disabled with memory limit
OCI runtime spec defines memory.swap as 'limit of memory+Swap usage'
so setting them to equal should disable the swap. Also, this change
should make containerd behaviour same as other runtimes e.g
'cri-dockerd/dockershim' and won't be impacted when user turn on
'NodeSwap' (https://github.com/kubernetes/enhancements/issues/2400) feature.

Signed-off-by: Qasim Sarfraz <qasimsarfraz@microsoft.com>
2022-12-08 13:54:55 +01:00
Akihiro Suda
cde9490779
digest: use github.com/minio/sha256-simd
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-12-08 18:50:00 +09:00
Sebastiaan van Stijn
662d8a085e
vendor: golang.org/x/net v0.4.0
golang.org/x/net contains a fix for CVE-2022-41717, which was addressed
in stdlib in go1.19.4 and go1.18.9;

> net/http: limit canonical header cache by bytes, not entries
>
> An attacker can cause excessive memory growth in a Go server accepting
> HTTP/2 requests.
>
> HTTP/2 server connections contain a cache of HTTP header keys sent by
> the client. While the total number of entries in this cache is capped,
> an attacker sending very large keys can cause the server to allocate
> approximately 64 MiB per open connection.
>
> This issue is also fixed in golang.org/x/net/http2 v0.4.0,
> for users manually configuring HTTP/2.

full diff: https://github.com/golang/net/compare/c63010009c80...v0.4.0

other dependency updates (due to (circular) dependencies between them):

- golang.org/x/sys v0.3.0: https://github.com/golang/sys/compare/v0.2.0...v0.3.0
- golang.org/x/term v0.3.0: https://github.com/golang/term/compare/v0.1.0...v0.3.0
- golang.org/x/text v0.5.0: https://github.com/golang/text/compare/v0.4.0...v0.5.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-07 22:20:44 +01:00
Krisztian Litkey
740e90177a go.mod: re-vendor NRI from the official repo.
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2022-12-02 19:07:30 +02:00
Derek McGowan
51195ad099
Merge pull request #7731 from mxpv/cri
[Sandbox API] CRI status cleanup
2022-12-01 13:43:13 -08:00
Derek McGowan
0762a3a759
Add media type to export stream
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:57 -08:00
Derek McGowan
11c1c8e6f4
Update import logic
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:56 -08:00
Derek McGowan
cd67a98ec7
Add transfer integration test
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:54 -08:00
Derek McGowan
c469f67a2b
Merge pull request #6019 from klihub/pr/proto/nri
NRI: add support for NRI with extended scope.
2022-11-30 10:42:17 -08:00
Kirtana Ashok
08d5879f32 Added nullptr checks to pkg/cri/server and sbserver
Signed-off-by: Kirtana Ashok <Kirtana.Ashok@microsoft.com>
2022-11-29 13:25:49 -08:00
Maksym Pavlenko
cc111eef61 [sandbox] Move sandbox info to podsandbox controller
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-11-28 12:06:41 -08:00
Krisztian Litkey
ca84aba6cc integration: add first NRI integration tests.
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2022-11-28 21:51:25 +02:00
Krisztian Litkey
43704ca888 nri: add experimental NRI plugin.
Add a common NRI 'service' plugin. It takes care of relaying
requests and respones to and from NRI (external NRI plugins)
and the high-level containerd namespace-independent logic of
applying NRI container adjustments and updates to actual CRI
and other containers.

The namespace-dependent details of the necessary container
manipulation operations are to be implemented by namespace-
specific adaptations. This NRI plugin defines the API which
such adaptations need to implement.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2022-11-28 21:51:06 +02:00
Phil Estes
e0be97ccee
Merge pull request #7721 from thaJeztah/protobuf_extensions_fix
go.mod: golang_protobuf_extensions v1.0.4 - prevent incompatible versions
2022-11-28 12:22:50 -05:00
Sebastiaan van Stijn
2136736f52
go.mod: golang_protobuf_extensions v1.0.4 - prevent incompatible versions
This module made a whoopsie, and updated to `google.golang.org/protobuf`
in a patch release, but `google.golang.org/protobuf` is not backward
compatible with `github.com/golang/protobuf`.

Updating the minimum version to v1.0.4 which corrects this, to prevent
users of containerd as a module from accidentally pulling in the wrong
version:

- v1.0.3 switched to use `google.golang.org/protobuf`; https://github.com/matttproud/golang_protobuf_extensions/compare/v1.0.2..v1.0.3
- This was reverted in v1.0.4 (which is the same as v1.0.2); https://github.com/matttproud/golang_protobuf_extensions/compare/v1.0.3..v1.0.4
- And a `v2` was created instead; https://github.com/matttproud/golang_protobuf_extensions/releases/tag/v2.0.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-25 15:06:58 +01:00
Sebastiaan van Stijn
63c6c55ab4
go.mod: roll back github.com/containerd/cgroups to v1.0.4 release
This was updated in 470d3ee057, but we
only needed the ebpf update. As nothing depends on this module anymore,
other than for the stats package (which didn't change in between), we
can (for now) roll it back to v1.0.4, and just force the newer ebpf
package.

Things rolled back (doesn't affect vendored code);

https://github.com/containerd/cgroups/compare/7083cd60b721..v1.0.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-25 10:00:37 +01:00
Sebastiaan van Stijn
3c1c0878e3
integration/client: update containerd version to v1.7.0-beta.0
While the version isn't used (as it's replaced), let's keep it somewhat
in line with reality :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-25 09:29:03 +01:00
Sebastiaan van Stijn
ebd63adac2
integration/client: fix go.mod grouping
go.mod doesn't always do a great job on keeping the dependencies grouped in the
right block; 2b60770c4b added an extra "require"
block, after which things went downward.

This patch is grouping them back in the right block to nudge it in the right
direction.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-25 09:22:36 +01:00
Samuel Karp
7d3ca170fd
Merge pull request #7426 from samuelkarp/port-pr-5904-to-sbserver 2022-11-22 16:02:15 -08:00
AdamKorcz
ed3a49c0e6 fix for OSS-Fuzz infra changes
Signed-off-by: AdamKorcz <adam@adalogics.com>
2022-11-22 10:18:28 +00:00
Samuel Karp
ac4af4df89
integration: enable CNI slow test for sbserver
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2022-11-21 16:45:37 -08:00
Samuel Karp
085d8e6334
integration: enable tests for sbserver
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2022-11-21 16:45:37 -08:00
Sebastiaan van Stijn
bd912bbee0
go.mod: github.com/matttproud/golang_protobuf_extensions v1.0.2
Same commit, but now tagged

diff: https://github.com/matttproud/golang_protobuf_extensions/compare/c182affec369...v1.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-20 22:21:42 +01:00
Sebastiaan van Stijn
5f23daeb26
go.mod: github.com/moby/sys/sequential v0.5.0
Same commit, but now tagged

diff: https://github.com/moby/sys/compare/b22ba8a69b30...sequential/v0.5.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-20 22:20:47 +01:00
Sebastiaan van Stijn
763ec7c862
go.mod: github.com/cpuguy83/go-md2man/v2 v2.0.2
it's an indirect dependency, but updating allows us to drop another
dependency.

full diff: https://github.com/cpuguy83/go-md2man/compare/v2.0.0...v2.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-20 22:19:43 +01:00
Sebastiaan van Stijn
0f616e3549
go.mod: github.com/AdaLogics/go-fuzz-headers v0.0.0-20221118232415-3345c89a7c72
full diff: 443f56ff4b...3345c89a7c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-20 21:59:44 +01:00
Sebastiaan van Stijn
df4d07352d
go.mod: golang.org/x/sys v0.2.0
full diff: https://github.com/golang/sys/compare/v0.1.0...v0.2.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-20 21:58:02 +01:00
Sebastiaan van Stijn
4e68634ef0
go.mod: github.com/sirupsen/logrus v1.9.0
full diff: https://github.com/sirupsen/logrus/compare/v1.8.1...v1.9.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-20 21:53:29 +01:00
Akihiro Suda
b9f79d3018
Merge pull request #7703 from yanggangtony/fsnotify
Fsnotify bump and change code
2022-11-20 19:50:54 +09:00
yanggang
2cea525eee
Bump fsnotify to v1.6.0
Signed-off-by: yanggang <gang.yang@daocloud.io>
2022-11-20 09:37:37 +08:00
yanggang
73c6db881b
Bump urfave-cli to v1.22.10
Signed-off-by: yanggang <gang.yang@daocloud.io>
2022-11-19 15:13:27 +08:00
ruiwen-zhao
792294ce06 Update to cri-api v0.26.0-beta.0
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
2022-11-18 21:13:34 +00:00
Derek McGowan
223f67ccdb
Merge pull request #7601 from kzys/cgroups-upgrade
Upgrade github.com/containerd/cgroups from v1 to v3
2022-11-17 21:55:03 -08:00
Kazuyoshi Kato
6596a70861 Use github.com/containerd/cgroups/v3 to remove gogo
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-11-14 21:07:48 +00:00
Kazuyoshi Kato
f1162b77a3
Merge pull request #7663 from lucacome/bump-k8s-deps
Bump k8s.io deps to v0.25.4
2022-11-14 12:09:56 -08:00
Luca Comellini
38ad785cef
Bump k8s.io deps to v0.25.4
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2022-11-11 15:13:35 -08:00
Luca Comellini
bd66f588bf
Bump OpenTelemetry contrib to v0.36.4
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2022-11-11 15:10:38 -08:00
Luca Comellini
b829e6f2d3
Bump OpenTelemetry to v1.11.1
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2022-11-10 22:15:10 -08:00
Fu Wei
b5253df3ed
Merge pull request #7643 from lucacome/bump-grpc
Bump grpc to v1.50.1
2022-11-11 11:26:18 +08:00
Kazuyoshi Kato
02484f5e05
Merge pull request #7631 from thaJeztah/strings_cut
replace strings.Split(N) for strings.Cut() or alternatives
2022-11-10 15:28:22 -08:00
Luca Comellini
ab194e65f9
Bump grpc to v1.50.1
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2022-11-09 18:30:31 -08:00
AdamKorcz
b742aa2e77 fuzzing: bump go-fuzz-headers
Signed-off-by: AdamKorcz <adam@adalogics.com>
2022-11-09 14:30:30 +00:00
Luca Comellini
202abf8fc1
Bump k8s.io deps to v0.25.3
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2022-11-07 15:30:06 -08:00
Sebastiaan van Stijn
eaedadbed0
replace strings.Split(N) for strings.Cut() or alternatives
Go 1.18 and up now provides a strings.Cut() which is better suited for
splitting key/value pairs (and similar constructs), and performs better:

```go
func BenchmarkSplit(b *testing.B) {
        b.ReportAllocs()
        data := []string{"12hello=world", "12hello=", "12=hello", "12hello"}
        for i := 0; i < b.N; i++ {
                for _, s := range data {
                        _ = strings.SplitN(s, "=", 2)[0]
                }
        }
}

func BenchmarkCut(b *testing.B) {
        b.ReportAllocs()
        data := []string{"12hello=world", "12hello=", "12=hello", "12hello"}
        for i := 0; i < b.N; i++ {
                for _, s := range data {
                        _, _, _ = strings.Cut(s, "=")
                }
        }
}
```

    BenchmarkSplit
    BenchmarkSplit-10            8244206               128.0 ns/op           128 B/op          4 allocs/op
    BenchmarkCut
    BenchmarkCut-10             54411998                21.80 ns/op            0 B/op          0 allocs/op

While looking at occurrences of `strings.Split()`, I also updated some for alternatives,
or added some constraints; for cases where an specific number of items is expected, I used `strings.SplitN()`
with a suitable limit. This prevents (theoretical) unlimited splits.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 10:02:25 +01:00
Swagat Bora
3b87d46ce2 Add tracing spans in CRI image service and pull.go
Signed-off-by: Swagat Bora <sbora@amazon.com>

Add spans around image unpack operations
Use image.ref to denote image name and image.id for the image config digest
Add top-level spand and record errors in the CRI instrumentation service
2022-11-03 17:03:43 +00:00
Akihiro Suda
30c3078ae4
go.mod: golang.org/x/*: use tagged versions
golang.org/x/oauth2 is not updated due to its complex dependencies

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-11-03 10:18:31 +09:00
Samuel Karp
d577ef872a
Merge pull request #7537 from swagatbora90/fix-client-wait-start 2022-10-26 18:31:19 -07:00
Fu Wei
9b54eee718
Merge pull request #7419 from bart0sh/PR005-configure-CDI-registry-on-start 2022-10-22 08:17:33 +08:00
Swagat Bora
727b33c710 Retry client connection in waitForStart
Signed-off-by: Swagat Bora <sbora@amazon.com>
2022-10-19 16:24:07 +00:00
AdamKorcz
9a8611d635 bump go-fuzz-headers
Signed-off-by: AdamKorcz <adam@adalogics.com>
2022-10-19 00:13:07 +01:00
Samuel Karp
e8cdbee1e6
Merge pull request #7530 from kzys/critest-ginkgo-v2 2022-10-18 11:41:34 -07:00
Phil Estes
4fdebea98b
Merge pull request #7522 from thaJeztah/protobuf_extensions_tag
go.mod: matttproud/golang_protobuf_extensions v1.0.2 (use tag)
2022-10-17 09:55:36 -07:00
Kazuyoshi Kato
8e7ef890a5 Use logtest if possible to clean up logs
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-10-17 16:27:23 +00:00
Sebastiaan van Stijn
6a07a1c070
go.mod: matttproud/golang_protobuf_extensions v1.0.2 (use tag)
it's the same commit: https://github.com/matttproud/golang_protobuf_extensions/compare/v1.0.2...c182affec369

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-17 00:56:34 +02:00
Sebastiaan van Stijn
f9c80be1bb
remove unneeded nolint-comments (nolintlint), disable deprecated linters
Remove nolint-comments that weren't hit by linters, and remove the "structcheck"
and "varcheck" linters, as they have been deprecated:

    WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused.
    WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused.
    WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-12 14:41:01 +02:00
Sebastiaan van Stijn
29c7fc9520
clean-up "nolint" comments, remove unused ones
- fix "nolint" comments to be in the correct format (`//nolint:<linters>[,<linter>`
  no leading space, required colon (`:`) and linters.
- remove "nolint" comments for errcheck, which is disabled in our config.
- remove "nolint" comments that were no longer needed (nolintlint).
- where known, add a comment describing why a "nolint" was applied.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-12 14:40:59 +02:00
Ed Bartosh
347397cf2f update go.mod and go.sum
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2022-10-12 14:00:59 +03:00
Kevin Parsons
e6b5311508
Merge pull request #7483 from jterry75/jterry75/update_image_config_argsescaped
Updates oci image config to support upstream ArgsEscaped
2022-10-11 16:32:31 -07:00
Justin Terry
d4b9dade13 Updates oci image config to support upstream ArgsEscaped
ArgsEscaped has now been merged into upstream OCI image spec.
This change removes the workaround we were doing in containerd
to deserialize the extra json outside of the spec and instead
just uses the formal spec types.

Signed-off-by: Justin Terry <jlterry@amazon.com>
2022-10-11 13:29:56 -07:00
Phil Estes
9b0ab84449
Merge pull request #7481 from qiutongs/netns-fix
Update container with sandbox metadata after NetNS is created
2022-10-10 15:48:54 -07:00
Qiutong Song
b41d6f40bb Update container with sandbox metadata after NetNS is created
Signed-off-by: Qiutong Song <songqt01@gmail.com>
2022-10-09 01:14:08 +00:00
Kazuyoshi Kato
260af5e1d2 TestTaskResize must use a terminal
The test was essentially no-op since it didn't use a terminal.

Fixes #6249.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-10-08 01:39:27 +00:00
Sebastiaan van Stijn
e2d8f3859a
vendor: github.com/opencontainers/selinux v1.10.2
full diff: https://github.com/opencontainers/selinux/compare/v1.10.1...v1.10.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-05 22:33:35 +02:00
Derek McGowan
1cc38f8df7
Merge pull request #5904 from qiutongs/ip-leakage-fix 2022-09-29 18:14:35 -07:00
Daniel Canter
acb2964d65 go.mod: Bump go-winio to v0.6.0
Some minor improvements, but biggest for here is ErrPipeListenerClosed
is no longer an errors.New where the string matches the text of the now
exported net.ErrClosed in the stdlib, but is just assigned to net.ErrClosed
directly. This should allow us to get rid of the string check for "use of closed
network connection" here now..

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-09-28 10:30:38 -07:00
Qiutong Song
4196fad027 Add integration tests with failpoint
Signed-off-by: Qiutong Song <songqt01@gmail.com>
2022-09-27 14:45:18 +00:00
Brian Goff
b4558bedc6 Add test flag for skipping shim cgroup test
For some shims (namely github.com/cpuguy83/containerd-shim-systemd-v1),
the shim cgroup test doesn't make sense since there is only a single
shim process for the entire node.

I use these integration tests to make sure the shim is compatible with
the runc shims and generally works as expected. This will let me skip
the shim cgroup test as there is no process for the shim to stick into
the cgroup... mostly.
There is a bootstrap process as well as a PTY copier proces which do use
the shim cgroup if provided, but the test is not able to check for
those (unless we enable tty on the test, which is a bit arbitrary and
not useful).

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2022-09-23 17:39:04 +00:00
Fu Wei
e94e5b7fb4
Merge pull request #7397 from kzys/remove-deps
Upgrade fuzzing-related packages to reduce dependencies
2022-09-19 23:13:44 +08:00
Kazuyoshi Kato
f0fbc8dfdc Upgrade fuzzing-related packages to reduce dependencies
github.com/AdaLogics/go-fuzz-headers and
github.com/AdamKorcz/go-118-fuzz-build have less dependencies in
the last versions.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-09-15 23:25:03 +00:00
Tiger Kaovilai
524d3aca80 github.com/emicklei/go-restful CWE-285: Improper Authorization
https://security.snyk.io/vuln/SNYK-GOLANG-GITHUBCOMEMICKLEIGORESTFUL-2435653
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
2022-09-14 14:38:00 -04:00
Fu Wei
99ee82d0b6
Merge pull request #7374 from soulseen/update-cdi-version 2022-09-07 13:37:41 +08:00
xiaoyang zhu
829dd2145f update cdi version to v0.5.1
Signed-off-by: xiaoyang zhu <zhuxiaoyang1996@gmail.com>
2022-09-07 09:34:55 +08:00
Sebastiaan van Stijn
0f743ce4ff
vendor: golang.org/x/net v0.0.0-20220906165146-f3363e06e74c
Update to the latest version that contains a fix for CVE-2022-27664;
f3363e06e7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-06 22:46:21 +02:00
Kazuyoshi Kato
d99e62d8e5
Merge pull request #7367 from thaJeztah/cleanup_todo_comment
integration: TestUpdateContainerResources_MemoryLimit: remove TODO comment
2022-09-06 08:38:10 -07:00
lengrongfu
3c0e6c40ad feat: upgrade registry.k8s.io/pause version
Signed-off-by: rongfu.leng <1275177125@qq.com>
2022-09-06 15:59:20 +08:00
Sebastiaan van Stijn
e041d1a2c1
integration: TestUpdateContainerResources_MemoryLimit: remove TODO comment
This comment was added in 09a0c9471b when the
Windows integration tests were enabled. The PR (microsoft/hcsshim#931) was
merged, and part of hcsshim v0.9.0, and support for resource limits on Windows
was added in 2bc77b8a28, so it looks like this
comment is no longer current.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-05 09:52:29 +02:00
Samuel Karp
1bb39b833e
Merge pull request #7346 from kzys/fuzz-enable 2022-08-30 22:33:43 -07:00
Fu Wei
3b569fabeb
Merge pull request #7335 from thaJeztah/move_sys_forceremoveall 2022-08-31 07:35:36 +08:00
Kazuyoshi Kato
17e436c20c Pin github.com/AdamKorcz/go-118-fuzz-build
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-08-30 17:39:45 +00:00
Phil Estes
455127859b
Merge pull request #7342 from tklauser/losetup-unix
Use ioctl helpers from x/sys/unix
2022-08-30 12:32:20 -04:00
Sebastiaan van Stijn
2e677c9329
sys: move ForceRemoveAll to integration/client
ForceRemoveAll was only used in tests/fuzzing, but added hcsshim as dependency
for the sys package. Moving this to integration/client makes the "sys" package
slightly more lightweight, and may help simplifying dependency-management.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-30 17:39:18 +02:00
Tobias Klauser
0c6553bfda
go.mod, vendor: bump golang.org/x/sys to latest version
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2022-08-30 10:38:20 +02:00
Sebastiaan van Stijn
93342d637c
replace sys Sequential funcs with moby/sys/sequential
These functions were originally copied from the docker / moby repository in
4a7a8efc2d. Migrating these functions to use the
github.com/moby/sys/sequential module allows them being shared between moby,
docker/cli, and containerd, and to allow using them without importing all of sys
which also depends on hcsshim and more.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-29 18:36:34 +02:00
Phil Estes
91b9e5a00d
Merge pull request #7315 from AkihiroSuda/runc-1.1.4
update runc binary to v1.1.4
2022-08-26 09:39:59 -04:00
Fu Wei
0e7ff59098
Merge pull request #7325 from kzys/upgrade-compress 2022-08-26 21:23:00 +08:00
Kazuyoshi Kato
d063597e80 Upgrade github.com/klauspost/compress from v1.11.13 to v1.15.9
The package has multiple improvements and bug fixes.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-08-25 22:58:16 +00:00
Akihiro Suda
eb664aed0c
go.mod: github.com/opencontainers/runc v1.1.4
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-08-26 07:51:16 +09:00
zounengren
331066f87d update intergration
Signed-off-by: zounengren <zouyee1989@gmail.com>
2022-08-25 21:17:59 +08:00
Samuel Karp
36d0cfd0fd
Merge pull request #6517 from ruiwen-zhao/return-resource 2022-08-24 14:01:30 -07:00
Samuel Karp
8ce32aedd8
Merge pull request #7038 from pacoxu/registry-change 2022-08-24 13:04:13 -07:00
ruiwen-zhao
b7b1200dd3 ContainerStatus to return container resources
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
2022-08-24 19:08:06 +00:00
Paco Xu
9525b3148a migrate from k8s.gcr.io to registry.k8s.io
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2022-08-24 13:46:46 +08:00
Kazuyoshi Kato
f318947b06 Do not rename test files on-the-fly to share functions
Instead this commit moves some functions that could be used by fuzzers.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-08-19 03:48:18 +00:00
Kazuyoshi Kato
470d3ee057 Upgrade containerd/cgroups to remove github.com/cilium/ebpf's fuzzer
The fuzzer is broken and it breaks OSS-Fuzz according to #7288.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-08-17 21:43:45 +00:00
Daniel Canter
0950447106 Remove Windows special case in TestContainerdRestart
Previously in the Windows shim, killing a task that has already exited
or a task that has not yet been started, yielded an ErrNotFound. We now
return nil, which is in line with how the linux runtime behaves, so remove
the special case we had in TestContainerdRestart for this.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-08-15 17:03:45 -07:00
Daniel Canter
1f8db2467b go.mod: Bump hcsshim to v0.10.0-rc.1
This contains quite a bit (also bumps google/uuid to 1.3.0). Some HostProcess
container improvements to get ready for whenever it goes to stable in
Kubernetes, Hyper-V (windows) container support for CRI, and a plethora of
other small additions and fixes.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-08-15 17:03:45 -07:00
ruiwen-zhao
6e4b6830f1 Update CRI-API
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
2022-08-10 03:55:51 +00:00
Maksym Pavlenko
ca3b9b50fe Run gofmt 1.19
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-08-04 18:18:33 -07:00
Maksym Pavlenko
01a2b793b8
Merge pull request #7228 from mxpv/sb2
Initial sandbox API CRI integration.
2022-08-04 17:46:38 -07:00
Maksym Pavlenko
f51014f8d5 Add sandbox to in memory services
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-07-29 16:08:07 -07:00
Daniel Canter
b16c3e9adf Windows HostProcess container CRI stats test
Add a test to the CRI suite to validate stats functions for hostprocess
containers. hcsshim v0.9.3 had a bug in stats collection so this is
mainly for sanity and to avoid another regression.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-07-27 15:45:37 -07:00
Fu Wei
5ce1e46fa4
Merge pull request #7215 from Jenkins-J/ppc64le-cri-test-fix
Fix CRI image pull timeout test for ppc64le
2022-07-27 23:48:56 +08:00
Derek McGowan
6acde90772
Merge pull request #7069 from fuweid/failpoint-in-runc-shimv2
test: introduce failpoint control to runc-shimv2 and cni
2022-07-26 23:12:20 -07:00
Phil Estes
584110f0b6
Merge pull request #7210 from mxpv/image-list
Use image lists form integration/client tests
2022-07-26 12:09:41 -04:00
Maksym Pavlenko
2b92c70fa4 Fix command line parsing for image list
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-07-25 14:19:40 -07:00
Daniel Canter
14003683f0 go.mod: Bump hcsshim to v0.9.4
This tag contains some fixes for hostprocess containers, mainly around
fixing task stats which regressed from a change in v0.9.3.

https://github.com/microsoft/hcsshim/releases/tag/v0.9.4

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-07-25 13:24:34 -07:00
James Jenkins
1e0698e8e8 Fix CRI image pull timeout test for ppc64le
The ghcr.io/containerd/registry:2.7 image does not support the ppc64le
architecture, causing the TestCRIImagePullTimeout tests to fail when
executed on a ppc64le device.

Replace the ghcr.io/containerd/registry:2.7 image name and index with
the ghcr.io/containerd/volume-ownership:2.1 image and index in the
HoldingContentOpenWriter test.

Change the image pulled in the NoDataTransferred test to the
ghcr.io/containerd/volume-ownership:2.1 image.

Signed-off-by: James Jenkins <James.Jenkins@ibm.com>
2022-07-25 16:11:42 -04:00
Daniel Canter
c15d8e1560 go.mod: Bump hcsshim to 0.9.3
This tag brings in a new field to fix an HNS issue in ws2019 as well as
an optimization for collecting Windows stats (memory, cpu, iops).

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-07-25 13:03:39 -07:00
Maksym Pavlenko
a9514da757 Update image references for Windows tests
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-07-25 11:04:59 -07:00
Maksym Pavlenko
2ae5f405d2 Use image lists instead of hardcoded images
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-07-25 10:54:17 -07:00
Maksym Pavlenko
552d763447 Use image lists in client tests
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-07-25 10:47:00 -07:00
Wei Fu
e6a2c07902 integration: simplify CNI-fp and add README.md
* Use delegated plugin call to simplify cni-bridge-cni
* Add README.md for cni-bridge-cni

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-07-24 11:45:45 +08:00
Jeff Widman
050cd58ce6 Drop deprecated ioutil
`ioutil` has been deprecated by golang. All the code in `ioutil` just
forwards functionality to code in either the `io` or `os` packages.

See https://github.com/golang/go/pull/51961 for more info.

Signed-off-by: Jeff Widman <jeff@jeffwidman.com>
2022-07-23 08:36:20 -07:00
Maksym Pavlenko
500ff95f02 Make getServicesOpts a helper
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-07-22 19:38:45 -07:00
Wei Fu
3c5e80b63e integration: Add injected failpoint testing for RunPodSandbox
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-07-22 23:25:40 +08:00
Wei Fu
be91a219c2 integration: CNI bridge wrapper with failpoint
Introduce cni-bridge-fp as CNI bridge plugin wrapper binary for CRI
testing.

With CNI `io.kubernetes.cri.pod-annotations` capability enabled, the user
can inject the failpoint setting by pod's annotation
`cniFailpointControlStateDir`, which stores each pod's failpoint setting
named by `${K8S_POD_NAMESPACE}-${K8S_POD_NAME}.json`.

When the plugin is invoked, the plugin will check the CNI_ARGS to get
the failpoint for the CNI_COMMAND from disk. For the testing, the user
can prepare setting before RunPodSandbox.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-07-22 23:25:40 +08:00
Wei Fu
5f9b318e50 bin/ctr,integration: new runc-shim with failpoint
Added new runc shim binary in integration testing.

The shim is named by io.containerd.runc-fp.v1, which allows us to use
additional OCI annotation `io.containerd.runtime.v2.shim.failpoint.*` to
setup shim task API's failpoint. Since the shim can be shared with
multiple container, like what kubernetes pod does, the failpoint will be
initialized during setup the shim server. So, the following the
container's OCI failpoint's annotation will not work.

This commit also updates the ctr tool that we can use `--annotation` to
specify annotations when run container. For example:

```bash
➜  ctr run -d --runtime runc-fp.v1 \
     --annotation "io.containerd.runtime.v2.shim.failpoint.Kill=1*error(sorry)" \
     docker.io/library/alpine:latest testing sleep 1d

➜  ctr t ls
TASK       PID       STATUS
testing    147304    RUNNING

➜  ctr t kill -s SIGKILL testing
ctr: sorry: unknown

➜  ctr t kill -s SIGKILL testing

➜  sudo ctr t ls
TASK       PID       STATUS
testing    147304    STOPPED
```

The runc-fp.v1 shim is based on core runc.v2. We can use it to inject
failpoint during testing complicated or big transcation API, like
kubernetes PodRunPodsandbox.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-07-22 23:25:40 +08:00
Derek McGowan
1455926416
Merge pull request #7114 from kinvolk/rata/userns-cri
Update k8s.io/cri-api to v0.25.0-alpha2
2022-07-20 13:06:58 -07:00
Akihiro Suda
f6bc986dc1
go.mod: github.com/stretchr/testify v1.8.0
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-07-20 08:36:10 +09:00
Derek McGowan
681aaf68b7
Merge pull request #7123 from kzys/fuzz
Copy fuzzers from github.com/cncf/cncf-fuzzing
2022-07-06 14:52:28 -07:00
Kazuyoshi Kato
b316318596 Upgrade github.com/AdaLogics/go-fuzz-headers
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-07-06 15:21:45 +00:00
Ikko Ashimine
6d4b61007b integration/client: fix typo in export_test.go
Seet -> Seek
begining -> beginning

Signed-off-by: Ikko Ashimine <eltociear@gmail.com>
2022-07-06 11:14:45 +09:00
Rodrigo Campos
b8403d2e15 Update k8s.io/cri-api to v0.25.0-alpha2
This version contains the CRI changes for user namespaces support.
Future patches will use the new fields in the CRI.

Updating the module without using the new fields doesn't cause any
behaviour change.

Updates: #7063

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2022-06-30 12:09:08 +02:00
Phil Estes
a44cabf517
Update go-restful/v3 to latest release
Signed-off-by: Phil Estes <estesp@amazon.com>
2022-06-29 15:23:10 -04:00
Kazuyoshi Kato
f7de1c8f90 Do not hardcode fuzzers
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-06-27 22:54:25 +00:00
Kazuyoshi Kato
2b60770c4b Move container_fuzzer.go under integration/client/
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-06-27 22:54:25 +00:00
Derek McGowan
99e210c50a
Move metadata plugin registration to seperate package
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-06-22 17:38:41 -07:00
Kazuyoshi Kato
f91616e45e Copy FuzzConvertManifest from cncf/cncf-fuzzing
This test is one of the noisiest and should be moved from
cncf/cncf-fuzzing first.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-06-20 23:34:23 +00:00
Kazuyoshi Kato
4ec6a379c0
Merge pull request #6918 from dcantah/windows-snapshotter-cleanup
Windows snapshotter touch ups and new functionality
2022-06-10 11:08:18 -07:00
Akihiro Suda
c3fb7dfa7f
go.mod: github.com/moby/sys/mountinfo v0.6.2
https://github.com/moby/sys/compare/mountinfo/v0.6.0...mountinfo/v0.6.2

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-06-08 13:25:08 +09:00
Kazuyoshi Kato
0532f666f6
Merge pull request #7027 from AkihiroSuda/containerd-cgroup-1.0.4
go.mod: github.com/containerd/cgroups v1.0.4
2022-06-07 20:10:33 -07:00
Akihiro Suda
5a6e4144ac
go.mod: github.com/containerd/cgroups v1.0.4
https://github.com/containerd/cgroups/compare/v1.0.3...v1.0.4

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-06-07 17:15:21 +09:00
Akihiro Suda
088c8df3ac
go.mod: github.com/containerd/continuity v0.3.0
https://github.com/containerd/continuity/compare/v0.2.2...v0.3.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-06-07 17:14:08 +09:00
Daniel Canter
44e12dc5d8 Windows snapshotter touch ups and new functionality
This change does a couple things to remove some cruft/unused functionality
in the Windows snapshotter, as well as add a way to specify the rootfs
size in bytes for a Windows container via a new field added in the CRI api in
k8s 1.24. Setting the rootfs/scratch volume size was assumed to be working
prior to this but turns out not to be the case.

Previously I'd added a change to pass any annotations in the containerd
snapshot form (containerd.io/snapshot/*) as labels for the containers
rootfs snapshot. This was added as a means for a client to be able to provide
containerd.io/snapshot/io.microsoft.container.storage.rootfs.size-gb as an
annotation and have that be translated to a label and ultimately set the
size for the scratch volume in Windows. However, this actually only worked if
interfacing with the CRI api directly (crictl) as Kubernetes itself will
fail to validate annotations that if split by "/" end up with > 2 parts,
which the snapshot labels will (containerd.io / snapshot / foobarbaz).

With this in mind, passing the annotations and filtering to
containerd.io/snapshot/* is moot, so I've removed this code in favor of
a new `snapshotterOpts()` function that will return platform specific
snapshotter options if ones exist. Now on Windows we can just check if
RootfsSizeInBytes is set on the WindowsContainerResources struct and
then return a snapshotter option that sets the right label.

So all in all this change:
- Gets rid of code to pass CRI annotations as labels down to snapshotters.

- Gets rid of the functionality to create a 1GB sized scratch disk if
the client provided a size < 20GB. This code is not used currently and
has a few logical shortcomings as it won't be able to create the disk
if a container is already running and using the same base layer. WCIFS
(driver that handles the unioning of windows container layers together)
holds open handles to some files that we need to delete to create the
1GB scratch disk is the underlying problem.

- Deprecates the containerd.io/snapshot/io.microsoft.container.storage.rootfs.size-gb
label in favor of a new containerd.io/snapshot/windows/rootfs.sizebytes label.
The previous label/annotation wasn't being used by us, and from a cursory
github search wasn't being used by anyone else either. Now that there is a CRI
field to specify the size, this should just be a field that users can set
on their pod specs and don't need to concern themselves with what it eventually
gets translated to, but non-CRI clients can still use the new label/deprecated
label as usual.

- Add test to cri integration suite to validate expanding the rootfs size.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-06-06 14:57:07 -07:00