From 2088c5963b4ba40c3b512572bca8201e7bf6943d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 18 Jun 2024 14:29:45 +0200 Subject: [PATCH] vendor: github.com/docker/docker 1a1f3cff45ec (master, v27.0-dev) Rewrite local code to use the new container.Ulimit alias to start transitioning away from direct uses of go-units.Ulimit. full diff: https://github.com/docker/docker/compare/v27.0.0-rc.2...1a1f3cff45ec5aba4a520fae88b4f929eab8b3e8 Signed-off-by: Sebastiaan van Stijn --- cli/command/container/stats_helpers.go | 16 ++--- cli/command/container/stats_helpers_test.go | 32 +++++++--- cli/command/container/stats_unit_test.go | 30 --------- cli/command/image/build.go | 3 +- cli/command/service/update.go | 7 +-- cli/command/service/update_test.go | 33 +++++----- cli/compose/convert/service.go | 11 ++-- opts/ulimit.go | 13 ++-- opts/ulimit_test.go | 8 +-- vendor.mod | 2 +- vendor.sum | 4 +- vendor/github.com/docker/docker/AUTHORS | 20 +++++- .../github.com/docker/docker/api/swagger.yaml | 35 +++++++---- .../docker/docker/api/types/client.go | 5 +- .../docker/api/types/container/container.go | 11 +++- .../docker/api/types/container/hostconfig.go | 22 ++++--- .../docker/api/types/{ => container}/stats.go | 10 +-- .../docker/api/types/swarm/container.go | 4 +- .../docker/api/types/types_deprecated.go | 63 ++++++++++++++++++- .../docker/docker/client/container_stats.go | 12 ++-- .../docker/docker/client/interface.go | 4 +- .../github.com/docker/docker/registry/auth.go | 20 +++--- .../docker/docker/registry/search.go | 10 +-- vendor/modules.txt | 2 +- 24 files changed, 229 insertions(+), 148 deletions(-) delete mode 100644 cli/command/container/stats_unit_test.go rename vendor/github.com/docker/docker/api/types/{ => container}/stats.go (96%) diff --git a/cli/command/container/stats_helpers.go b/cli/command/container/stats_helpers.go index 938a3d83cd..c7084c17b5 100644 --- a/cli/command/container/stats_helpers.go +++ b/cli/command/container/stats_helpers.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "github.com/docker/docker/client" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -50,7 +50,7 @@ func (s *stats) isKnownContainer(cid string) (int, bool) { return -1, false } -func collect(ctx context.Context, s *Stats, cli client.APIClient, streamStats bool, waitFirst *sync.WaitGroup) { +func collect(ctx context.Context, s *Stats, cli client.ContainerAPIClient, streamStats bool, waitFirst *sync.WaitGroup) { logrus.Debugf("collecting stats for %s", s.Container) var ( getFirst bool @@ -78,7 +78,7 @@ func collect(ctx context.Context, s *Stats, cli client.APIClient, streamStats bo go func() { for { var ( - v *types.StatsJSON + v *container.StatsResponse memPercent, cpuPercent float64 blkRead, blkWrite uint64 // Only used on Linux mem, memLimit float64 @@ -163,7 +163,7 @@ func collect(ctx context.Context, s *Stats, cli client.APIClient, streamStats bo } } -func calculateCPUPercentUnix(previousCPU, previousSystem uint64, v *types.StatsJSON) float64 { +func calculateCPUPercentUnix(previousCPU, previousSystem uint64, v *container.StatsResponse) float64 { var ( cpuPercent = 0.0 // calculate the change for the cpu usage of the container in between readings @@ -182,7 +182,7 @@ func calculateCPUPercentUnix(previousCPU, previousSystem uint64, v *types.StatsJ return cpuPercent } -func calculateCPUPercentWindows(v *types.StatsJSON) float64 { +func calculateCPUPercentWindows(v *container.StatsResponse) float64 { // Max number of 100ns intervals between the previous time read and now possIntervals := uint64(v.Read.Sub(v.PreRead).Nanoseconds()) // Start with number of ns intervals possIntervals /= 100 // Convert to number of 100ns intervals @@ -198,7 +198,7 @@ func calculateCPUPercentWindows(v *types.StatsJSON) float64 { return 0.00 } -func calculateBlockIO(blkio types.BlkioStats) (uint64, uint64) { +func calculateBlockIO(blkio container.BlkioStats) (uint64, uint64) { var blkRead, blkWrite uint64 for _, bioEntry := range blkio.IoServiceBytesRecursive { if len(bioEntry.Op) == 0 { @@ -214,7 +214,7 @@ func calculateBlockIO(blkio types.BlkioStats) (uint64, uint64) { return blkRead, blkWrite } -func calculateNetwork(network map[string]types.NetworkStats) (float64, float64) { +func calculateNetwork(network map[string]container.NetworkStats) (float64, float64) { var rx, tx float64 for _, v := range network { @@ -236,7 +236,7 @@ func calculateNetwork(network map[string]types.NetworkStats) (float64, float64) // // On Docker 19.03 and older, the result was `mem.Usage - mem.Stats["cache"]`. // See https://github.com/moby/moby/issues/40727 for the background. -func calculateMemUsageUnixNoCache(mem types.MemoryStats) float64 { +func calculateMemUsageUnixNoCache(mem container.MemoryStats) float64 { // cgroup v1 if v, isCgroup1 := mem.Stats["total_inactive_file"]; isCgroup1 && v < mem.Usage { return float64(mem.Usage - v) diff --git a/cli/command/container/stats_helpers_test.go b/cli/command/container/stats_helpers_test.go index c6cd0eb924..7db44e2ee2 100644 --- a/cli/command/container/stats_helpers_test.go +++ b/cli/command/container/stats_helpers_test.go @@ -4,18 +4,12 @@ import ( "fmt" "testing" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "gotest.tools/v3/assert" ) func TestCalculateMemUsageUnixNoCache(t *testing.T) { - // Given - stats := types.MemoryStats{Usage: 500, Stats: map[string]uint64{"total_inactive_file": 400}} - - // When - result := calculateMemUsageUnixNoCache(stats) - - // Then + result := calculateMemUsageUnixNoCache(container.MemoryStats{Usage: 500, Stats: map[string]uint64{"total_inactive_file": 400}}) assert.Assert(t, inDelta(100.0, result, 1e-6)) } @@ -36,6 +30,28 @@ func TestCalculateMemPercentUnixNoCache(t *testing.T) { }) } +func TestCalculateBlockIO(t *testing.T) { + blkRead, blkWrite := calculateBlockIO(container.BlkioStats{ + IoServiceBytesRecursive: []container.BlkioStatEntry{ + {Major: 8, Minor: 0, Op: "read", Value: 1234}, + {Major: 8, Minor: 1, Op: "read", Value: 4567}, + {Major: 8, Minor: 0, Op: "Read", Value: 6}, + {Major: 8, Minor: 1, Op: "Read", Value: 8}, + {Major: 8, Minor: 0, Op: "write", Value: 123}, + {Major: 8, Minor: 1, Op: "write", Value: 456}, + {Major: 8, Minor: 0, Op: "Write", Value: 6}, + {Major: 8, Minor: 1, Op: "Write", Value: 8}, + {Major: 8, Minor: 1, Op: "", Value: 456}, + }, + }) + if blkRead != 5815 { + t.Fatalf("blkRead = %d, want 5815", blkRead) + } + if blkWrite != 593 { + t.Fatalf("blkWrite = %d, want 593", blkWrite) + } +} + func inDelta(x, y, delta float64) func() (bool, string) { return func() (bool, string) { diff := x - y diff --git a/cli/command/container/stats_unit_test.go b/cli/command/container/stats_unit_test.go deleted file mode 100644 index 9aac0ab939..0000000000 --- a/cli/command/container/stats_unit_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package container - -import ( - "testing" - - "github.com/docker/docker/api/types" -) - -func TestCalculateBlockIO(t *testing.T) { - blkio := types.BlkioStats{ - IoServiceBytesRecursive: []types.BlkioStatEntry{ - {Major: 8, Minor: 0, Op: "read", Value: 1234}, - {Major: 8, Minor: 1, Op: "read", Value: 4567}, - {Major: 8, Minor: 0, Op: "Read", Value: 6}, - {Major: 8, Minor: 1, Op: "Read", Value: 8}, - {Major: 8, Minor: 0, Op: "write", Value: 123}, - {Major: 8, Minor: 1, Op: "write", Value: 456}, - {Major: 8, Minor: 0, Op: "Write", Value: 6}, - {Major: 8, Minor: 1, Op: "Write", Value: 8}, - {Major: 8, Minor: 1, Op: "", Value: 456}, - }, - } - blkRead, blkWrite := calculateBlockIO(blkio) - if blkRead != 5815 { - t.Fatalf("blkRead = %d, want 5815", blkRead) - } - if blkWrite != 593 { - t.Fatalf("blkWrite = %d, want 593", blkWrite) - } -} diff --git a/cli/command/image/build.go b/cli/command/image/build.go index f19ac389bd..409b6cda18 100644 --- a/cli/command/image/build.go +++ b/cli/command/image/build.go @@ -29,7 +29,6 @@ import ( "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/pkg/progress" "github.com/docker/docker/pkg/streamformatter" - units "github.com/docker/go-units" "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -81,7 +80,7 @@ func (o buildOptions) contextFromStdin() bool { } func newBuildOptions() buildOptions { - ulimits := make(map[string]*units.Ulimit) + ulimits := make(map[string]*container.Ulimit) return buildOptions{ tags: opts.NewListOpts(validateTag), buildArgs: opts.NewListOpts(opts.ValidateEnv), diff --git a/cli/command/service/update.go b/cli/command/service/update.go index 5fa496ddd9..e02e19ccc8 100644 --- a/cli/command/service/update.go +++ b/cli/command/service/update.go @@ -17,7 +17,6 @@ import ( "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" - units "github.com/docker/go-units" "github.com/moby/swarmkit/v2/api/defaults" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -710,8 +709,8 @@ func updateSysCtls(flags *pflag.FlagSet, field *map[string]string) { } } -func updateUlimits(flags *pflag.FlagSet, ulimits []*units.Ulimit) []*units.Ulimit { - newUlimits := make(map[string]*units.Ulimit) +func updateUlimits(flags *pflag.FlagSet, ulimits []*container.Ulimit) []*container.Ulimit { + newUlimits := make(map[string]*container.Ulimit) for _, ulimit := range ulimits { newUlimits[ulimit.Name] = ulimit @@ -731,7 +730,7 @@ func updateUlimits(flags *pflag.FlagSet, ulimits []*units.Ulimit) []*units.Ulimi if len(newUlimits) == 0 { return nil } - limits := make([]*units.Ulimit, 0, len(newUlimits)) + limits := make([]*container.Ulimit, 0, len(newUlimits)) for _, ulimit := range newUlimits { limits = append(limits, ulimit) } diff --git a/cli/command/service/update_test.go b/cli/command/service/update_test.go index ccc5fac0cb..847b6efcb8 100644 --- a/cli/command/service/update_test.go +++ b/cli/command/service/update_test.go @@ -13,7 +13,6 @@ import ( mounttypes "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/swarm" - "github.com/docker/go-units" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" ) @@ -1600,66 +1599,66 @@ func TestUpdateUlimits(t *testing.T) { tests := []struct { name string - spec []*units.Ulimit + spec []*container.Ulimit rm []string add []string - expected []*units.Ulimit + expected []*container.Ulimit }{ { name: "from scratch", add: []string{"nofile=512:1024", "core=1024:1024"}, - expected: []*units.Ulimit{ + expected: []*container.Ulimit{ {Name: "core", Hard: 1024, Soft: 1024}, {Name: "nofile", Hard: 1024, Soft: 512}, }, }, { name: "append new", - spec: []*units.Ulimit{ + spec: []*container.Ulimit{ {Name: "nofile", Hard: 1024, Soft: 512}, }, add: []string{"core=1024:1024"}, - expected: []*units.Ulimit{ + expected: []*container.Ulimit{ {Name: "core", Hard: 1024, Soft: 1024}, {Name: "nofile", Hard: 1024, Soft: 512}, }, }, { name: "remove and append new should append", - spec: []*units.Ulimit{ + spec: []*container.Ulimit{ {Name: "core", Hard: 1024, Soft: 1024}, {Name: "nofile", Hard: 1024, Soft: 512}, }, rm: []string{"nofile=512:1024"}, add: []string{"nofile=512:1024"}, - expected: []*units.Ulimit{ + expected: []*container.Ulimit{ {Name: "core", Hard: 1024, Soft: 1024}, {Name: "nofile", Hard: 1024, Soft: 512}, }, }, { name: "update existing", - spec: []*units.Ulimit{ + spec: []*container.Ulimit{ {Name: "nofile", Hard: 2048, Soft: 1024}, }, add: []string{"nofile=512:1024"}, - expected: []*units.Ulimit{ + expected: []*container.Ulimit{ {Name: "nofile", Hard: 1024, Soft: 512}, }, }, { name: "update existing twice", - spec: []*units.Ulimit{ + spec: []*container.Ulimit{ {Name: "nofile", Hard: 2048, Soft: 1024}, }, add: []string{"nofile=256:512", "nofile=512:1024"}, - expected: []*units.Ulimit{ + expected: []*container.Ulimit{ {Name: "nofile", Hard: 1024, Soft: 512}, }, }, { name: "remove all", - spec: []*units.Ulimit{ + spec: []*container.Ulimit{ {Name: "core", Hard: 1024, Soft: 1024}, {Name: "nofile", Hard: 1024, Soft: 512}, }, @@ -1668,23 +1667,23 @@ func TestUpdateUlimits(t *testing.T) { }, { name: "remove by key", - spec: []*units.Ulimit{ + spec: []*container.Ulimit{ {Name: "core", Hard: 1024, Soft: 1024}, {Name: "nofile", Hard: 1024, Soft: 512}, }, rm: []string{"core"}, - expected: []*units.Ulimit{ + expected: []*container.Ulimit{ {Name: "nofile", Hard: 1024, Soft: 512}, }, }, { name: "remove by key and different value", - spec: []*units.Ulimit{ + spec: []*container.Ulimit{ {Name: "core", Hard: 1024, Soft: 1024}, {Name: "nofile", Hard: 1024, Soft: 512}, }, rm: []string{"core=1234:5678"}, - expected: []*units.Ulimit{ + expected: []*container.Ulimit{ {Name: "nofile", Hard: 1024, Soft: 512}, }, }, diff --git a/cli/compose/convert/service.go b/cli/compose/convert/service.go index ccff547ce9..62cadf57e7 100644 --- a/cli/compose/convert/service.go +++ b/cli/compose/convert/service.go @@ -14,7 +14,6 @@ import ( "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" - "github.com/docker/go-units" "github.com/pkg/errors" ) @@ -693,24 +692,24 @@ func convertCredentialSpec(namespace Namespace, spec composetypes.CredentialSpec return &swarmCredSpec, nil } -func convertUlimits(origUlimits map[string]*composetypes.UlimitsConfig) []*units.Ulimit { - newUlimits := make(map[string]*units.Ulimit) +func convertUlimits(origUlimits map[string]*composetypes.UlimitsConfig) []*container.Ulimit { + newUlimits := make(map[string]*container.Ulimit) for name, u := range origUlimits { if u.Single != 0 { - newUlimits[name] = &units.Ulimit{ + newUlimits[name] = &container.Ulimit{ Name: name, Soft: int64(u.Single), Hard: int64(u.Single), } } else { - newUlimits[name] = &units.Ulimit{ + newUlimits[name] = &container.Ulimit{ Name: name, Soft: int64(u.Soft), Hard: int64(u.Hard), } } } - ulimits := make([]*units.Ulimit, 0, len(newUlimits)) + ulimits := make([]*container.Ulimit, 0, len(newUlimits)) for _, ulimit := range newUlimits { ulimits = append(ulimits, ulimit) } diff --git a/opts/ulimit.go b/opts/ulimit.go index 5176b999a5..1409a109bc 100644 --- a/opts/ulimit.go +++ b/opts/ulimit.go @@ -4,24 +4,27 @@ import ( "fmt" "sort" + "github.com/docker/docker/api/types/container" "github.com/docker/go-units" ) // UlimitOpt defines a map of Ulimits type UlimitOpt struct { - values *map[string]*units.Ulimit + values *map[string]*container.Ulimit } // NewUlimitOpt creates a new UlimitOpt. Ulimits are not validated. -func NewUlimitOpt(ref *map[string]*units.Ulimit) *UlimitOpt { +func NewUlimitOpt(ref *map[string]*container.Ulimit) *UlimitOpt { + // TODO(thaJeztah): why do we need a map with pointers here? if ref == nil { - ref = &map[string]*units.Ulimit{} + ref = &map[string]*container.Ulimit{} } return &UlimitOpt{ref} } // Set validates a Ulimit and sets its name as a key in UlimitOpt func (o *UlimitOpt) Set(val string) error { + // FIXME(thaJeztah): these functions also need to be moved over from go-units. l, err := units.ParseUlimit(val) if err != nil { return err @@ -43,8 +46,8 @@ func (o *UlimitOpt) String() string { } // GetList returns a slice of pointers to Ulimits. Values are sorted by name. -func (o *UlimitOpt) GetList() []*units.Ulimit { - ulimits := make([]*units.Ulimit, 0, len(*o.values)) +func (o *UlimitOpt) GetList() []*container.Ulimit { + ulimits := make([]*container.Ulimit, 0, len(*o.values)) for _, v := range *o.values { ulimits = append(ulimits, v) } diff --git a/opts/ulimit_test.go b/opts/ulimit_test.go index e3e7f64b72..3a0753d159 100644 --- a/opts/ulimit_test.go +++ b/opts/ulimit_test.go @@ -3,12 +3,12 @@ package opts import ( "testing" - "github.com/docker/go-units" + "github.com/docker/docker/api/types/container" "gotest.tools/v3/assert" ) func TestUlimitOpt(t *testing.T) { - ulimitMap := map[string]*units.Ulimit{ + ulimitMap := map[string]*container.Ulimit{ "nofile": {Name: "nofile", Hard: 1024, Soft: 512}, } @@ -37,12 +37,12 @@ func TestUlimitOpt(t *testing.T) { } func TestUlimitOptSorting(t *testing.T) { - ulimitOpt := NewUlimitOpt(&map[string]*units.Ulimit{ + ulimitOpt := NewUlimitOpt(&map[string]*container.Ulimit{ "nofile": {Name: "nofile", Hard: 1024, Soft: 512}, "core": {Name: "core", Hard: 1024, Soft: 1024}, }) - expected := []*units.Ulimit{ + expected := []*container.Ulimit{ {Name: "core", Hard: 1024, Soft: 1024}, {Name: "nofile", Hard: 1024, Soft: 512}, } diff --git a/vendor.mod b/vendor.mod index 4303845f81..16c353a20c 100644 --- a/vendor.mod +++ b/vendor.mod @@ -12,7 +12,7 @@ require ( github.com/creack/pty v1.1.21 github.com/distribution/reference v0.6.0 github.com/docker/distribution v2.8.3+incompatible - github.com/docker/docker v27.0.0-rc.2+incompatible + github.com/docker/docker v27.0.0-rc.2.0.20240620105908-1a1f3cff45ec+incompatible // master (v27.0-dev) github.com/docker/docker-credential-helpers v0.8.2 github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 diff --git a/vendor.sum b/vendor.sum index d0badad447..0865547c7c 100644 --- a/vendor.sum +++ b/vendor.sum @@ -57,8 +57,8 @@ github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5 github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= 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 v27.0.0-rc.2+incompatible h1:7h252klGbyDOfTpCxKFriEJSj8SpShcOwz9shs1k2n8= -github.com/docker/docker v27.0.0-rc.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v27.0.0-rc.2.0.20240620105908-1a1f3cff45ec+incompatible h1:lN0HDqbNJr4SrjQyG7dko0wE6hxVSXXCNAw8DTO1Wm4= +github.com/docker/docker v27.0.0-rc.2.0.20240620105908-1a1f3cff45ec+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo= github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= diff --git a/vendor/github.com/docker/docker/AUTHORS b/vendor/github.com/docker/docker/AUTHORS index 36315d429d..5f93eeb4e8 100644 --- a/vendor/github.com/docker/docker/AUTHORS +++ b/vendor/github.com/docker/docker/AUTHORS @@ -10,6 +10,7 @@ Aaron Huslage Aaron L. Xu Aaron Lehmann Aaron Welch +Aaron Yoshitake Abel Muiño Abhijeet Kasurde Abhinandan Prativadi @@ -62,6 +63,7 @@ alambike Alan Hoyle Alan Scherger Alan Thompson +Alano Terblanche Albert Callarisa Albert Zhang Albin Kerouanton @@ -141,6 +143,7 @@ Andreas Tiefenthaler Andrei Gherzan Andrei Ushakov Andrei Vagin +Andrew Baxter <423qpsxzhh8k3h@s.rendaw.me> Andrew C. Bodine Andrew Clay Shafer Andrew Duckworth @@ -193,6 +196,7 @@ Anton Löfgren Anton Nikitin Anton Polonskiy Anton Tiurin +Antonio Aguilar Antonio Murdaca Antonis Kalipetis Antony Messerli @@ -221,7 +225,6 @@ Avi Das Avi Kivity Avi Miller Avi Vaid -ayoshitake Azat Khuyiyakhmetov Bao Yonglei Bardia Keyoumarsi @@ -316,6 +319,7 @@ Burke Libbey Byung Kang Caleb Spare Calen Pennington +Calvin Liu Cameron Boehmer Cameron Sparr Cameron Spear @@ -362,6 +366,7 @@ Chen Qiu Cheng-mean Liu Chengfei Shang Chengguang Xu +Chentianze Chenyang Yan chenyuzhu Chetan Birajdar @@ -409,6 +414,7 @@ Christopher Crone Christopher Currie Christopher Jones Christopher Latham +Christopher Petito Christopher Rigor Christy Norman Chun Chen @@ -777,6 +783,7 @@ Gabriel L. Somlo Gabriel Linder Gabriel Monroy Gabriel Nicolas Avellaneda +Gabriel Tomitsuka Gaetan de Villele Galen Sampson Gang Qiao @@ -792,6 +799,7 @@ Geoff Levand Geoffrey Bachelet Geon Kim George Kontridze +George Ma George MacRorie George Xie Georgi Hristozov @@ -913,6 +921,7 @@ Illo Abdulrahim Ilya Dmitrichenko Ilya Gusev Ilya Khlopotov +imalasong <2879499479@qq.com> imre Fitos inglesp Ingo Gottwald @@ -930,6 +939,7 @@ J Bruni J. Nunn Jack Danger Canty Jack Laxson +Jack Walker <90711509+j2walker@users.noreply.github.com> Jacob Atzen Jacob Edelman Jacob Tomlinson @@ -989,6 +999,7 @@ Jason Shepherd Jason Smith Jason Sommer Jason Stangroome +Jasper Siepkes Javier Bassi jaxgeller Jay @@ -1100,6 +1111,7 @@ Jon Johnson Jon Surrell Jon Wedaman Jonas Dohse +Jonas Geiler Jonas Heinrich Jonas Pfenniger Jonathan A. Schweder @@ -1267,6 +1279,7 @@ Lakshan Perera Lalatendu Mohanty Lance Chen Lance Kinley +Lars Andringa Lars Butler Lars Kellogg-Stedman Lars R. Damerow @@ -1673,6 +1686,7 @@ Patrick Böänziger Patrick Devine Patrick Haas Patrick Hemmer +Patrick St. laurent Patrick Stapleton Patrik Cyvoct pattichen @@ -1878,6 +1892,7 @@ Royce Remer Rozhnov Alexandr Rudolph Gottesheim Rui Cao +Rui JingAn Rui Lopes Ruilin Li Runshen Zhu @@ -2184,6 +2199,7 @@ Tomek Mańko Tommaso Visconti Tomoya Tabuchi Tomáš Hrčka +Tomáš Virtus tonic Tonny Xu Tony Abboud @@ -2228,6 +2244,7 @@ Victor I. Wood Victor Lyuboslavsky Victor Marmol Victor Palma +Victor Toni Victor Vieux Victoria Bialas Vijaya Kumar K @@ -2279,6 +2296,7 @@ Wassim Dhif Wataru Ishida Wayne Chang Wayne Song +weebney Weerasak Chongnguluam Wei Fu Wei Wu diff --git a/vendor/github.com/docker/docker/api/swagger.yaml b/vendor/github.com/docker/docker/api/swagger.yaml index d879fb0bdd..d740c9b227 100644 --- a/vendor/github.com/docker/docker/api/swagger.yaml +++ b/vendor/github.com/docker/docker/api/swagger.yaml @@ -2059,7 +2059,7 @@ definitions: Depending on how the image was created, this field may be empty. type: "string" x-nullable: false - example: "20.10.7" + example: "27.0.1" Author: description: | Name of the author that was specified when committing the image, or as @@ -4102,6 +4102,13 @@ definitions: but this is just provided for lookup/display purposes. The secret in the reference will be identified by its ID. type: "string" + OomScoreAdj: + type: "integer" + format: "int64" + description: | + An integer value containing the score given to the container in + order to tune OOM killer preferences. + example: 0 Configs: description: | Configs contains references to zero or more configs that will be @@ -4298,7 +4305,7 @@ definitions: `node.platform.os` | Node operating system | `node.platform.os==windows` `node.platform.arch` | Node architecture | `node.platform.arch==x86_64` `node.labels` | User-defined node labels | `node.labels.security==high` - `engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04` + `engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-24.04` `engine.labels` apply to Docker Engine labels like operating system, drivers, etc. Swarm administrators add `node.labels` for operational @@ -5295,7 +5302,7 @@ definitions: Version of the component type: "string" x-nullable: false - example: "19.03.12" + example: "27.0.1" Details: description: | Key/value pairs of strings with additional information about the @@ -5309,17 +5316,17 @@ definitions: Version: description: "The version of the daemon" type: "string" - example: "19.03.12" + example: "27.0.1" ApiVersion: description: | The default (and highest) API version that is supported by the daemon type: "string" - example: "1.40" + example: "1.46" MinAPIVersion: description: | The minimum API version that is supported by the daemon type: "string" - example: "1.12" + example: "1.24" GitCommit: description: | The Git commit of the source code that was used to build the daemon @@ -5330,7 +5337,7 @@ definitions: The version Go used to compile the daemon, and the version of the Go runtime in use. type: "string" - example: "go1.13.14" + example: "go1.21.11" Os: description: | The operating system that the daemon is running on ("linux" or "windows") @@ -5347,7 +5354,7 @@ definitions: This field is omitted when empty. type: "string" - example: "4.19.76-linuxkit" + example: "6.8.0-31-generic" Experimental: description: | Indicates if the daemon is started with experimental features enabled. @@ -5553,13 +5560,13 @@ definitions: information is queried from the HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ registry value, for example _"10.0 14393 (14393.1198.amd64fre.rs1_release_sec.170427-1353)"_. type: "string" - example: "4.9.38-moby" + example: "6.8.0-31-generic" OperatingSystem: description: | - Name of the host's operating system, for example: "Ubuntu 16.04.2 LTS" + Name of the host's operating system, for example: "Ubuntu 24.04 LTS" or "Windows Server 2016 Datacenter" type: "string" - example: "Alpine Linux v3.5" + example: "Ubuntu 24.04 LTS" OSVersion: description: | Version of the host's operating system @@ -5570,7 +5577,7 @@ definitions: > very existence, and the formatting of values, should not be considered > stable, and may change without notice. type: "string" - example: "16.04" + example: "24.04" OSType: description: | Generic type of the operating system of the host, as returned by the @@ -5672,7 +5679,7 @@ definitions: description: | Version string of the daemon. type: "string" - example: "24.0.2" + example: "27.0.1" Runtimes: description: | List of [OCI compliant](https://github.com/opencontainers/runtime-spec) @@ -11722,6 +11729,7 @@ paths: Mode: 384 SecretID: "fpjqlhnwb19zds35k8wn80lq9" SecretName: "example_org_domain_key" + OomScoreAdj: 0 LogDriver: Name: "json-file" Options: @@ -11874,6 +11882,7 @@ paths: Image: "busybox" Args: - "top" + OomScoreAdj: 0 Resources: Limits: {} Reservations: {} diff --git a/vendor/github.com/docker/docker/api/types/client.go b/vendor/github.com/docker/docker/api/types/client.go index c57acd5c9c..df791f02a0 100644 --- a/vendor/github.com/docker/docker/api/types/client.go +++ b/vendor/github.com/docker/docker/api/types/client.go @@ -9,7 +9,6 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/registry" - units "github.com/docker/go-units" ) // NewHijackedResponse intializes a HijackedResponse type @@ -74,7 +73,7 @@ type ImageBuildOptions struct { NetworkMode string ShmSize int64 Dockerfile string - Ulimits []*units.Ulimit + Ulimits []*container.Ulimit // BuildArgs needs to be a *string instead of just a string so that // we can tell the difference between "" (empty string) and no value // at all (nil). See the parsing of buildArgs in @@ -95,7 +94,7 @@ type ImageBuildOptions struct { Target string SessionID string Platform string - // Version specifies the version of the unerlying builder to use + // Version specifies the version of the underlying builder to use Version BuilderVersion // BuildID is an optional identifier that can be passed together with the // build request. The same identifier can be used to gracefully cancel the diff --git a/vendor/github.com/docker/docker/api/types/container/container.go b/vendor/github.com/docker/docker/api/types/container/container.go index 5ee2bec0dd..711af12c99 100644 --- a/vendor/github.com/docker/docker/api/types/container/container.go +++ b/vendor/github.com/docker/docker/api/types/container/container.go @@ -31,9 +31,14 @@ type CopyToContainerOptions struct { CopyUIDGID bool } -// StatsResponse contains response of Engine API: -// GET "/stats" -type StatsResponse struct { +// StatsResponseReader wraps an io.ReadCloser to read (a stream of) stats +// for a container, as produced by the GET "/stats" endpoint. +// +// The OSType field is set to the server's platform to allow +// platform-specific handling of the response. +// +// TODO(thaJeztah): remove this wrapper, and make OSType part of [StatsResponse]. +type StatsResponseReader struct { Body io.ReadCloser `json:"body"` OSType string `json:"ostype"` } diff --git a/vendor/github.com/docker/docker/api/types/container/hostconfig.go b/vendor/github.com/docker/docker/api/types/container/hostconfig.go index efb96266e8..727da8839c 100644 --- a/vendor/github.com/docker/docker/api/types/container/hostconfig.go +++ b/vendor/github.com/docker/docker/api/types/container/hostconfig.go @@ -360,6 +360,12 @@ type LogConfig struct { Config map[string]string } +// Ulimit is an alias for [units.Ulimit], which may be moving to a different +// location or become a local type. This alias is to help transitioning. +// +// Users are recommended to use this alias instead of using [units.Ulimit] directly. +type Ulimit = units.Ulimit + // Resources contains container's resources (cgroups config, ulimits...) type Resources struct { // Applicable to all platforms @@ -387,14 +393,14 @@ type Resources struct { // KernelMemory specifies the kernel memory limit (in bytes) for the container. // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes. - KernelMemory int64 `json:",omitempty"` - KernelMemoryTCP int64 `json:",omitempty"` // Hard limit for kernel TCP buffer memory (in bytes) - MemoryReservation int64 // Memory soft limit (in bytes) - MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap - MemorySwappiness *int64 // Tuning container memory swappiness behaviour - OomKillDisable *bool // Whether to disable OOM Killer or not - PidsLimit *int64 // Setting PIDs limit for a container; Set `0` or `-1` for unlimited, or `null` to not change. - Ulimits []*units.Ulimit // List of ulimits to be set in the container + KernelMemory int64 `json:",omitempty"` + KernelMemoryTCP int64 `json:",omitempty"` // Hard limit for kernel TCP buffer memory (in bytes) + MemoryReservation int64 // Memory soft limit (in bytes) + MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap + MemorySwappiness *int64 // Tuning container memory swappiness behaviour + OomKillDisable *bool // Whether to disable OOM Killer or not + PidsLimit *int64 // Setting PIDs limit for a container; Set `0` or `-1` for unlimited, or `null` to not change. + Ulimits []*Ulimit // List of ulimits to be set in the container // Applicable to Windows CPUCount int64 `json:"CpuCount"` // CPU count diff --git a/vendor/github.com/docker/docker/api/types/stats.go b/vendor/github.com/docker/docker/api/types/container/stats.go similarity index 96% rename from vendor/github.com/docker/docker/api/types/stats.go rename to vendor/github.com/docker/docker/api/types/container/stats.go index 20daebed14..3b3fb131a2 100644 --- a/vendor/github.com/docker/docker/api/types/stats.go +++ b/vendor/github.com/docker/docker/api/types/container/stats.go @@ -1,6 +1,4 @@ -// Package types is used for API stability in the types and response to the -// consumers of the API stats endpoint. -package types // import "github.com/docker/docker/api/types" +package container import "time" @@ -169,8 +167,10 @@ type Stats struct { MemoryStats MemoryStats `json:"memory_stats,omitempty"` } -// StatsJSON is newly used Networks -type StatsJSON struct { +// StatsResponse is newly used Networks. +// +// TODO(thaJeztah): unify with [Stats]. This wrapper was to account for pre-api v1.21 changes, see https://github.com/moby/moby/commit/d3379946ec96fb6163cb8c4517d7d5a067045801 +type StatsResponse struct { Stats Name string `json:"name,omitempty"` diff --git a/vendor/github.com/docker/docker/api/types/swarm/container.go b/vendor/github.com/docker/docker/api/types/swarm/container.go index 65f61d2d20..30e3de70c0 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/container.go +++ b/vendor/github.com/docker/docker/api/types/swarm/container.go @@ -5,7 +5,6 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/mount" - "github.com/docker/go-units" ) // DNSConfig specifies DNS related configurations in resolver configuration file (resolv.conf) @@ -115,5 +114,6 @@ type ContainerSpec struct { Sysctls map[string]string `json:",omitempty"` CapabilityAdd []string `json:",omitempty"` CapabilityDrop []string `json:",omitempty"` - Ulimits []*units.Ulimit `json:",omitempty"` + Ulimits []*container.Ulimit `json:",omitempty"` + OomScoreAdj int64 `json:",omitempty"` } diff --git a/vendor/github.com/docker/docker/api/types/types_deprecated.go b/vendor/github.com/docker/docker/api/types/types_deprecated.go index af345810d0..8edf70b7c8 100644 --- a/vendor/github.com/docker/docker/api/types/types_deprecated.go +++ b/vendor/github.com/docker/docker/api/types/types_deprecated.go @@ -111,8 +111,69 @@ type CopyToContainerOptions = container.CopyToContainerOptions // ContainerStats contains response of Engine API: // GET "/stats" // +// Deprecated: use [container.StatsResponseReader]. +type ContainerStats = container.StatsResponseReader + +// ThrottlingData stores CPU throttling stats of one running container. +// Not used on Windows. +// +// Deprecated: use [container.ThrottlingData]. +type ThrottlingData = container.ThrottlingData + +// CPUUsage stores All CPU stats aggregated since container inception. +// +// Deprecated: use [container.CPUUsage]. +type CPUUsage = container.CPUUsage + +// CPUStats aggregates and wraps all CPU related info of container +// +// Deprecated: use [container.CPUStats]. +type CPUStats = container.CPUStats + +// MemoryStats aggregates all memory stats since container inception on Linux. +// Windows returns stats for commit and private working set only. +// +// Deprecated: use [container.MemoryStats]. +type MemoryStats = container.MemoryStats + +// BlkioStatEntry is one small entity to store a piece of Blkio stats +// Not used on Windows. +// +// Deprecated: use [container.BlkioStatEntry]. +type BlkioStatEntry = container.BlkioStatEntry + +// BlkioStats stores All IO service stats for data read and write. +// This is a Linux specific structure as the differences between expressing +// block I/O on Windows and Linux are sufficiently significant to make +// little sense attempting to morph into a combined structure. +// +// Deprecated: use [container.BlkioStats]. +type BlkioStats = container.BlkioStats + +// StorageStats is the disk I/O stats for read/write on Windows. +// +// Deprecated: use [container.StorageStats]. +type StorageStats = container.StorageStats + +// NetworkStats aggregates the network stats of one container +// +// Deprecated: use [container.NetworkStats]. +type NetworkStats = container.NetworkStats + +// PidsStats contains the stats of a container's pids +// +// Deprecated: use [container.PidsStats]. +type PidsStats = container.PidsStats + +// Stats is Ultimate struct aggregating all types of stats of one container +// +// Deprecated: use [container.Stats]. +type Stats = container.Stats + +// StatsJSON is newly used Networks +// // Deprecated: use [container.StatsResponse]. -type ContainerStats = container.StatsResponse +type StatsJSON = container.StatsResponse // EventsOptions holds parameters to filter events with. // diff --git a/vendor/github.com/docker/docker/client/container_stats.go b/vendor/github.com/docker/docker/client/container_stats.go index d0e2a30777..b5641daee9 100644 --- a/vendor/github.com/docker/docker/client/container_stats.go +++ b/vendor/github.com/docker/docker/client/container_stats.go @@ -9,7 +9,7 @@ import ( // ContainerStats returns near realtime stats for a given container. // It's up to the caller to close the io.ReadCloser returned. -func (cli *Client) ContainerStats(ctx context.Context, containerID string, stream bool) (container.StatsResponse, error) { +func (cli *Client) ContainerStats(ctx context.Context, containerID string, stream bool) (container.StatsResponseReader, error) { query := url.Values{} query.Set("stream", "0") if stream { @@ -18,10 +18,10 @@ func (cli *Client) ContainerStats(ctx context.Context, containerID string, strea resp, err := cli.get(ctx, "/containers/"+containerID+"/stats", query, nil) if err != nil { - return container.StatsResponse{}, err + return container.StatsResponseReader{}, err } - return container.StatsResponse{ + return container.StatsResponseReader{ Body: resp.body, OSType: getDockerOS(resp.header.Get("Server")), }, nil @@ -29,17 +29,17 @@ func (cli *Client) ContainerStats(ctx context.Context, containerID string, strea // ContainerStatsOneShot gets a single stat entry from a container. // It differs from `ContainerStats` in that the API should not wait to prime the stats -func (cli *Client) ContainerStatsOneShot(ctx context.Context, containerID string) (container.StatsResponse, error) { +func (cli *Client) ContainerStatsOneShot(ctx context.Context, containerID string) (container.StatsResponseReader, error) { query := url.Values{} query.Set("stream", "0") query.Set("one-shot", "1") resp, err := cli.get(ctx, "/containers/"+containerID+"/stats", query, nil) if err != nil { - return container.StatsResponse{}, err + return container.StatsResponseReader{}, err } - return container.StatsResponse{ + return container.StatsResponseReader{ Body: resp.body, OSType: getDockerOS(resp.header.Get("Server")), }, nil diff --git a/vendor/github.com/docker/docker/client/interface.go b/vendor/github.com/docker/docker/client/interface.go index 9a7723de77..cc60a5d13b 100644 --- a/vendor/github.com/docker/docker/client/interface.go +++ b/vendor/github.com/docker/docker/client/interface.go @@ -67,8 +67,8 @@ type ContainerAPIClient interface { ContainerResize(ctx context.Context, container string, options container.ResizeOptions) error ContainerRestart(ctx context.Context, container string, options container.StopOptions) error ContainerStatPath(ctx context.Context, container, path string) (container.PathStat, error) - ContainerStats(ctx context.Context, container string, stream bool) (container.StatsResponse, error) - ContainerStatsOneShot(ctx context.Context, container string) (container.StatsResponse, error) + ContainerStats(ctx context.Context, container string, stream bool) (container.StatsResponseReader, error) + ContainerStatsOneShot(ctx context.Context, container string) (container.StatsResponseReader, error) ContainerStart(ctx context.Context, container string, options container.StartOptions) error ContainerStop(ctx context.Context, container string, options container.StopOptions) error ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error) diff --git a/vendor/github.com/docker/docker/registry/auth.go b/vendor/github.com/docker/docker/registry/auth.go index f685892c1f..905ccf5f51 100644 --- a/vendor/github.com/docker/docker/registry/auth.go +++ b/vendor/github.com/docker/docker/registry/auth.go @@ -108,16 +108,18 @@ func v2AuthHTTPClient(endpoint *url.URL, authTransport http.RoundTripper, modifi return nil, err } - tokenHandlerOptions := auth.TokenHandlerOptions{ - Transport: authTransport, - Credentials: creds, - OfflineAccess: true, - ClientID: AuthClientID, - Scopes: scopes, + authHandlers := []auth.AuthenticationHandler{ + auth.NewTokenHandlerWithOptions(auth.TokenHandlerOptions{ + Transport: authTransport, + Credentials: creds, + OfflineAccess: true, + ClientID: AuthClientID, + Scopes: scopes, + }), + auth.NewBasicHandler(creds), } - tokenHandler := auth.NewTokenHandlerWithOptions(tokenHandlerOptions) - basicHandler := auth.NewBasicHandler(creds) - modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, tokenHandler, basicHandler)) + + modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, authHandlers...)) return &http.Client{ Transport: transport.NewTransport(authTransport, modifiers...), diff --git a/vendor/github.com/docker/docker/registry/search.go b/vendor/github.com/docker/docker/registry/search.go index 5c79e9968b..4ce90f55d4 100644 --- a/vendor/github.com/docker/docker/registry/search.go +++ b/vendor/github.com/docker/docker/registry/search.go @@ -112,16 +112,12 @@ func (s *Service) searchUnfiltered(ctx context.Context, term string, limit int, var client *http.Client if authConfig != nil && authConfig.IdentityToken != "" && authConfig.Username != "" { creds := NewStaticCredentialStore(authConfig) - scopes := []auth.Scope{ - auth.RegistryScope{ - Name: "catalog", - Actions: []string{"search"}, - }, - } // TODO(thaJeztah); is there a reason not to include other headers here? (originally added in 19d48f0b8ba59eea9f2cac4ad1c7977712a6b7ac) modifiers := Headers(headers.Get("User-Agent"), nil) - v2Client, err := v2AuthHTTPClient(endpoint.URL, endpoint.client.Transport, modifiers, creds, scopes) + v2Client, err := v2AuthHTTPClient(endpoint.URL, endpoint.client.Transport, modifiers, creds, []auth.Scope{ + auth.RegistryScope{Name: "catalog", Actions: []string{"search"}}, + }) if err != nil { return nil, err } diff --git a/vendor/modules.txt b/vendor/modules.txt index 2874340121..cbecda72bb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -53,7 +53,7 @@ github.com/docker/distribution/registry/client/transport github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache/memory github.com/docker/distribution/uuid -# github.com/docker/docker v27.0.0-rc.2+incompatible +# github.com/docker/docker v27.0.0-rc.2.0.20240620105908-1a1f3cff45ec+incompatible ## explicit github.com/docker/docker/api github.com/docker/docker/api/types