Skip to content

Commit

Permalink
Merge pull request #1339 from afbjorklund/dockershim-containerd
Browse files Browse the repository at this point in the history
Replace dockershim with containerd
  • Loading branch information
k8s-ci-robot authored Jan 30, 2024
2 parents bf72c9d + 971120b commit 9e0ea79
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 40 deletions.
2 changes: 1 addition & 1 deletion cmd/crictl/main_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ const (
defaultConfigPath = "/usr/local/etc/crictl.yaml"
)

var defaultRuntimeEndpoints = []string{"unix:///var/run/dockershim.sock", "unix:///var/run/containerd/containerd.sock", "unix:///var/run/crio/crio.sock", "unix:///var/run/cri-dockerd.sock"}
var defaultRuntimeEndpoints = []string{"unix:///var/run/containerd/containerd.sock", "unix:///var/run/crio/crio.sock", "unix:///var/run/cri-dockerd.sock"}

var shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM}
2 changes: 1 addition & 1 deletion cmd/crictl/main_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ const (
defaultConfigPath = "/etc/crictl.yaml"
)

var defaultRuntimeEndpoints = []string{"unix:///var/run/dockershim.sock", "unix:///run/containerd/containerd.sock", "unix:///run/crio/crio.sock", "unix:///var/run/cri-dockerd.sock"}
var defaultRuntimeEndpoints = []string{"unix:///run/containerd/containerd.sock", "unix:///run/crio/crio.sock", "unix:///var/run/cri-dockerd.sock"}

var shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM}
2 changes: 1 addition & 1 deletion cmd/crictl/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"path/filepath"
)

var defaultRuntimeEndpoints = []string{"npipe:////./pipe/dockershim", "npipe:////./pipe/containerd-containerd", "npipe:////./pipe/cri-dockerd"}
var defaultRuntimeEndpoints = []string{"npipe:////./pipe/containerd-containerd", "npipe:////./pipe/cri-dockerd"}
var defaultConfigPath string

var shutdownSignals = []os.Signal{os.Interrupt}
Expand Down
6 changes: 3 additions & 3 deletions docs/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ git clone https://github.com/kubernetes-sigs/cri-tools -b release-1.9 $GOPATH/sr

### Prerequisite

Before running the test, you need to _ensure that the CRI server under test is running and listening on a Unix socket_ or a Windows tcp socket. Because the benchmark tests are designed to request changes (e.g., create/delete) to the containers and verify that correct status is reported, it expects to be the only user of the CRI server. Please make sure that 1) there are no existing CRI-managed containers running on the node, and 2) no other processes (e.g., Kubelet) will interfere with the tests.
Before running the test, you need to _ensure that the CRI server under test is running and listening on a Unix socket_ or a Windows named pipe. Because the benchmark tests are designed to request changes (e.g., create/delete) to the containers and verify that correct status is reported, it expects to be the only user of the CRI server. Please make sure that 1) there are no existing CRI-managed containers running on the node, and 2) no other processes (e.g., Kubelet) will interfere with the tests.

### Defining benchmarking parameters

Expand Down Expand Up @@ -61,13 +61,13 @@ This will
- Run the benchmark tests using `ginkgo`
- Output the test results to STDOUT

critest connects to Unix: `unix:///var/run/dockershim.sock` or Windows: `tcp://localhost:3735` by default. For other runtimes, the endpoint can be set by flags `--runtime-endpoint` and `--image-endpoint`.
critest connects to Unix: `unix:///run/containerd/containerd.sock` or Windows: `npipe:////./pipe/containerd-containerd` by default. For other runtimes, the endpoint can be set by flags `--runtime-endpoint` and `--image-endpoint`.

## Additional options

- `-ginkgo.focus`: Only run the tests that match the regular expression.
- `-image-endpoint`: Set the endpoint of image service. Same with runtime-endpoint if not specified.
- `-runtime-endpoint`: Set the endpoint of runtime service. Default to Unix: `unix:///var/run/dockershim.sock` or Windows: `tcp://localhost:3735`.
- `-runtime-endpoint`: Set the endpoint of runtime service. Default to Unix: `unix:///run/containerd/containerd.sock` or Windows: `npipe:////./pipe/containerd-containerd`.
- `-benchmarking-params-file`: optional path to a YAML file containing parameters describing which
benchmarks should be run.
- `-benchmarking-output-dir`: optional path to a pre-existing directory in which to write JSON
Expand Down
14 changes: 4 additions & 10 deletions docs/crictl.1
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ COMMANDS:

.RS
.IP \(bu 2
\fB\fCunix:///var/run/dockershim.sock\fR or
.IP \(bu 2
\fB\fCunix:///run/containerd/containerd.sock\fR or
.IP \(bu 2
\fB\fCunix:///run/crio/crio.sock\fR or
Expand All @@ -154,8 +152,6 @@ or on Windows to:

.RS
.IP \(bu 2
\fB\fCnpipe:////./pipe/dockershim\fR or
.IP \(bu 2
\fB\fCnpipe:////./pipe/containerd\-containerd\fR or
.IP \(bu 2
\fB\fCnpipe:////./pipe/cri\-dockerd\fR
Expand Down Expand Up @@ -194,8 +190,6 @@ If the runtime endpoint is not set, \fB\fCcrictl\fR will by default try to conne

.RS
.IP \(bu 2
dockershim
.IP \(bu 2
containerd
.IP \(bu 2
cri\-o
Expand Down Expand Up @@ -224,8 +218,8 @@ Unix:

.nf
$ cat /etc/crictl.yaml
runtime\-endpoint: unix:///var/run/dockershim.sock
image\-endpoint: unix:///var/run/dockershim.sock
runtime\-endpoint: unix:///run/containerd/containerd.sock
image\-endpoint: unix:///run/containerd/containerd.sock
timeout: 2
debug: true
pull\-image\-on\-create: false
Expand All @@ -241,8 +235,8 @@ Windows:

.nf
C:\\> type %USERPROFILE%\\.crictl\\crictl.yaml
runtime\-endpoint: tcp://localhost:3735
image\-endpoint: tcp://localhost:3735
runtime\-endpoint: npipe:////./pipe/containerd\-containerd
image\-endpoint: npipe:////./pipe/containerd\-containerd
timeout: 2
debug: true
pull\-image\-on\-create: false
Expand Down
11 changes: 4 additions & 7 deletions docs/crictl.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ COMMANDS:

`crictl` by default connects on Unix to:

- `unix:///var/run/dockershim.sock` or
- `unix:///run/containerd/containerd.sock` or
- `unix:///run/crio/crio.sock` or
- `unix:///var/run/cri-dockerd.sock`

or on Windows to:

- `npipe:////./pipe/dockershim` or
- `npipe:////./pipe/containerd-containerd` or
- `npipe:////./pipe/cri-dockerd`

Expand All @@ -94,7 +92,6 @@ The endpoint can be set in three ways:
If the endpoint is not set then it works as follows:

- If the runtime endpoint is not set, `crictl` will by default try to connect using:
- dockershim
- containerd
- cri-o
- cri-dockerd
Expand All @@ -107,8 +104,8 @@ Unix:

```sh
$ cat /etc/crictl.yaml
runtime-endpoint: unix:///var/run/dockershim.sock
image-endpoint: unix:///var/run/dockershim.sock
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 2
debug: true
pull-image-on-create: false
Expand All @@ -118,8 +115,8 @@ Windows:

```cmd
C:\> type %USERPROFILE%\.crictl\crictl.yaml
runtime-endpoint: tcp://localhost:3735
image-endpoint: tcp://localhost:3735
runtime-endpoint: npipe:////./pipe/containerd-containerd
image-endpoint: npipe:////./pipe/containerd-containerd
timeout: 2
debug: true
pull-image-on-create: false
Expand Down
4 changes: 2 additions & 2 deletions docs/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ This will
- Run the tests using `ginkgo`
- Output the test results to STDOUT

critest connects to Unix: `unix:///var/run/dockershim.sock` or Windows: `tcp://localhost:3735` by default. For other runtimes, the endpoint can be set by flags `--runtime-endpoint` and `--image-endpoint`.
critest connects to Unix: `unix:///run/containerd/containerd.sock` or Windows: `npipe:////./pipe/containerd-containerd` by default. For other runtimes, the endpoint can be set by flags `--runtime-endpoint` and `--image-endpoint`.

## Additional options

- `-ginkgo.focus`: Only run the tests that match the regular expression.
- `-image-endpoint`: Set the endpoint of image service. Same with runtime-endpoint if not specified.
- `-test-images-file`: Optional path to a YAML file containing references to custom container images to be used in tests.
- `-runtime-endpoint`: Set the endpoint of runtime service. Default to `unix:///var/run/dockershim.sock` or Windows: `tcp://localhost:3735`.
- `-runtime-endpoint`: Set the endpoint of runtime service. Default to `unix:///run/containerd/containerd.sock` or Windows: `npipe:////./pipe/containerd-containerd`.
- `-ginkgo.skip`: Skip the tests that match the regular expression.
- `-parallel`: The number of parallel test nodes to run (default 1). [ginkgo](https://github.com/onsi/ginkgo) must be installed to run parallel tests.
- `-h`: Should help and all supported options.
2 changes: 1 addition & 1 deletion hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Run critest with default dockershim.
# Run critest with default containerd.

set -o errexit
set -o nounset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Run critest with default dockershim.
# Run critest with default cri-dockerd.

set -o errexit
set -o nounset
Expand All @@ -38,13 +38,13 @@ fi
# regex of SKIP
SKIP=$(echo $SKIP|sed "s/ /\\\s/g" -)

# Start dockershim first
# Start cri-dockerd first
logs_dir="$GOPATH/logs"
mkdir -p $logs_dir
ep="unix:///var/run/dockershim.sock"
ep="unix:///var/run/cri-dockerd.sock"
sudo /usr/local/bin/cri-dockerd --network-plugin="" --container-runtime-endpoint=${ep} >$logs_dir/cri-dockerd.log 2>&1 &

# Wait a while for dockershim starting.
# Wait a while for cri-dockerd starting.
sleep 10

# Run e2e test cases
Expand Down
8 changes: 4 additions & 4 deletions pkg/framework/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ const (
// DefaultRegistryE2ETestImagesPrefix is the default prefix for e2e test images.
DefaultRegistryE2ETestImagesPrefix = DefaultRegistryPrefix + "/e2e-test-images/"

DockerShimSockPathUnix = "unix:///var/run/dockershim.sock"
DockerShimSockPathWindows = "npipe:////./pipe/dockershim"
ContainerdSockPathUnix = "unix:///run/containerd/containerd.sock"
ContainerdSockPathWindows = "npipe:////./pipe/containerd-containerd"
)

// RegisterFlags registers flags to e2e test suites.
Expand All @@ -147,10 +147,10 @@ func RegisterFlags() {
flag.StringVar(&testImagesFilePath, "test-images-file", "", "Optional path to a YAML file containing references to custom container images to be used in tests.")
flag.DurationVar(&TestContext.ImageServiceTimeout, "image-service-timeout", 300*time.Second, "Timeout when trying to connect to image service.")

svcaddr := DockerShimSockPathUnix
svcaddr := ContainerdSockPathUnix
defaultConfigPath := "/etc/crictl.yaml"
if runtime.GOOS == "windows" {
svcaddr = DockerShimSockPathWindows
svcaddr = ContainerdSockPathWindows
defaultConfigPath = filepath.Join(os.Getenv("USERPROFILE"), ".crictl", "crictl.yaml")
}
flag.StringVar(&TestContext.ConfigPath, "config", defaultConfigPath, "Location of the client config file. If not specified and the default does not exist, the program's directory is searched as well")
Expand Down
8 changes: 2 additions & 6 deletions pkg/validate/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,8 @@ func createMountPropagationContainer(
Expect(resp.Status.Mounts[0].Readonly).To(BeFalse())
Expect(resp.Status.Mounts[0].SelinuxRelabel).To(BeFalse())

// NOTE: dockershim does not populate that field, so we do not have to test it
if framework.TestContext.RuntimeServiceAddr != framework.DockerShimSockPathUnix &&
framework.TestContext.RuntimeServiceAddr != framework.DockerShimSockPathWindows {
By("verifying container status mount propagation")
Expect(resp.Status.Mounts[0].Propagation).To(Equal(propagation))
}
By("verifying container status mount propagation")
Expect(resp.Status.Mounts[0].Propagation).To(Equal(propagation))

return containerID
}
Expand Down

0 comments on commit 9e0ea79

Please sign in to comment.