Commit Graph

11497 Commits

Author SHA1 Message Date
Phil Estes
9f6947f672
Merge pull request #7542 from aznashwan/makefile-gopath
Use `go env` to determine GOPATH in Makefile.
2022-10-17 09:46:25 -07:00
Phil Estes
47fa603e1c
Update required Go version in BUILDING.md
Our main branch no longer builds successfully with Go 1.17.

Signed-off-by: Phil Estes <estesp@amazon.com>
2022-10-17 12:45:12 -04: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
Kazuyoshi Kato
a76d68ee48 Separate containerd logs in GitHub Actions' console
`::group::` groups containerd logs by default.

https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-10-17 16:27:23 +00:00
Kazuyoshi Kato
e47bdbd16f Upgrade critools from 1.24.1 to 1.25.0
This version up will migrate critools off from Ginkgo 1.x which has been
deprecated.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-10-17 16:27:23 +00:00
Kazuyoshi Kato
878dbc7afa Upgrade actions/upload-artifact from v2 to v3
v2 uses Node.js 12.x which is EOL.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-10-17 16:27:23 +00:00
Mike Brown
3ce301ddee
Merge pull request #7349 from thaJeztah/gofmt_119
clean-up "nolint" comments, remove unused ones, update golangci-lint
2022-10-17 10:50:24 -05:00
Phil Estes
d7ea7de900
Merge pull request #7534 from mxpv/shim
Don't unmount on Darwin when deleting bundle
2022-10-17 08:27:05 -07:00
Phil Estes
738a15d3e7
Merge pull request #7538 from mxpv/timeouts
Add timeouts to all CI jobs
2022-10-17 07:03:57 -07:00
Nashwan Azhari
1982772029 Use go env to determine GOPATH in Makefile.
Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
2022-10-17 15:03:37 +03: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
972399538d
sys: synchronize mkdirall() with latest os.MkDirAll()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-17 00:55:37 +02:00
Sebastiaan van Stijn
063c5f9804
sys: create SecurityAttribute only once (Windows)
The same attribute was generated for each path that was created, but always
the same, so instead of generating it in each iteration, generate it once,
and pass it to our mkdirall() implementation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-17 00:55:37 +02:00
Sebastiaan van Stijn
a983599e2b
sys: update volumePath regex to allow returning earlier
The regex only matched volume paths without a trailing path-separator. In cases
where a path would be passed with a trailing path-separator, it would depend on
further code in mkdirall to strip the trailing slash, then to perform the regex
again in the next iteration.

While regexes aren't ideal, we're already executing this one, so we may as well
use it to match those situations as well (instead of executing it twice), to
allow us to return early.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-17 00:55:37 +02:00
Sebastiaan van Stijn
d422c87e44
sys: compile volume-path regex once, and update GoDoc
Ideally, we would construct this lazily, but adding a function and a
sync.Once felt like a bit "too much".

Also updated the GoDoc for some functions to better describe what they do.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-17 00:55:37 +02:00
Samuel Karp
8ee685662d
Merge pull request #7539 from AkihiroSuda/fix-rocky-ci
Vagrantfile: explicitly specify rsync as the shared folder driver
2022-10-16 13:38:06 -07:00
Akihiro Suda
691b4ea85f
Merge pull request #7527 from thaJeztah/remove_sys_isabs
sys: remove unused IsAbs() (windows)
2022-10-16 22:13:20 +09:00
Akihiro Suda
f8f0524828
Vagrantfile: explicitly specify rsync as the shared folder driver
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-10-16 21:44:59 +09:00
Maksym Pavlenko
4839f1bdff Add timeouts to all CI jobs
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-10-15 17:04:57 -07:00
Maksym Pavlenko
87b3eec2b2
Merge pull request #7535 from samuelkarp/ip-leakage-flake
cri: PodSandboxStatus should tolerate missing task
2022-10-15 16:51:46 -07:00
Samuel Karp
890398677e
cri: PodSandboxStatus should tolerate missing task
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2022-10-14 14:40:13 -07:00
Maksym Pavlenko
fb6a40dc9d Don't unmount on Darwin when deleting bundle
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-10-14 14:35:24 -07:00
Sebastiaan van Stijn
c7e6a889b8
sys: remove unused IsAbs() (windows)
This function was forked from Moby in 6089c1525b,
which copied the whole file, but the `IsAbs()` was never used, and has no
external consumers, so let's remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-14 10:41:23 +02:00
Kazuyoshi Kato
766e933151
Merge pull request #7489 from AkihiroSuda/switch-away-from-ubuntu-18.04
CI: update GHA instances from Ubuntu 18.04 to 20.04
2022-10-13 11:33:55 -07:00
Samuel Karp
6333c751ce
Merge pull request #7519 from Iceber/fix_flags 2022-10-13 11:21:17 -07:00
Kazuyoshi Kato
67ec7646d6
Merge pull request #7510 from zhuchenwang/main
Update the default seccomp to block socket calls to AF_VSOCK
2022-10-13 08:31:49 -07:00
Kazuyoshi Kato
0ba5b41da5
Merge pull request #7511 from thaJeztah/use_SetStdHandle
cmd/containerd: use golang.org/x/sys/windows.SetStdHandle()
2022-10-13 08:30:45 -07:00
Phil Estes
330df47c35
Merge pull request #7517 from kzys/stats-nil
Stats() shouldn't assume s.container is non-nil
2022-10-13 07:14:57 -07:00
Iceber Gu
48daccb4dd fix the --no-pivot flag being ignored by ctr tasks start
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2022-10-13 11:50:26 +08:00
Akihiro Suda
ea53e52fc0
CI: update GHA instances from Ubuntu 18.04 to 20.04
The release binaries are built using Ubuntu 18.04 in Docker on Ubuntu 20.04
for glibc compatibility reason (issue 7255).

Fix issue 7297

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-10-13 09:55:23 +09:00
Kazuyoshi Kato
49a54e23cb Stats() shouldn't assume s.container is non-nil
Like other exported methods, Stats() shouldn't assume s.container is
non-nil.

Fixes #7468.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-10-12 22:11:49 +00:00
Samuel Karp
271628971f
Merge pull request #7516 from estesp/deprecated-actions 2022-10-12 14:46:49 -07:00
Phil Estes
e7c8a5ab08
Move up actions versions to prep for deprecation
Signed-off-by: Phil Estes <estesp@amazon.com>
2022-10-12 15:17:27 -04:00
Sebastiaan van Stijn
752bff981a
cmd/containerd: use golang.org/x/sys/windows.SetStdHandle()
golang.org/x/sys/windows now implements this, so we can use that
instead of a local implementation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-12 19:33:34 +02:00
Phil Estes
8b804c4f81
Merge pull request #7512 from thaJeztah/use_SetRecoveryActions
cmd/containerd: use golang.org/x/sys Service.SetRecoveryActions()
2022-10-12 09:56:06 -07:00
Sebastiaan van Stijn
8b5df7d347
update golangci-lint to v1.49.0
Also remove "nolint" comments for deadcode, which is deprecated, and removed
from the defaults.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-12 14:41:01 +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
Sebastiaan van Stijn
d215725136
pkg/cri/(server|sbserver): criService.getTLSConfig() add TODO to verify nolint
This `//nolint`  was added in f5c7ac9272
to suppress warnings about the `NameToCertificate` function being deprecated:

    // Deprecated: NameToCertificate only allows associating a single certificate
    // with a given name. Leave that field nil to let the library select the first
    // compatible chain from Certificates.

Looking at that, it was deprecated in Go 1.14 through
eb93c684d4
(https://go-review.googlesource.com/c/go/+/205059), which describes:

    crypto/tls: select only compatible chains from Certificates

    Now that we have a full implementation of the logic to check certificate
    compatibility, we can let applications just list multiple chains in
    Certificates (for example, an RSA and an ECDSA one) and choose the most
    appropriate automatically.

    NameToCertificate only maps each name to one chain, so simply deprecate
    it, and while at it simplify its implementation by not stripping
    trailing dots from the SNI (which is specified not to have any, see RFC
    6066, Section 3) and by not supporting multi-level wildcards, which are
    not a thing in the WebPKI (and in crypto/x509).

We should at least have a comment describing why we are ignoring this, but preferably
review whether we should still use it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-12 14:40:11 +02:00
Sebastiaan van Stijn
0eaace3066
golangci-lint: sort linters in config file
THis makes it easier to find which linters are enabled when going through
the list.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-12 14:40:11 +02: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
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
Ed Bartosh
643dc16565 improve CDI logging
Added logging of found CDI devices.
Fixed test failures caused by the change.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2022-10-12 13:45:20 +03:00
Ed Bartosh
8ed910c46a CDI: configure registry on start
Currently CDI registry is reconfigured on every
WithCDI call, which is a relatively heavy operation.

This happens because cdi.GetRegistry(cdi.WithSpecDirs(cdiSpecDirs...))
unconditionally reconfigures the registry (clears fs notify watch,
sets up new watch, rescans directories).

Moving configuration to the criService.initPlatform should result
in performing registry configuration only once on the service start.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2022-10-12 13:45:20 +03:00
Ed Bartosh
eec7a76ecd move WithCDI to pkg/cri/opts
As WithCDI is CRI-only API it makes sense to move it
out of oci module.

This move can also fix possible issues with this API when
CRI plugin is disabled.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2022-10-12 13:45:20 +03:00
Sebastiaan van Stijn
634bf0dd31
cmd/containerd: use golang.org/x/sys Service.SetRecoveryActions()
This is the equivalent of the local implementation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-12 09:43:10 +02: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
Zhuchen Wang
17a9324035
Update the default seccomp to block socket calls to AF_VSOCK
Signed-off-by: Zhuchen Wang <zcwang@google.com>
2022-10-11 15:30:39 -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
32aa33a9f4
Merge pull request #7497 from thaJeztah/replace_IsAnInteractiveSession
cmd/containerd: replace deprecated windows.IsAnInteractiveSession()
2022-10-11 13:17:48 -07:00