Commit Graph

11497 Commits

Author SHA1 Message Date
Samuel Karp
6948d89e56
Merge pull request #7625 from AdamKorcz/fuzz2 2022-11-09 17:45:58 -08:00
AdamKorcz
b742aa2e77 fuzzing: bump go-fuzz-headers
Signed-off-by: AdamKorcz <adam@adalogics.com>
2022-11-09 14:30:30 +00:00
Shiming Zhang
91e295d766 Add --debug args
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2022-11-09 17:43:53 +08:00
rongfu.leng
0f54c47401 feat add sandbox api status func
Signed-off-by: rongfu.leng <rongfu.leng@daocloud.io>
2022-11-09 14:36:46 +08:00
Zhang Tianyang
c953eecb79 Sandbox API: Add a new mode config for sandbox controller impls
Add a new config as sandbox controller mod, which can be either
"podsandbox" or "shim". If empty, set it to default "podsandbox"
when CRI plugin inits.

Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-11-09 12:12:39 +08:00
Kazuyoshi Kato
d4b3b54540
Merge pull request #7637 from lucacome/bump-k8s-deps
Bump k8s.io deps to v0.25.3
2022-11-08 10:13:53 -08:00
Kazuyoshi Kato
3fd52c852f
Merge pull request #7641 from thaJeztah/fix_usage_of_deprecated_funcs
Remove uses of deprecated go-digest.NewDigestFromHex, go-digest.Digest.Hex
2022-11-08 10:13:13 -08:00
Phil Estes
b850554be2
Merge pull request #7640 from nikitar/main
Extra documentation for content interfaces
2022-11-08 11:50:22 -05:00
Maksym Pavlenko
530c675841
Merge pull request #7638 from mxpv/perm
Fix shim socket permissions on Darwin
2022-11-08 07:34:02 -08:00
Merlin Ran
99ac7a7714
add oci.WithCPURT
to set realtime scheduling options.

Signed-off-by: Merlin Ran <merlinran@gmail.com>
2022-11-08 09:39:27 -05:00
Sebastiaan van Stijn
717aa5929d
Remove uses of deprecated go-digest.NewDigestFromHex, go-digest.Digest.Hex
Both of these were deprecated in 55f675811a,
but the format of the GoDoc comments didn't follow the correct format, which
caused them not being picked up by tools as "deprecated".

This patch updates uses in the codebase to use the alternatives.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-08 14:47:05 +01:00
Maksym Pavlenko
3a9044f240 Rename darwin-kubelet to containerd
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-11-07 22:58:25 -08:00
Nikita Rybak
5f48e00af1 Extra documentation for content interfaces.
Fixes: #7305

Signed-off-by: Nikita Rybak <nikita.rybak@gmail.com>
2022-11-08 15:55:39 +11: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
Derek McGowan
d1564fec5b
Merge pull request #7614 from huoqifeng/s390x
s390x: build and package s390x bin in release assets
2022-11-07 12:08:43 -08:00
Derek McGowan
816f7086bd
Merge pull request #7513 from cpuguy83/nix_mount_fork
Replace mount fork hack with CLONE_FS
2022-11-07 09:35:40 -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
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
Antonio Ojea
4866d8ba43
registry: support ipv6 addresses
Current registry reference use a subset of dns and IPv4 addresses to
represent a registry domain.

Since registries are mostly compatible with rfc3986, that defines the
URI generic syntax, this adds support for IPv6 enclosed in squared
brackets based on the mentioned rfc.

The regexp is only expanded to match on IPv6 addreses enclosed between
square brackets, considering only regular IPv6 addresses represented
as compressed or uncompressed, excluding special IPv6 address
representations.

Signed-off-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 00:39:01 +01:00
Paul Cacheux
8bec2b6529
Replace references to re with regexp.MustCompile
Signed-off-by: Paul Cacheux <paul.cacheux@datadoghq.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 00:38:54 +01:00
Paul Cacheux
5c510e47a2
Improve how reference regexps are built
Previous implementation was doing a lot of string -> regexp -> string
conversions

Signed-off-by: Paul Cacheux <paul.cacheux@datadoghq.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 00:38:46 +01:00
Dave
98ff272654
Clarify repo name regex intention
Add context to comment to explain the repo name regex in addition to describing it.

Signed-off-by: David Warshaw <david.warshaw@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 00:38:39 +01:00
Sebastiaan van Stijn
2a8a53178c
go.mod: change imports to github.com/distribution/distribution/v3
Go 1.13 and up enforce import paths to be versioned if a project
contains a go.mod and has released v2 or up.

The current v2.x branches (and releases) do not yet have a go.mod,
and therefore are still allowed to be imported with a non-versioned
import path (go modules add a `+incompatible` annotation in that case).

However, now that this project has a `go.mod` file, incompatible
import paths will not be accepted by go modules, and attempting
to use code from this repository will fail.

This patch uses `v3` for the import-paths (not `v2`), because changing
import paths itself is a breaking change, which means that  the
next release should increment the "major" version to comply with
SemVer (as go modules dictate).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 00:38:37 +01:00
Chuanying Du
a97eb69556
Update repo normalize error message to include the name of the repo.
Signed-off-by: Chuanying Du <cydu@google.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 00:38:32 +01:00
Aviral Takkar
b979f00692
Fix bug in parsing domain from repository reference
Signed-off-by: Aviral Takkar <aviral26@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 00:38:24 +01:00
Sebastiaan van Stijn
f966602867
reference/docker: add unit-tests from upstream distribution/distribution
This copies the unit-tests from the distribution repository from the time when
the package was forked. The tests are copied from this commit:
0d3efadf01

Tests for ParseAnyReferenceWithSet() have been removed, as that function has not
been included in the containerd fork.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 00:17:31 +01:00
Sebastiaan van Stijn
7de88c5ba3
reference/docker: align files with original code
This package was forked from the https://github.com/distribution/distribution
repository in commit 901bcb2231, but that commit
did a plain copy of the code (minus tests), and rewrote the code to be in a
single file. The same commit also removed some deprecated code for handling
"shortid" references (ParseAnyReferenceWithSet() function), in order to avoid
the "digestset" dependency from the distribution repo.

At the time, containerd used the distribution/distribution package from this
commit: 0d3efadf01

Since the code was forked, both containerd and distribution have received
improvements and fixes, so unfortunately, the code started to diverge.

I'm planning to reconcile the packages (potentially by using a shared module),
and this is the first commit to assist with that.

This patch restructures the reference/docker package to split the code into the
same files as are used in the upstream distribution/distribution repository.
This makes it easier to compare the implementations in both repositories (to
allow synchronizing changes).

No changes are applied yet, other than splitting the code (follow-up commits
will take care of syncing changes across).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-06 23:13:27 +01:00
Derek McGowan
31bb8fef7e
Merge pull request #7460 from AkihiroSuda/fetch-by-digest
remotes: add `FetcherByDigest` for fetching blobs without foreknown descriptors (useful for general-purpose CAS)
2022-11-04 15:20:29 -07:00
Kazuyoshi Kato
88dc30af12
Merge pull request #7403 from kit-ty-kate/freebsd-arm64
Fix "getCPUInfo for OS freebsd: not implemented" on FreeBSD/arm64
2022-11-04 10:22:30 -07:00
Kazuyoshi Kato
e306680f44
Merge pull request #7607 from jess-sol/main
Support default hosts.toml configuration
2022-11-04 10:22:00 -07:00
Kate
f32595a0c2 Fix "getCPUInfo for OS freebsd: not implemented" on FreeBSD/arm64
Signed-off-by: Kate <kit.ty.kate@disroot.org>
2022-11-04 12:31:03 +00:00
Maksym Pavlenko
b2a01eedf4
Merge pull request #7453 from swagatbora90/trace-cri-image
Add tracing spans in CRI image service and pull.go
2022-11-03 20:57:17 -07:00
Maksym Pavlenko
525fe21e22
Merge pull request #7604 from wzshiming/fix/close-fifo
Fix missing closed fifo
2022-11-03 20:55:28 -07:00
Maksym Pavlenko
9a5430dbee
Merge pull request #7624 from yzxiu/fix-comments
fix comments
2022-11-03 20:54:13 -07:00
Akihiro Suda
11a06c1a3d
ctr: add ctr content fetch-blob
e.g., `ctr content fetch-blob docker.io/library/debian:latest sha256:43d28810c1b4c28a1be3bac8e0e40fcc472b2bfcfcda952544ed99cb874d2b1a`

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-11-04 11:41:11 +09:00
Akihiro Suda
dfd6a3aa6e
remotes: add FetcherByDigest for fetching blobs without foreknown descriptors
Fetching blobs without foreknown descriptors is useful for using a registry as a general-purpose CAS.

Related: `oras blob fetch` (ORAS v0.15.0)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-11-04 11:41:07 +09:00
Shiming Zhang
c607f83c38 Fix missing closed fifo
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2022-11-04 10:13:47 +08:00
Brian Goff
a24ef09937 Replace mount fork hack with CLONE_FS
This change spins up a new goroutine, locks it to a thread, then
unshares CLONE_FS which allows us to `Chdir` from inside the thread
without affecting the rest of the program.

The thread is no longer usable after unshare so it leaves the thread
locked to prevent go from returning the thread to the thread pool.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2022-11-03 22:30:35 +00:00
Jess
8b1b81eefd Update hosts doc
Signed-off-by: Jess <jess@ros.io>
2022-11-03 16:26:59 -06:00
Jess
f0bf9e7f8b Support default hosts.toml configuration
Add support for an optional `default` registry hosts config, should no
other hosts config match.

Signed-off-by: Jess <jess@ros.io>
2022-11-03 16:26:51 -06:00
Kazuyoshi Kato
c21d1baa88
Merge pull request #7626 from akhilerm/update-cherry-pick-process
docs: add additional info in backport process
2022-11-03 13:56:14 -07:00
Gavin Inglis
81bbd9daca add option to resolve symlinks to linux device
This change modifies WithLinuxDevice to take an option `followSymlink`
and be unexported as `withLinuxDevice`. An option
`WithLinuxDeviceFollowSymlinks` will call this unexported option to
follow a symlink, which will resolve a symlink before calling
`DeviceFromPath`. `WithLinuxDevice` has been changed to call
`withLinuxDevice` without following symlinks.

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
2022-11-03 20:23:25 +00:00
Swagat Bora
ee64926a72 add SpanAttribute
Signed-off-by: Swagat Bora <sbora@amazon.com>
2022-11-03 18:34:06 +00:00
Akhil Mohan
2d9f0f2fbd
add additional info in backport process
add information in backporting process related to cherry-picking
main PR and related fixes

Signed-off-by: Akhil Mohan <makhil@vmware.com>
2022-11-03 23:50:39 +05:30
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
Kazuyoshi Kato
bb0c3804c6
Merge pull request #7621 from AkihiroSuda/go-mod-sys-v0.1.0
go.mod: golang.org/x/*: use tagged versions
2022-11-03 08:58:21 -07:00
yaozhenxiu
902b96cf25 fix comments
Signed-off-by: yaozhenxiu <946666800@qq.com>
2022-11-03 22:52:41 +08: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
Kazuyoshi Kato
4e3d7e0aba
Merge pull request #7620 from cpuguy83/bump_go
Bump go version to 1.19.3
2022-11-02 15:41:41 -07:00
Derek McGowan
49f96d8f7d
Merge pull request #7615 from turan18/export-bug
ctr export strictly matching
2022-11-02 14:36:56 -07:00