Commit Graph

488 Commits

Author SHA1 Message Date
Derek McGowan
4e5693938f
Add platform config to proxy plugins
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-04-19 17:48:04 -07:00
Derek McGowan
3784c1c917
Add proxy differ
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-04-15 22:37:23 -07:00
Akihiro Suda
a4d33a7848
Remove support for config.toml version = 1
`version = 1` has been deprecated since containerd v1.5,
and replaced by `version = 2`.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-03-16 10:32:33 +09:00
Maksym Pavlenko
07c2ae12e1 Remove v1 runctypes
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-03-15 09:18:16 -07:00
Fu Wei
8cb00f45c9
Merge pull request #8143 from mxpv/log
Add Fields type alias to log package
2023-02-21 10:22:23 +08:00
Maksym Pavlenko
06e085c8b5 Add Fields type alias to log package
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-02-20 17:29:08 -08:00
Zhang Tianyang
56274749c8 sandbox: start sandbox with options
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2023-02-17 17:14:03 +08:00
Zechun Chen
39bac0dbef error strings should not be capitalized
Signed-off-by: Zechun Chen <zechun.chen@daocloud.io>
2023-02-15 14:30:36 +08:00
Fu Wei
2654ece1d0
Merge pull request #8066 from fuweid/cleanup-blockio-init
*: introduce wrapper pkgs for blockio and rdt
2023-02-13 14:05:32 +08:00
Akihiro Suda
b61988670c
go.mod: github.com/containerd/typeurl/v2 v2.1.0
Changes: https://github.com/containerd/typeurl/compare/7f6e6d160d67...v2.1.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-02-11 23:39:52 +09:00
Wei Fu
62df35df66 *: introduce wrapper pkgs for blockio and rdt
Before this patch, both the RdtEnabled and BlockIOEnabled are provided
by services/tasks pkg. Since the services/tasks can be pkg plugin which
can be initialized multiple times or concurrently. It will fire data-race
issue as there is no mutex to protect `enable`.

This patch is aimed to provide wrapper pkgs to use intel/{blockio,rdt}
safely.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-02-10 08:21:34 +08:00
Derek McGowan
34314717b0
Remove sandox store and controller service type
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-02-06 22:05:26 -08:00
Derek McGowan
a788f6c799
Move local sandbox controller under plugins package
Add options to sandbox controller interface.
Update sandbox controller interface to fully utilize sandbox controller
interface.
Move grpc error conversion to service.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-02-06 22:04:45 -08:00
Derek McGowan
2717685dad
Refactor sandbox controller interface
Update the sandbox controller interface to use local types rather than
using the API types.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-02-06 21:39:30 -08:00
Maksym Pavlenko
86c238c873 Generate GRPC for runtime sandbox API
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-02-02 09:58:43 -08:00
Edgar Lee
34d5878185 Use mount.Target to specify subdirectory of rootfs mount
- Add Target to mount.Mount.
- Add UnmountMounts to unmount a list of mounts in reverse order.
- Add UnmountRecursive to unmount deepest mount first for a given target, using
moby/sys/mountinfo.

Signed-off-by: Edgar Lee <edgarhinshunlee@gmail.com>
2023-01-27 09:51:58 +08:00
Derek McGowan
beabd3d5d1
Merge pull request #7129 from junnplus/namespace-service
fix incorrect namespace of event when create/update namespace
2023-01-19 22:49:28 -08:00
Maksym Pavlenko
f318e5630b Update sandbox API to return target platform
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-01-11 13:03:59 -08:00
Phil Estes
72e5ddb516
Merge pull request #7886 from dmcgowan/fix-transfer-register-ordering
Fix race between stream registration and use
2023-01-04 14:49:28 -05:00
Akihiro Suda
24a255ce96
Merge pull request #7850 from dmcgowan/sandbox-store-local-plugin
[sandbox] Add sandbox store plugin type
2023-01-04 00:21:06 +09:00
Fu Wei
9a7c264d25
Merge pull request #5674 from dmcgowan/metadata-snapshot-publish 2023-01-03 09:23:48 +08:00
Derek McGowan
d7ef6cbfa3
[streaming] move response packet after registration
Prevent a race where a client may attempt to use a stream
before it is registered.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-12-30 21:56:25 -08:00
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
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
Derek McGowan
2c573de6d3
Move snapshot event publishing into metadata store
Removes the snapshot event publishing from the snapshot service.

Adds an option to metadata db to add a publisher. Adds event
publishing to prepare, commit, and remove snapshot operations.
Adds remove snapshot event to garbage collection.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-12-19 17:05:28 -08:00
Fu Wei
12f30e6524
Merge pull request #7792 from mxpv/sb-shutdown 2022-12-15 13:37:35 +08:00
Maksym Pavlenko
a4d5c3e5cb Support sandboxed shims shutdown
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-12-14 18:22:52 -08:00
Akihiro Suda
75b09ac4a7
images: support specifying SourceDateEpoch via ctx
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-12-12 09:02:35 +09:00
Maksym Pavlenko
a113737ccf sbserver bug fixing
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-12-06 15:32:42 -08:00
Derek McGowan
8a25fa584f
Unwrap proto errors in streaming client
Allows clients to properly detect context cancellation

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-12-02 22:30:54 -08: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
f88162587b
Rename transferer to transferrer
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 16:02:09 -08:00
Derek McGowan
fc2754204f
Cleanup code comments and lint fixes
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 16:02:09 -08:00
Derek McGowan
6b5df1ee16
Update transfer packages
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:54 -08:00
Derek McGowan
6f64cb8598
Transfer interface and plugin work in progress
Signed-off-by: Derek McGowan <derek@mcg.dev>

Transfer service implementation

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:50 -08:00
Derek McGowan
dcf5687cab
Add streaming service
Adds a service capable of streaming Any objects bi-directionally.
This can be used by services to send data, received data, or to
initiate requests from server to client.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:55:56 -08:00
Derek McGowan
6f7ed272e8
Merge pull request #7694 from AkihiroSuda/introspection-pid
introspection: expose the daemon's PID and PIDNS
2022-11-29 11:41:14 -08:00
Maksym Pavlenko
a6d1d53cc2 [sandbox] Update Controller.Status protos
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-11-28 10:13:37 -08:00
Maksym Pavlenko
3f331e7d13 Specify runtime configuration for sandbox shims
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-11-22 17:39:27 -08:00
Akihiro Suda
661aaae3bb
introspection: expose the daemon's PID and PIDNS
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-11-18 17:14:26 +09: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
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
Sebastiaan van Stijn
f90219d472
services/server/config: TestMergeConfigs(): use correctly formatted values
This updates the test to:

- Use correctly formatted values for RequiredPlugins and DisabledPlugins (values
  are expected to have a `io.containerd.` prefix). While not needed for the test
  to pass (no validation is performed), it's good to have these values in the
  correct format (in case we want to add validation at this stage).
- Set a `Version` for both (as version 1 / no version was deprecated)

The `Version` field in this test was used to verify the "integer override"
behavior; setting "Version: 2" for both would no longer cover that case. As there
are only 2 integer fields in the config (Version and OOMScore) and OOMScore was
already used in the test, I added separate test-cases for that.

Looking at the test, we should consider what we want the behaviour to be if the
override file does not specify a version (implicitly: version 1), or if the version
is different from the original one; do we want mergeConfig() to produce an error
when merging a v2 config with a v1 config (or v3 with v2)?

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 10:01:28 +01:00
Maksym Pavlenko
b7d0d12715 Cleanup sandbox interfaces
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-10-25 12:31:32 -04:00
Sebastiaan van Stijn
3ebeb6d79b
linting: address gosec G112/G114
GOGC=75 golangci-lint run
    services/server/server.go:320:27: G114: Use of net/http serve function that has no support for setting timeouts (gosec)
        return trapClosedConnErr(http.Serve(l, m))
                                 ^
    services/server/server.go:340:27: G114: Use of net/http serve function that has no support for setting timeouts (gosec)
        return trapClosedConnErr(http.Serve(l, m))
                                 ^
    cmd/containerd-stress/main.go:238:13: G114: Use of net/http serve function that has no support for setting timeouts (gosec)
            if err := http.ListenAndServe(c.Metrics, metrics.Handler()); err != nil {
                      ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-12 14:40:11 +02:00
Akihiro Suda
70fbedc217
archive: add WithSourceDateEpoch() for whiteouts
This makes diff archives to be reproducible.

The value is expected to be passed from CLI applications via the $SOUCE_DATE_EPOCH env var.

See https://reproducible-builds.org/docs/source-date-epoch/
for the $SOURCE_DATE_EPOCH specification.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-10-08 08:45:03 +09:00
Daniel Canter
4333e6a6d6 Swap to net.ErrClosed checks for services
In Go 1.16 `net.ErrClosed` was exported, removing the need to check the
exact text of "use of closed network connection". The stdlib's net listeners
are all setup for this to be a reality, but on Windows containerd uses the
the go-winio projects named pipe implementation as the listener for services.
Before version 0.6.0 this project returned a different error named
`ErrPipeListenerClosed` for using a closed pipe, where this error was just
an `errors.New` with the same text as `net.ErrClosed`, so checking against
`net.ErrClosed` wasn't possible.

Starting in 0.6.0 go-winio has that error assigned to `net.ErrClosed` directly
so this *should* be alright to finally change.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-09-28 18:20:12 -07:00
zounengren
344b25995b delete redundent import alias and and type conversion
Signed-off-by: zounengren <zouyee1989@gmail.com>
2022-08-31 21:36:24 +08:00
Maksym Pavlenko
ff65fc2d0e Make TaskList generic
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-08-10 14:02:53 -07:00
Maksym Pavlenko
aa3303b697 Update sandbox protobuf to match CRI
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-07-29 16:08:07 -07:00