Skip to content

Commit

Permalink
Merge branch 'containerd:main' into bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
zjumoon01 committed Apr 10, 2024
2 parents 1007842 + eb25c21 commit 72acf44
Show file tree
Hide file tree
Showing 56 changed files with 373 additions and 186 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/test.yml
Expand Up @@ -77,11 +77,11 @@ jobs:
# ubuntu-20.04: cgroup v1, ubuntu-22.04: cgroup v2
include:
- ubuntu: 20.04
containerd: v1.6.30
containerd: v1.6.31
- ubuntu: 20.04
containerd: v1.7.14
containerd: v1.7.15
- ubuntu: 22.04
containerd: v1.7.14
containerd: v1.7.15
- ubuntu: 22.04
containerd: main
env:
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
# ubuntu-20.04: cgroup v1, ubuntu-22.04: cgroup v2
include:
- ubuntu: 22.04
containerd: v1.7.14
containerd: v1.7.15
env:
UBUNTU_VERSION: "${{ matrix.ubuntu }}"
CONTAINERD_VERSION: "${{ matrix.containerd }}"
Expand Down Expand Up @@ -157,31 +157,31 @@ jobs:
# ubuntu-22.04: cgroup v1, ubuntu-22.04: cgroup v2
include:
- ubuntu: 20.04
containerd: v1.6.30
containerd: v1.6.31
rootlesskit: v1.1.1
target: test-integration-rootless
- ubuntu: 20.04
containerd: v1.7.14
containerd: v1.7.15
rootlesskit: v2.0.2
target: test-integration-rootless
- ubuntu: 22.04
containerd: v1.7.14
containerd: v1.7.15
rootlesskit: v1.1.1
target: test-integration-rootless
- ubuntu: 22.04
containerd: main
rootlesskit: v2.0.2
target: test-integration-rootless
- ubuntu: 20.04
containerd: v1.6.30
containerd: v1.6.31
rootlesskit: v1.1.1
target: test-integration-rootless-port-slirp4netns
- ubuntu: 20.04
containerd: v1.7.14
containerd: v1.7.15
rootlesskit: v2.0.2
target: test-integration-rootless-port-slirp4netns
- ubuntu: 22.04
containerd: v1.7.14
containerd: v1.7.15
rootlesskit: v1.1.1
target: test-integration-rootless-port-slirp4netns
- ubuntu: 22.04
Expand Down Expand Up @@ -275,15 +275,15 @@ jobs:
- uses: actions/checkout@v4.1.2
with:
repository: containerd/containerd
ref: v1.7.14
ref: v1.7.15
path: containerd
fetch-depth: 1
- name: "Set up CNI"
working-directory: containerd
run: GOPATH=$(go env GOPATH) script/setup/install-cni-windows
- name: "Set up containerd"
env:
ctrdVersion: 1.7.14
ctrdVersion: 1.7.15
run: powershell hack/configure-windows-ci.ps1
# TODO: Run unit tests
- name: "Run integration tests"
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Expand Up @@ -18,12 +18,12 @@
# TODO: verify commit hash

# Basic deps
ARG CONTAINERD_VERSION=v1.7.14
ARG CONTAINERD_VERSION=v1.7.15
ARG RUNC_VERSION=v1.1.12
ARG CNI_PLUGINS_VERSION=v1.4.1

# Extra deps: Build
ARG BUILDKIT_VERSION=v0.13.0
ARG BUILDKIT_VERSION=v0.13.1
# Extra deps: Lazy-pulling
ARG STARGZ_SNAPSHOTTER_VERSION=v0.15.1
# Extra deps: Encryption
Expand All @@ -32,7 +32,7 @@ ARG IMGCRYPT_VERSION=v1.1.10
ARG ROOTLESSKIT_VERSION=v2.0.2
ARG SLIRP4NETNS_VERSION=v1.2.3
# Extra deps: bypass4netns
ARG BYPASS4NETNS_VERSION=v0.4.0
ARG BYPASS4NETNS_VERSION=v0.4.1
# Extra deps: FUSE-OverlayFS
ARG FUSE_OVERLAYFS_VERSION=v1.13
ARG CONTAINERD_FUSE_OVERLAYFS_VERSION=v1.0.8
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile.d/SHA256SUMS.d/buildkit-v0.13.0

This file was deleted.

2 changes: 2 additions & 0 deletions Dockerfile.d/SHA256SUMS.d/buildkit-v0.13.1
@@ -0,0 +1,2 @@
5d4a6ef438851d7a0b22d17c7e806651c24c0982ddd6af8c02117fca84f167ec buildkit-v0.13.1.linux-amd64.tar.gz
9e1478af43ba7ac6635cae30a8dda3ebce4dca70a8def939ac64ee395d03d647 buildkit-v0.13.1.linux-arm64.tar.gz
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -189,7 +189,7 @@ Major:
- [P2P image distribution using IPFS](./docs/ipfs.md): `nerdctl run ipfs://CID` .
P2P image distribution (IPFS) is completely optional. Your host is NOT connected to any P2P network, unless you opt in to [install and run IPFS daemon](https://docs.ipfs.io/install/).
- [Cosign integration](./docs/cosign.md): `nerdctl pull --verify=cosign` and `nerdctl push --sign=cosign`, and [in Compose](./docs/cosign.md#cosign-in-compose)
- [Accelerated rootless containers using bypass4netns](./docs/rootless.md): `nerdctl run --label nerdctl/bypass4netns=true`
- [Accelerated rootless containers using bypass4netns](./docs/rootless.md): `nerdctl run --annotation nerdctl/bypass4netns=true`

Minor:

Expand Down
3 changes: 1 addition & 2 deletions cmd/nerdctl/builder.go
Expand Up @@ -24,7 +24,6 @@ import (

"github.com/containerd/log"
"github.com/containerd/nerdctl/v2/pkg/buildkitutil"
"github.com/containerd/nerdctl/v2/pkg/defaults"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -56,7 +55,7 @@ func newBuilderPruneCommand() *cobra.Command {
SilenceErrors: true,
}

AddStringFlag(buildPruneCommand, "buildkit-host", nil, defaults.BuildKitHost(), "BUILDKIT_HOST", "BuildKit address")
AddStringFlag(buildPruneCommand, "buildkit-host", nil, "", "BUILDKIT_HOST", "BuildKit address")
return buildPruneCommand
}

Expand Down
3 changes: 1 addition & 2 deletions cmd/nerdctl/builder_build.go
Expand Up @@ -27,7 +27,6 @@ import (
"github.com/containerd/nerdctl/v2/pkg/buildkitutil"
"github.com/containerd/nerdctl/v2/pkg/clientutil"
"github.com/containerd/nerdctl/v2/pkg/cmd/builder"
"github.com/containerd/nerdctl/v2/pkg/defaults"
"github.com/containerd/nerdctl/v2/pkg/strutil"

"github.com/spf13/cobra"
Expand All @@ -43,7 +42,7 @@ If Dockerfile is not present and -f is not specified, it will look for Container
SilenceUsage: true,
SilenceErrors: true,
}
AddStringFlag(buildCommand, "buildkit-host", nil, defaults.BuildKitHost(), "BUILDKIT_HOST", "BuildKit address")
AddStringFlag(buildCommand, "buildkit-host", nil, "", "BUILDKIT_HOST", "BuildKit address")
buildCommand.Flags().StringArrayP("tag", "t", nil, "Name and optionally a tag in the 'name:tag' format")
buildCommand.Flags().StringP("file", "f", "", "Name of the Dockerfile")
buildCommand.Flags().String("target", "", "Set the target build stage to build")
Expand Down
4 changes: 2 additions & 2 deletions cmd/nerdctl/compose_up_linux_test.go
Expand Up @@ -523,7 +523,7 @@ services:
WORDPRESS_DB_NAME: exampledb
volumes:
- wordpress:/var/www/html
labels:
annotations:
- nerdctl/bypass4netns=1
db:
Expand All @@ -536,7 +536,7 @@ services:
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
labels:
annotations:
- nerdctl/bypass4netns=1
volumes:
Expand Down
4 changes: 4 additions & 0 deletions cmd/nerdctl/container_create.go
Expand Up @@ -337,6 +337,10 @@ func processContainerCreateOptions(cmd *cobra.Command) (opt types.ContainerCreat
if err != nil {
return
}
opt.Annotations, err = cmd.Flags().GetStringArray("annotation")
if err != nil {
return
}
opt.CidFile, err = cmd.Flags().GetString("cidfile")
if err != nil {
return
Expand Down
7 changes: 5 additions & 2 deletions cmd/nerdctl/container_run.go
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/containerd/console"
"github.com/containerd/log"
"github.com/containerd/nerdctl/v2/pkg/annotations"
"github.com/containerd/nerdctl/v2/pkg/api/types"
"github.com/containerd/nerdctl/v2/pkg/clientutil"
"github.com/containerd/nerdctl/v2/pkg/cmd/container"
Expand Down Expand Up @@ -230,8 +231,10 @@ func setCreateFlags(cmd *cobra.Command) {
cmd.Flags().String("name", "", "Assign a name to the container")
// label needs to be StringArray, not StringSlice, to prevent "foo=foo1,foo2" from being split to {"foo=foo1", "foo2"}
cmd.Flags().StringArrayP("label", "l", nil, "Set metadata on container")
cmd.RegisterFlagCompletionFunc("label", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return labels.ShellCompletions, cobra.ShellCompDirectiveNoFileComp
// annotation needs to be StringArray, not StringSlice, to prevent "foo=foo1,foo2" from being split to {"foo=foo1", "foo2"}
cmd.Flags().StringArray("annotation", nil, "Add an annotation to the container (passed through to the OCI runtime)")
cmd.RegisterFlagCompletionFunc("annotation", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return annotations.ShellCompletions, cobra.ShellCompDirectiveNoFileComp
})

// label-file is defined as StringSlice, not StringArray, to allow specifying "--env-file=FILE1,FILE2" (compatible with Podman)
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/container_top_unix_test.go
@@ -1,4 +1,4 @@
//go:build linux || darwin || freebsd || netbsd || openbsd
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/main_unix.go
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/network_create_unix.go
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
3 changes: 2 additions & 1 deletion docs/command-reference.md
Expand Up @@ -298,8 +298,9 @@ Env flags:
Metadata flags:

- :whale: :blue_square: `--name`: Assign a name to the container
- :whale: :blue_square: `-l, --label`: Set meta data on a container
- :whale: :blue_square: `-l, --label`: Set meta data on a container (Not passed through the OCI runtime since nerdctl v2.0, with an exception for `nerdctl/bypass4netns`)
- :whale: :blue_square: `--label-file`: Read in a line delimited file of labels
- :whale: :blue_square: `--annotation`: Add an annotation to the container (passed through to the OCI runtime)
- :whale: :blue_square: `--cidfile`: Write the container ID to the file
- :nerd_face: `--pidfile`: file path to write the task's pid. The CLI syntax conforms to Podman convention.

Expand Down
8 changes: 6 additions & 2 deletions docs/rootless.md
Expand Up @@ -121,11 +121,15 @@ The performance benchmark with iperf3 on Ubuntu 21.10 on Hyper-V VM is shown bel

This benchmark can be reproduced with [https://github.com/rootless-containers/bypass4netns/blob/f009d96139e9e38ce69a2ea8a9a746349bad273c/Vagrantfile](https://github.com/rootless-containers/bypass4netns/blob/f009d96139e9e38ce69a2ea8a9a746349bad273c/Vagrantfile)

Acceleration with bypass4netns is available with `--label nerdctl/bypass4netns=true`. You also need to have `bypass4netnsd` (bypass4netns daemon) to be running.
Acceleration with bypass4netns is available with:
- `--annotation nerdctl/bypass4netns=true` (for nerdctl v2.0 and later)
- `--label nerdctl/bypass4netns=true` (deprecated form, used in nerdctl prior to v2.0).

You also need to have `bypass4netnsd` (bypass4netns daemon) to be running.
Example
```console
$ containerd-rootless-setuptool.sh install-bypass4netnsd
$ nerdctl run -it --rm -p 8080:80 --label nerdctl/bypass4netns=true alpine
$ nerdctl run -it --rm -p 8080:80 --annotation nerdctl/bypass4netns=true alpine
```

More detail is available at [https://github.com/rootless-containers/bypass4netns/blob/master/README.md](https://github.com/rootless-containers/bypass4netns/blob/master/README.md)
Expand Down
2 changes: 1 addition & 1 deletion extras/rootless/containerd-rootless-setuptool.sh
Expand Up @@ -365,7 +365,7 @@ cmd_entrypoint_install_bypass4netnsd() {
[Install]
WantedBy=default.target
EOT
INFO "To use bypass4netnsd, set the \"nerdctl/bypass4netns=true\" label on containers, e.g., \`nerdctl run --label nerdctl/bypass4netns=true\`"
INFO "To use bypass4netnsd, set the \"nerdctl/bypass4netns=true\" annotation on containers, e.g., \`nerdctl run --annotation nerdctl/bypass4netns=true\`"
}

# CLI subcommand: "install-fuse-overlayfs"
Expand Down
22 changes: 11 additions & 11 deletions go.mod
Expand Up @@ -5,13 +5,13 @@ go 1.21
require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/Microsoft/go-winio v0.6.1
github.com/Microsoft/hcsshim v0.12.1
github.com/Microsoft/hcsshim v0.12.2
github.com/awslabs/soci-snapshotter v0.4.1
github.com/compose-spec/compose-go v1.20.2
github.com/containerd/accelerated-container-image v1.0.4
github.com/containerd/accelerated-container-image v1.1.2
github.com/containerd/cgroups/v3 v3.0.3
github.com/containerd/console v1.0.4
github.com/containerd/containerd v1.7.14
github.com/containerd/containerd v1.7.15
github.com/containerd/continuity v0.4.3
github.com/containerd/fifo v1.1.0
github.com/containerd/go-cni v1.1.9
Expand Down Expand Up @@ -46,7 +46,7 @@ require (
github.com/opencontainers/image-spec v1.1.0
github.com/opencontainers/runtime-spec v1.2.0
github.com/pelletier/go-toml/v2 v2.2.0
github.com/rootless-containers/bypass4netns v0.4.0
github.com/rootless-containers/bypass4netns v0.4.1
github.com/rootless-containers/rootlesskit/v2 v2.0.2
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
Expand All @@ -55,11 +55,11 @@ require (
github.com/vishvananda/netns v0.0.4
github.com/yuchanns/srslog v1.1.0
go.uber.org/mock v0.4.0
golang.org/x/crypto v0.21.0
golang.org/x/net v0.22.0
golang.org/x/sync v0.6.0
golang.org/x/sys v0.18.0
golang.org/x/term v0.18.0
golang.org/x/crypto v0.22.0
golang.org/x/net v0.24.0
golang.org/x/sync v0.7.0
golang.org/x/sys v0.19.0
golang.org/x/term v0.19.0
golang.org/x/text v0.14.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.5.1
Expand All @@ -76,7 +76,7 @@ require (
github.com/containerd/ttrpc v1.2.3 // indirect
github.com/containerd/typeurl v1.0.3-0.20220422153119-7f6e6d160d67 // indirect
github.com/containers/ocicrypt v1.1.10 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/djherbis/times v1.5.0 // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
Expand All @@ -87,7 +87,7 @@ require (
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down

0 comments on commit 72acf44

Please sign in to comment.