Skip to content

Commit

Permalink
go.mod: github.com/docker/docker v26.1.1+incompatible (#358)
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda authored May 7, 2024
1 parent 57af35d commit a6fa1b4
Show file tree
Hide file tree
Showing 42 changed files with 416 additions and 298 deletions.
4 changes: 2 additions & 2 deletions core/container_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"

"github.com/Mirantis/cri-dockerd/libdocker"
"github.com/docker/docker/api/types"
dockercontainer "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/sirupsen/logrus"
v1 "k8s.io/cri-api/pkg/apis/runtime/v1"
Expand All @@ -32,7 +32,7 @@ func (ds *dockerService) ListContainers(
r *v1.ListContainersRequest,
) (*v1.ListContainersResponse, error) {
filter := r.GetFilter()
opts := types.ContainerListOptions{All: true}
opts := dockercontainer.ListOptions{All: true}

opts.Filters = filters.NewArgs()
f := NewDockerFilter(&opts.Filters)
Expand Down
3 changes: 2 additions & 1 deletion core/container_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/Mirantis/cri-dockerd/libdocker"
"github.com/docker/docker/api/types"
dockercontainer "github.com/docker/docker/api/types/container"
v1 "k8s.io/cri-api/pkg/apis/runtime/v1"
)

Expand All @@ -48,7 +49,7 @@ func (ds *dockerService) RemoveContainer(
}
err = ds.client.RemoveContainer(
r.ContainerId,
types.ContainerRemoveOptions{RemoveVolumes: true, Force: true},
dockercontainer.RemoveOptions{RemoveVolumes: true, Force: true},
)
if err != nil {
return nil, fmt.Errorf("failed to remove container %q: %v", r.ContainerId, err)
Expand Down
4 changes: 2 additions & 2 deletions core/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"testing"
"time"

dockertypes "github.com/docker/docker/api/types"
dockerimage "github.com/docker/docker/api/types/image"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -260,7 +260,7 @@ func TestContainerStatus(t *testing.T) {
Annotations: config.Annotations,
}

fDocker.InjectImages([]dockertypes.ImageSummary{{ID: imageName}})
fDocker.InjectImages([]dockerimage.Summary{{ID: imageName}})

runSandboxResp, err := ds.RunPodSandbox(getTestCTX(), &runtimeapi.RunPodSandboxRequest{
Config: sConfig,
Expand Down
2 changes: 1 addition & 1 deletion core/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
// This file contains helper functions to convert docker API types to runtime
// API types, or vice versa.

func imageToRuntimeAPIImage(image *dockertypes.ImageSummary, pinned bool) (*runtimeapi.Image, error) {
func imageToRuntimeAPIImage(image *dockerimagetypes.Summary, pinned bool) (*runtimeapi.Image, error) {
if image == nil {
return nil, fmt.Errorf("unable to convert a nil pointer to a runtime API image")
}
Expand Down
5 changes: 3 additions & 2 deletions core/docker_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"github.com/Mirantis/cri-dockerd/utils"
"github.com/blang/semver"
dockertypes "github.com/docker/docker/api/types"
dockersystem "github.com/docker/docker/api/types/system"
"github.com/sirupsen/logrus"

v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -358,14 +359,14 @@ func fixAPIVersion(v *dockertypes.Version) {
}

// getDockerInfo gets the information of "docker info".
func (ds *dockerService) getDockerInfo() (*dockertypes.Info, error) {
func (ds *dockerService) getDockerInfo() (*dockersystem.Info, error) {
res, err := ds.systemInfoCache.Memoize("docker_info", systemInfoCacheMinTTL, func() (interface{}, error) {
return ds.client.Info()
})
if err != nil {
return nil, fmt.Errorf("failed to get docker info from dockerd: %v", err)
}
info := res.(*dockertypes.Info)
info := res.(*dockersystem.Info)
return info, nil
}

Expand Down
4 changes: 2 additions & 2 deletions core/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/Mirantis/cri-dockerd/config"
"github.com/Mirantis/cri-dockerd/libdocker"

dockertypes "github.com/docker/docker/api/types"
dockerimage "github.com/docker/docker/api/types/image"
dockermount "github.com/docker/docker/api/types/mount"
dockerregistry "github.com/docker/docker/api/types/registry"
dockernat "github.com/docker/go-connections/nat"
Expand Down Expand Up @@ -178,7 +178,7 @@ func TestEnsureSandboxImageExists(t *testing.T) {
t.Logf("TestCase: %q", desc)
_, fakeDocker, _ := newTestDockerService()
if test.injectImage {
images := []dockertypes.ImageSummary{{ID: sandboxImage}}
images := []dockerimage.Summary{{ID: sandboxImage}}
fakeDocker.InjectImages(images)
if test.imgNeedsAuth {
fakeDocker.MakeImagesPrivate(images, authConfig)
Expand Down
2 changes: 1 addition & 1 deletion core/helpers_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (ds *dockerService) updateCreateConfig(
}

func (ds *dockerService) determinePodIPBySandboxID(sandboxID string) []string {
opts := dockertypes.ContainerListOptions{
opts := dockercontainer.ListOptions{
All: true,
Filters: dockerfilters.NewArgs(),
}
Expand Down
4 changes: 2 additions & 2 deletions core/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/Mirantis/cri-dockerd/config"

"github.com/armon/circbuf"
dockertypes "github.com/docker/docker/api/types"
dockercontainer "github.com/docker/docker/api/types/container"

"github.com/sirupsen/logrus"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -68,7 +68,7 @@ func (ds *dockerService) GetContainerLogs(
if logOptions.SinceTime != nil {
since = logOptions.SinceTime.Unix()
}
opts := dockertypes.ContainerLogsOptions{
opts := dockercontainer.LogsOptions{
ShowStdout: true,
ShowStderr: true,
Since: strconv.FormatInt(since, 10),
Expand Down
2 changes: 1 addition & 1 deletion core/sandbox_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func recoverFromCreationConflictIfNeeded(

id := matches[1]
logrus.Infof("Unable to create pod sandbox due to conflict. Attempting to remove sandbox. Container %v", id)
rmErr := client.RemoveContainer(id, dockertypes.ContainerRemoveOptions{RemoveVolumes: true})
rmErr := client.RemoveContainer(id, dockercontainer.RemoveOptions{RemoveVolumes: true})
if rmErr == nil {
logrus.Infof("Successfully removed conflicting container: %v", id)
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions core/sandbox_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/Mirantis/cri-dockerd/libdocker"
"github.com/Mirantis/cri-dockerd/store"
"github.com/docker/docker/api/types"
dockercontainer "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/sirupsen/logrus"
v1 "k8s.io/cri-api/pkg/apis/runtime/v1"
Expand All @@ -35,7 +35,7 @@ func (ds *dockerService) ListPodSandbox(
filter := r.GetFilter()

// By default, list all containers whether they are running or not.
opts := types.ContainerListOptions{All: true}
opts := dockercontainer.ListOptions{All: true}
filterOutReadySandboxes := false

opts.Filters = filters.NewArgs()
Expand Down
7 changes: 4 additions & 3 deletions core/sandbox_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ package core

import (
"context"

"github.com/Mirantis/cri-dockerd/libdocker"
"github.com/Mirantis/cri-dockerd/utils/errors"
"github.com/docker/docker/api/types"
dockercontainer "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
v1 "k8s.io/cri-api/pkg/apis/runtime/v1"
)
Expand All @@ -34,7 +35,7 @@ func (ds *dockerService) RemovePodSandbox(
podSandboxID := r.PodSandboxId
var errs []error

opts := types.ContainerListOptions{All: true}
opts := dockercontainer.ListOptions{All: true}

opts.Filters = filters.NewArgs()
f := NewDockerFilter(&opts.Filters)
Expand All @@ -56,7 +57,7 @@ func (ds *dockerService) RemovePodSandbox(
// Remove the sandbox container.
err = ds.client.RemoveContainer(
podSandboxID,
types.ContainerRemoveOptions{RemoveVolumes: true, Force: true},
dockercontainer.RemoveOptions{RemoveVolumes: true, Force: true},
)
if err == nil || libdocker.IsContainerNotFoundError(err) {
// Only clear network ready when the sandbox has actually been
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/coreos/go-systemd/v22 v22.5.0
github.com/davecgh/go-spew v1.1.1
github.com/docker/distribution v2.8.3+incompatible
github.com/docker/docker v25.0.4+incompatible
github.com/docker/docker v26.1.1+incompatible
github.com/docker/go-connections v0.5.0
github.com/emicklei/go-restful v2.16.0+incompatible
github.com/golang/mock v1.6.0
Expand Down Expand Up @@ -89,6 +89,7 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,8 @@ github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4Kfc
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v20.10.21+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v25.0.4+incompatible h1:XITZTrq+52tZyZxUOtFIahUf3aH367FLxJzt9vZeAF8=
github.com/docker/docker v25.0.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v26.1.1+incompatible h1:oI+4kkAgIwwb54b9OC7Xc3hSgu1RlJA/Lln/DF72djQ=
github.com/docker/docker v26.1.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
Expand Down Expand Up @@ -1003,6 +1003,8 @@ github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8Ie
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4=
github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=
github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=
github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU=
Expand Down
26 changes: 13 additions & 13 deletions libdocker/fake_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ func (f *FakeDockerClient) StopContainer(id string, timeout time.Duration) error

func (f *FakeDockerClient) RemoveContainer(
id string,
opts dockertypes.ContainerRemoveOptions,
opts dockercontainer.RemoveOptions,
) error {
f.Lock()
defer f.Unlock()
Expand Down Expand Up @@ -660,7 +660,7 @@ func (f *FakeDockerClient) UpdateContainerResources(
// It adds an entry "logs" to the internal method call record.
func (f *FakeDockerClient) Logs(
id string,
opts dockertypes.ContainerLogsOptions,
opts dockercontainer.LogsOptions,
sopts StreamOptions,
) error {
f.Lock()
Expand Down Expand Up @@ -710,7 +710,7 @@ func (f *FakeDockerClient) Version() (*dockertypes.Version, error) {
return &v, f.popError("version")
}

func (f *FakeDockerClient) Info() (*dockertypes.Info, error) {
func (f *FakeDockerClient) Info() (*dockersystem.Info, error) {
return &f.Information, nil
}

Expand Down Expand Up @@ -738,7 +738,7 @@ func (f *FakeDockerClient) StartExec(

func (f *FakeDockerClient) AttachToContainer(
id string,
opts dockertypes.ContainerAttachOptions,
opts dockercontainer.AttachOptions,
sopts StreamOptions,
) error {
f.Lock()
Expand All @@ -753,7 +753,7 @@ func (f *FakeDockerClient) InspectExec(id string) (*dockertypes.ContainerExecIns

func (f *FakeDockerClient) ListImages(
opts dockertypes.ImageListOptions,
) ([]dockertypes.ImageSummary, error) {
) ([]dockerimagetypes.Summary, error) {
f.Lock()
defer f.Unlock()
f.appendCalled(CalledDetail{name: "list_images"})
Expand All @@ -764,7 +764,7 @@ func (f *FakeDockerClient) ListImages(
func (f *FakeDockerClient) RemoveImage(
image string,
opts dockertypes.ImageRemoveOptions,
) ([]dockertypes.ImageDeleteResponseItem, error) {
) ([]dockerimagetypes.DeleteResponse, error) {
f.Lock()
defer f.Unlock()
f.appendCalled(CalledDetail{name: "remove_image", arguments: []interface{}{image, opts}})
Expand All @@ -777,10 +777,10 @@ func (f *FakeDockerClient) RemoveImage(
}
}
}
return []dockertypes.ImageDeleteResponseItem{{Deleted: image}}, err
return []dockerimagetypes.DeleteResponse{{Deleted: image}}, err
}

func (f *FakeDockerClient) InjectImages(images []dockertypes.ImageSummary) {
func (f *FakeDockerClient) InjectImages(images []dockerimagetypes.Summary) {
f.Lock()
defer f.Unlock()
f.Images = append(f.Images, images...)
Expand All @@ -790,7 +790,7 @@ func (f *FakeDockerClient) InjectImages(images []dockertypes.ImageSummary) {
}

func (f *FakeDockerClient) MakeImagesPrivate(
images []dockertypes.ImageSummary,
images []dockerimagetypes.Summary,
auth dockerregistry.AuthConfig,
) {
f.Lock()
Expand All @@ -803,7 +803,7 @@ func (f *FakeDockerClient) MakeImagesPrivate(
func (f *FakeDockerClient) ResetImages() {
f.Lock()
defer f.Unlock()
f.Images = []dockertypes.ImageSummary{}
f.Images = []dockerimagetypes.Summary{}
f.ImageInspects = make(map[string]*dockertypes.ImageInspect)
f.ImageIDsNeedingAuth = make(map[string]dockerregistry.AuthConfig)
}
Expand Down Expand Up @@ -851,7 +851,7 @@ func createImageInspectFromRef(ref string) *dockertypes.ImageInspect {
}
}

func createImageInspectFromImage(image dockertypes.ImageSummary) *dockertypes.ImageInspect {
func createImageInspectFromImage(image dockerimagetypes.Summary) *dockertypes.ImageInspect {
return &dockertypes.ImageInspect{
ID: image.ID,
RepoTags: image.RepoTags,
Expand All @@ -862,8 +862,8 @@ func createImageInspectFromImage(image dockertypes.ImageSummary) *dockertypes.Im
}
}

func createImageFromImageInspect(inspect dockertypes.ImageInspect) *dockertypes.ImageSummary {
return &dockertypes.ImageSummary{
func createImageFromImageInspect(inspect dockertypes.ImageInspect) *dockerimagetypes.Summary {
return &dockerimagetypes.Summary{
ID: inspect.ID,
RepoTags: inspect.RepoTags,
// Image size is required to be non-zero for CRI integration.
Expand Down
Loading

0 comments on commit a6fa1b4

Please sign in to comment.