Commit Graph

14496 Commits

Author SHA1 Message Date
Fu Wei
165f8e414e
Merge pull request #8928 from oss-qm/submit/makefile-fix-go-command 2023-08-08 05:31:48 +08:00
Derek McGowan
720e027a97
Merge pull request #8917 from amghazanfari/main
delete checkout branch in doc
2023-08-07 14:09:09 -07:00
Phil Estes
649f356656
Merge pull request #8427 from AkihiroSuda/fedora38
CI: update Fedora to 38
2023-08-07 15:41:49 -04:00
Akihiro Suda
0a57dc2a02
CI: update Fedora to 38
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-08-08 03:15:44 +09:00
Akihiro Suda
30dd0a17f2
CI: install Vagrant from Hashicorp
Canonical's Vagrant 2.2.19 dpkg cannot download Fedora 38 image:
https://bugs.launchpad.net/vagrant/+bug/2017828

So we have to install Vagrant >= 2.3.1 from the upstream:
https://github.com/opencontainers/runc/blob/v1.1.8/.cirrus.yml#L41-L49

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-08-08 03:15:44 +09:00
Phil Estes
7688c4d008
Merge pull request #8929 from oss-qm/submit/makefile-override-revision
Makefile: allow REVISION be overwritten by environment
2023-08-07 14:07:43 -04:00
Akihiro Suda
ce22387b8f
Merge pull request #8919 from AkihiroSuda/vagrant-on-gha-larger
CI: move Vagrant tests to GitHub Actions (larger runners)
2023-08-08 01:07:12 +09:00
Enrico Weigelt, metux IT consult
965641dbc1 Makefile: allow REVISION be overwritten by environment
Required for distros that wanna use their local version and
can't have some (possibly failing) git commands being run here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2023-08-07 17:23:00 +02:00
Enrico Weigelt, metux IT consult
fc32197d43 Makefile: fix overriding go command
There still was one place that's calling the `go` command directly
instead of using the $(GO) variable.

Fixes: 9ea25634bd
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2023-08-07 17:21:47 +02:00
Akihiro Suda
2d3360ec71
CI: move Vagrant tests to GitHub Actions (larger runners)
We have been using Cirrus CI for running vagrant workloads
as the standard runners of GHA lacks nested virtualization,
but it looks like GHA with the "larger" runners support nested
virtualization.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-08-07 01:24:55 +09:00
rongfu.leng
4f3c8c4687 replace mcr.microsoft.com registry to ghcr.io/containerd registry
Signed-off-by: rongfu.leng <rongfu.leng@daocloud.io>
2023-08-06 21:14:07 +08:00
Wei Fu
d41c62a556 .github/workflows: add dmesg step for integration-linux
It will be easy to debug flaky testcase if we can provide kernel log by
`dmesg -T -f kern`.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-08-06 18:13:17 +08:00
Amir M. Ghazanfari
fd8778fba3
delete checkout branch in doc
branch "pr/proto/draft" in NRI doesn't exist anymore it's better to delete this line 

Signed-off-by: Amir M. Ghazanfari <a.m.ghazanfari76@gmail.com>
2023-08-04 22:46:33 +03:30
Fu Wei
2b2195c36b
Merge pull request #8722 from marquiz/devel/cgroup-driver-autoconfig
cri: implement RuntimeConfig rpc
2023-08-04 16:09:34 +08:00
Markus Lehtonen
c62abcb146 docs: document CRI cgroup driver auto detection
Document the user visible changes related to the new RuntimeConfig RPC.

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
2023-08-04 09:48:29 +03:00
Phil Estes
40c85d6c09
Merge pull request #8897 from kinvolk/rata/userns-use-platform
cri/sbserver: Use platform instead of GOOS for userns detection
2023-08-02 16:12:02 -04:00
Maksym Pavlenko
e12128cebc
Merge pull request #8899 from tonistiigi/arm64-norm-docs
platforms: clarify docs for amd64/arm64 variant normalization
2023-08-02 12:02:43 -07:00
Rodrigo Campos
c80a3ecafd cri/sbserver: Use platform instead of GOOS for userns detection
In the sbserver we should not use the GOOS, as windows hosts can run
linux containers. On the sbserver we should use the platform param.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2023-08-02 12:32:05 +02:00
Phil Estes
e0912c068b
Merge pull request #8904 from thaJeztah/update_go1.20.7
update to go1.20.7, go1.19.12
2023-08-01 21:38:09 -04:00
Sebastiaan van Stijn
157dff2812
update to go1.20.7, go1.19.12
Includes a fix for CVE-2023-29409

go1.20.7 (released 2023-08-01) includes a security fix to the crypto/tls
package, as well as bug fixes to the assembler and the compiler. See the
Go 1.20.7 milestone on our issue tracker for details:

- https://github.com/golang/go/issues?q=milestone%3AGo1.20.7+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.20.6...go1.20.7

go1.19.12 (released 2023-08-01) includes a security fix to the crypto/tls
package, as well as bug fixes to the assembler and the compiler. See the
Go 1.19.12 milestone on our issue tracker for details.

- https://github.com/golang/go/issues?q=milestone%3AGo1.19.12+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.19.11...go1.19.12

From the mailing list announcement:

[security] Go 1.20.7 and Go 1.19.12 are released

Hello gophers,

We have just released Go versions 1.20.7 and 1.19.12, minor point releases.

These minor releases include 1 security fixes following the security policy:

- crypto/tls: restrict RSA keys in certificates to <= 8192 bits

  Extremely large RSA keys in certificate chains can cause a client/server
  to expend significant CPU time verifying signatures. Limit this by
  restricting the size of RSA keys transmitted during handshakes to <=
  8192 bits.

  Based on a survey of publicly trusted RSA keys, there are currently only
  three certificates in circulation with keys larger than this, and all
  three appear to be test certificates that are not actively deployed. It
  is possible there are larger keys in use in private PKIs, but we target
  the web PKI, so causing breakage here in the interests of increasing the
  default safety of users of crypto/tls seems reasonable.

  Thanks to Mateusz Poliwczak for reporting this issue.

View the release notes for more information:
https://go.dev/doc/devel/release#go1.20.7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-01 23:57:32 +02:00
Phil Estes
9214c6403e
Merge pull request #8316 from davidhsingyuchen/partial-attach
fix: allow attaching to any combination of stdin/stdout/stderr
2023-08-01 14:47:53 -04:00
Hsing-Yu (David) Chen
687a5f51a8 fix: allow attaching to any combination of stdin/stdout/stderr
Before this PR, if a stdin/stdout/stderr stream is nil,
and the corresponding FIFO is not an empty string,
a panic will occur when Read/Write of the nil stream is invoked in io.CopyBuffer.

Signed-off-by: Hsing-Yu (David) Chen <davidhsingyuchen@gmail.com>
2023-08-01 09:56:04 -07:00
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