Commit Graph

13124 Commits

Author SHA1 Message Date
Tonis Tiigi
aa8b094ab1
platforms: clarify docs for amd64/arm64 variant normalization
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-08-01 11:25:58 +03:00
Wang Xinwen
710d987d29
Fix default platform matcher when ctr import
Signed-off-by: Wang Xinwen <wxw0504@outlook.com>
2023-07-31 22:17:25 +08:00
Fu Wei
40f26543bd
Merge pull request #8885 from kinvolk/rata/runc-abs-path
cri: Don't use rel path for image volumes
2023-07-31 21:10:20 +08:00
Rodrigo Campos
2d64ab8d79 cri: Don't use rel path for image volumes
Runc 1.1 throws a warning when using rel destination paths, and runc 1.2
is planning to thow an error (i.e. won't start the container).

Let's just make this an abs path in the only place it might not be: the
mounts created due to `VOLUME` directives in the Dockerfile.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2023-07-31 12:33:54 +02:00
Sebastiaan van Stijn
85a2c9a01b
log: swap logrus functions with their equivalent on default logger
[`logrus.SetLevel()`][1], [`logrus.GetLevel()`][2] and [`logrus.SetFormatter()`][3]
are all convenience functions to configure logrus' standardlogger, which is the
logger to which we hold a reference in the Entry configured on [`log.L`][4].

This patch:

- swaps calls to `logrus.SetLevel`, `logrus.GetLevel` and `logrus.SetFormatter`
  for their equivalents on `log.L`. This makes it clearer what `SetLevel` does,
  and makes sure that we set the log-level of the logger / entry we define in
  our package (even if that would be swapped with a different instance).
- removes the use of `logrus.NewEntry` with directly constructing a `Entry`,
  using the local `Entry` alias (anticipating we can swap that type in future).

[1]: dd1b4c2e81/exported.go (L34C1-L37)
[2]: dd1b4c2e81/exported.go (L39-L42)
[3]: dd1b4c2e81/exported.go (L23-L26)
[4]: dd1b4c2e81/exported.go (L9-L16)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 23:21:33 +02:00
Sebastiaan van Stijn
6baff1694f
log: add package documentation and summary of package's purpose
Add a package doc to (try to) describe the purpose of this package, and
to describe the purpose (and expectations) of aliases provided by the
package.

> Package log provides types and functions related to logging, passing
> loggers through a context, and attaching context to the logger.
>
> # Transitional types
>
> This package contains various types that are aliases for types in [logrus].
> These aliases are intended for transitioning away from hard-coding logrus
> as logging implementation. Consumers of this package are encouraged to use
> the type-aliases from this package instead of directly using their logrus
> equivalent.
>
> The intent is to replace these aliases with locally defined types and
> interfaces once all consumers are no longer directly importing logrus
> types.
>
> IMPORTANT: due to the transitional purpose of this package, it is not
> guaranteed for the full logrus API to be provided in the future. As
> outlined, these aliases are provided as a step to transition away from
> a specific implementation which, as a result, exposes the full logrus API.
> While no decisions have been made on the ultimate design and interface
> provided by this package, we do not expect carrying "less common" features.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:55:37 +02:00
Sebastiaan van Stijn
238da2c525
log: make Fields type a generic map[string]any
Decouple it from logrus, but with the same type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:55:37 +02:00
Sebastiaan van Stijn
634a4a1bbf
log: add log.Entry type
Don't return logrus types from exported functions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:55:30 +02:00
Sebastiaan van Stijn
dd67240f1b
log: define OutputFormat type
Strong-type the format.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:36:00 +02:00
Sebastiaan van Stijn
778ac302b2
log: define G() as a function instead of a variable
The `G` variable is exported, and not expected to be overwritten
externally. Defining it as a function also documents it as a function
on https://pkg.go.dev, instead of a variable; https://pkg.go.dev/github.com/containerd/containerd@v1.6.22/log#pkg-variables

Note that (while the godoc suggests otherwise) I made `GetLogger` an alias
for `G`, as `G` is the most commonly used function (not the other way round),
although I don't think there's a performance gain in doing so.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:35:59 +02:00
Sebastiaan van Stijn
81ac648d91
log: add all log-levels that are accepted
While other log-levels are not currently used in containerd itself,
they can be returned by `GetLevel()`, and are accepted (no error) by
`SetLevel()`. We should either accept those values, or produce an
error (in `SetLevel()`), but given that there's other ways to set the
log-level, we should probably acknowledge that this package is a transitional
package, and still closely tied to logrus (for the time being).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:35:59 +02:00
Sebastiaan van Stijn
0b6333a412
log: group "enum" consts and touch-up docs
Also updated the level descriptions with their documentation from
logrus.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:35:59 +02:00
Sebastiaan van Stijn
4a36022e20
log: WithLogger: remove redundant intermediate var
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:35:59 +02:00
Sebastiaan van Stijn
40ee5fb11b
log: SetFormat: include returns in switch
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:35:59 +02:00
Sebastiaan van Stijn
6fe7e03b80
log: remove testify dependency
Testify was only used for a basic assertion. Remove the dependency,
in preparation of (potentially) moving this package to a separate
module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:35:59 +02:00
Sebastiaan van Stijn
e2ad5a985e
removes/docker: remove unnecessary conversion (unconvert)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-30 22:35:31 +02:00
Markus Lehtonen
ed47d6ba76 cri: implement RuntimeConfig rpc
The rpc only reports one field, i.e. the cgroup driver, to kubelet.
Containerd determines the effective cgroup driver by looking at all
runtime handlers, starting from the default runtime handler (the rest in
alphabetical order), and returning the cgroup driver setting of the
first runtime handler that supports one. If no runtime handler supports
cgroup driver (i.e. has a config option for it) containerd falls back to
auto-detection, returning systemd if systemd is running and cgroupfs
otherwise.

This patch implements the CRI server side of Kubernetes KEP-4033:
https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/4033-group-driver-detection-over-cri

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
2023-07-28 13:50:43 +03:00
Phil Estes
81895d22c9
Merge pull request #8867 from Iceber/pinned_image_label
cri: fix using the labels to pin image
2023-07-27 09:51:23 -04:00
Justin Chadwell
a1cdf60cb6 docker: add test to ensure not found error is returned by resolve
Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-07-26 11:33:50 +01:00
Justin Chadwell
b4814a29d4 docker: return most relevant error from docker resolution
Previously, we would return the first non-404 error from a host.

This is logical, however, it can result in confusing errors to the
user:

- e.g. we have an HTTP host, and an HTTPS host.

  If the image does not exist, we return "http: server gave HTTP
  response to HTTPS client". This is technically correct, however, the
  user is easily confused - the most relevant error in this case is the
  404 error.

- e.g. we have a broken HTTP host that returns 5XX errors, and a HTTP
  host with authentication.

  On the request for an image, we return the 5XX error directly.
  However, we have a host later on which returned an authentication
  error which is now hidden from the user.

Note: this *can* be resolved by changing the order of hosts passed in,
however this requires 1. knowing ahead of time which hosts are going to
return certain errors and 2. this is often not desirable, we'd prefer
to use HTTPS if it's available, and only then fallback to HTTP.

To resolve this, we assign each possible error during resolution a
"priority" that marks how far through the image resolution process a
host/path combo got. Then we return the error with the highest priority,
which is much more likely to be the most relevant error to the user.

The ranking of priority then is (from lowest to highest):
- Underlying transport errors (TLS, TCP, etc)
- 404 errors
- Other 4XX/5XX errors
- Manifest rejection (due to max size exceeded)

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-07-26 11:33:50 +01:00
Fu Wei
bdbcf96267
Merge pull request #8868 from AkihiroSuda/epoch-y2038
pkg/epoch: fix Y2038 on 32-bit hosts
2023-07-26 13:43:53 +08:00
Iceber Gu
7f7ba31b64 cri: fix using the pinned label to pin image
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-07-26 12:26:00 +08:00
Akihiro Suda
4807571352
pkg/epoch: fix Y2038 on 32-bit hosts
`strconv.Itoa(int(tm.Unix()))` rounds the time to 32-bit int on 32-bit hosts

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-26 13:17:39 +09:00
Fu Wei
8348a8cecb
Merge pull request #8862 from borg-land/change-buckets
Migrate to community bucket for node e2e tests
2023-07-26 12:15:57 +08:00
Mahamed Ali
98974117b3 migrate to community owned bucket
Signed-off-by: Mahamed Ali <cy@borg.dev>
2023-07-25 12:09:54 +03:00
Justin Chadwell
a3404ac422 docker: add missing info log for 4XX/5XX responses
Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-07-24 15:28:37 +01:00
Markus Lehtonen
850b2e1bf3 go.mod: update cri-api to v1.28.0-beta.0
Required to support upcoming Kubernetes (v1.28) features.

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
2023-07-24 14:49:14 +03:00
Fu Wei
6eb90a63e0
Merge pull request #8837 from anmaxvl/fix-ctr-images-check-quiet
fix: `ctr images check -q` outputs not unpacked images
2023-07-24 10:39:43 +08:00
Fu Wei
e587e45044
Merge pull request #8857 from mqasimsarfraz/qasim/fix-swap-limit
cri: memory.memsw.limit_in_bytes: no such file or directory
2023-07-24 09:54:52 +08:00
Fu Wei
7061cae60f
Merge pull request #8858 from AkihiroSuda/go-mod-20230723
go.mod: bump up
2023-07-24 09:52:05 +08:00
Fu Wei
5bab55c3f3
Merge pull request #8859 from AkihiroSuda/ci-ubuntu-22.04
.github/workflows/ci.yml: upgrade Ubuntu from 20.04 to 22.04
2023-07-24 09:51:42 +08:00
Akihiro Suda
480bc8a2be
.github/workflows/ci.yml: upgrade Ubuntu from 20.04 to 22.04
- `release.yml` continues to use Ubuntu 20.04 for glibc compatibility
- cgroup v1 is no longer tested with Ubuntu, but still tested with Rocky 8

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 18:49:02 +09:00
Akihiro Suda
bc96b9039a
go.mod: github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0
5330a85ea6...8075edf89b

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:08:01 +09:00
Akihiro Suda
da27408854
go.mod: google.golang.org/genproto v0.0.0-20230720185612-659f7aaaa771
ccb25ca9f1...659f7aaaa7

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:08:01 +09:00
Akihiro Suda
73dc13ad62
go.mod: github.com/urfave/cli/compare v1.22.14
https://github.com/urfave/cli/compare/v1.22.13...v1.22.14

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:08:00 +09:00
Akihiro Suda
1c4fc568b1
go.mod: github.com/prometheus/client_golang/compare v1.16.0
https://github.com/prometheus/client_golang/compare/v1.14.0...v1.16.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:08:00 +09:00
Akihiro Suda
68abb525a5
go.mod: github.com/minio/sha256-simd v1.0.1
https://github.com/minio/sha256-simd/compare/v1.0.0...v1.0.1

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:08:00 +09:00
Akihiro Suda
1f2216cc78
go.mod: github.com/klauspost/compress v1.16.7
https://github.com/imdario/mergo/compare/v0.3.13...v1.0.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:08:00 +09:00
Akihiro Suda
3c6ab04203
go.mod: dario.cat/mergo v1.0.0
https://github.com/imdario/mergo/compare/v0.3.13...v1.0.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:08:00 +09:00
Akihiro Suda
4bda0a69e2
go.mod: github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
https://github.com/grpc-ecosystem/go-grpc-middleware/compare/v1.3.0...v1.4.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:07:59 +09:00
Akihiro Suda
0f033b6125
go.mod: github.com/emicklei/go-restful/v3 v3.10.2
https://github.com/emicklei/go-restful/compare/v3.10.1...v3.10.2

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:07:59 +09:00
Akihiro Suda
90e050298c
go.mod: github.com/containernetworking/plugin v1.3.0
https://github.com/containernetworking/plugins/compare/v1.2.0...v1.3.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:07:59 +09:00
Akihiro Suda
0498acefb9
go.mod: github.com/.../container-device-interface v0.6.0
https://github.com/container-orchestrated-devices/container-device-interface/compare/v0.5.4...v0.6.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:07:59 +09:00
Akihiro Suda
74b8cb850a
go.mod: github.com/opencontainers/runc v1.1.8
https://github.com/opencontainers/runc/compare/v1.1.7...v1.1.8

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:07:59 +09:00
Akihiro Suda
895dd2e93b
go.mod: github.com/opencontainers/image-spec v1.1.0-rc4
https://github.com/opencontainers/image-spec/compare/v1.1.0-rc3...v1.1.0-rc4

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:07:58 +09:00
Akihiro Suda
235a4452df
go.mod: github.com/opencontainers/runtime-spec v1.1.0
https://github.com/opencontainers/runtime-spec/compare/v1.1.0-rc.2...v1.1.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-07-23 03:07:58 +09:00
Fu Wei
59959b31ff
Merge pull request #8852 from bpfoster/issue-8851
Fix ro mount option being passed
2023-07-21 21:14:48 +08:00
Qasim Sarfraz
06f18c69d2 cri: memory.memsw.limit_in_bytes: no such file or directory
If kubelet passes the swap limit (default memory limit = swap limit ),
it is configured for container irrespective if the node supports swap.

Signed-off-by: Qasim Sarfraz <qasimsarfraz@microsoft.com>
2023-07-21 14:43:33 +02:00
Ben Foster
f3daf32c73 Fix ro mount option being passed
"ro" was not parsed out of the string, so it was passed as part of data
to mount().
This would lead to mount() returning an invalid argument code.
Separate out the "ro" option, much like "userxattr", which will allow
the MS-RDONLY mountflag to get set.

Signed-off-by: Ben Foster <bpfoster@gmail.com>
2023-07-20 17:08:01 -04:00
Maksym Pavlenko
4d2c887990
Merge pull request #8841 from thaJeztah/bump_runc_binary_1.1.8
update runc binary to v1.1.8
2023-07-19 12:53:55 -07:00