Commit graph

3589 commits

Author SHA1 Message Date
Sebastiaan van Stijn
1bd486666b
api/types/container: use strings.Cut() and DRY
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-27 22:31:37 +01:00
Sebastiaan van Stijn
ab5e69c442
api/types/container: rewrite tests to use subtests and asserts
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-27 22:31:37 +01:00
Sebastiaan van Stijn
e155cb4fee
hostconfig: move unit tests to api/types/container
These types were moved to api/types/container in 7ac4232e70,
but the unit-tests for them were not moved. This patch moves the unit-tests back together
with the types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-27 22:31:37 +01:00
Sebastiaan van Stijn
380a2dfc3a
api/types: use strings.Cut()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-21 11:09:00 +01:00
Sebastiaan van Stijn
7841ce781c
api/types/time: use strings.Cut()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-21 11:09:00 +01:00
Sebastiaan van Stijn
ba9bcf92f6
api/types/filters: use strings.Cut()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-21 11:08:59 +01:00
Nicolas De Loof
8fb71ce208
manage image inspect data in backend
This allows differentiating how the detailed data is collected between
the containerd-integration code and the existing implementation.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-09 19:02:12 +01:00
Sebastiaan van Stijn
a8eb15eafb
ImageService.ImageHistory(): pass context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-09 19:00:49 +01:00
Nicolas De Loof
def549c8f6
imageservice: Add context to various methods
Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2022-11-03 12:22:40 +01:00
Sebastiaan van Stijn
5a01c1dad1
Merge pull request #44383 from thaJeztah/improve_example
api/types/filters: add output to example
2022-11-02 17:29:37 +01:00
Nicolas De Loof
8d0dc69027
implement docker system df
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-11-02 09:35:18 +01:00
Sebastiaan van Stijn
3d73d32499
api/types/filters: add output to example
Make the example actually do something, and include the output, so that it
shows up in the documentation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-01 18:16:22 +01:00
Brian Goff
7b1245dc7f
Merge pull request #44224 from dperny/cluster-volumes-update
Fix force-remove for cluster volumes
2022-10-25 11:13:43 -07:00
Drew Erny
3246db3755 fix force remove for cluster volumes
Signed-off-by: Drew Erny <derny@mirantis.com>
2022-10-12 11:31:00 -05:00
Brian Goff
618f26ccbc Volume prune: only prune anonymous volumes by default
This adds a new filter argument to the volume prune endpoint "all".
When this is not set, or it is a false-y value, then only anonymous
volumes are considered for pruning.

When `all` is set to a truth-y value, you get the old behavior.

This is an API change, but I think one that is what most people would
want.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-04 20:55:13 +00:00
Sebastiaan van Stijn
f71fe8476a
api/server: fix empty-lines (revive)
api/server/router/build/build_routes.go:239:32: empty-lines: extra empty line at the start of a block (revive)
    api/server/middleware/version.go:45:241: empty-lines: extra empty line at the end of a block (revive)
    api/server/router/swarm/helpers_test.go:11:44: empty-lines: extra empty line at the end of a block (revive)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-28 01:58:51 +02:00
Sebastiaan van Stijn
31441778fa
api/types: fix empty-lines (revive)
Also renamed variables that collided with import

     api/types/strslice/strslice_test.go:36:41: empty-lines: extra empty line at the end of a block (revive)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-28 01:58:49 +02:00
Sebastiaan van Stijn
db1663a1e5
Merge pull request #44205 from thaJeztah/remove_deprecated_stubs
Remove stubs for deprecated functions and consts
2022-09-28 01:51:04 +02:00
Sebastiaan van Stijn
4a8b3b8bc5
api/types: remove aliases for deprecated Volume and VolumeUsageData
These were moved, and deprecated in f19ef20a44 and
4caf68f4f6, which are part of the 22.x release, so
we can safely remove these from master.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-27 21:44:15 +02:00
Sebastiaan van Stijn
91f14e751f
Merge pull request #44111 from thaJeztah/remove_tagger
api/server/backend/build: remove Tagger and NewTagger
2022-09-27 21:04:16 +02:00
CrazyMax
7f3602f1c9
swagger: update links to logo
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-09-27 11:56:14 +02:00
Sebastiaan van Stijn
55fd77f724
set ReadHeaderTimeout to address G112: Potential Slowloris Attack (gosec)
After discussing in the maintainers meeting, we concluded that Slowloris attacks
are not a real risk other than potentially having some additional goroutines
lingering around, so setting a long timeout to satisfy the linter, and to at
least have "some" timeout.

    libnetwork/diagnostic/server.go:96:10: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec)
        srv := &http.Server{
            Addr:    net.JoinHostPort(ip, strconv.Itoa(port)),
            Handler: s,
        }
    api/server/server.go:60:10: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec)
                srv: &http.Server{
                    Addr: addr,
                },
    daemon/metrics_unix.go:34:13: G114: Use of net/http serve function that has no support for setting timeouts (gosec)
            if err := http.Serve(l, mux); err != nil && !strings.Contains(err.Error(), "use of closed network connection") {
                      ^
    cmd/dockerd/metrics.go:27:13: G114: Use of net/http serve function that has no support for setting timeouts (gosec)
            if err := http.Serve(l, mux); err != nil && !strings.Contains(err.Error(), "use of closed network connection") {
                      ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-22 12:13:28 +02:00
Sebastiaan van Stijn
ff81dc3544
api/server/backend/build: remove Tagger and NewTagger
The Tagger was introduced in 0296797f0f, as part
of a refactor, but was never used outside of the package itself. The commit
also didn't explain why this was changed into a Type with a constructor, as all
the constructor appears to be used for is to sanitize and validate the tags.

This patch removes the `Tagger` struct and its constructor, and instead just
uses a function to do the same.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-07 20:36:00 +02:00
Sebastiaan van Stijn
779a5b3029 ImageService.GetImage(): pass context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2022-09-07 16:53:45 +02:00
Cory Snider
57d2d6ef62 Update container OOMKilled flag immediately
The OOMKilled flag on a container's state has historically behaved
rather unintuitively: it is updated on container exit to reflect whether
or not any process within the container has been OOM-killed during the
preceding run of the container. The OOMKilled flag would be set to true
when the container exits if any process within the container---including
execs---was OOM-killed at any time while the container was running,
whether or not the OOM-kill was the cause of the container exiting. The
flag is "sticky," persisting through the next start of the container;
only being cleared once the container exits without any processes having
been OOM-killed that run.

Alter the behavior of the OOMKilled flag such that it signals whether
any process in the container had been OOM-killed since the most recent
start of the container. Set the flag immediately upon any process being
OOM-killed, and clear it when the container transitions to the "running"
state.

There is an ulterior motive for this change. It reduces the amount of
state the libcontainerd client needs to keep track of and clean up on
container exit. It's one less place the client could leak memory if a
container was to be deleted without going through libcontainerd.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2022-08-24 14:59:07 -04:00
Sebastiaan van Stijn
ce550fa9c2
Merge pull request #43968 from thaJeztah/implement_GetImageOpts
introduce GetImageOpts to manage image inspect data in backend
2022-08-24 19:07:30 +02:00
Sebastiaan van Stijn
a4ac991d02
Merge pull request #43657 from thaJeztah/default_builder_version
api: set default "Builder-Version" to "2" (BuildKit) on Linux
2022-08-18 20:14:47 +02:00
Nicolas De Loof
9a849cc83a
introduce GetImageOpts to manage image inspect data in backend
Currently only provides the existing "platform" option, but more
options will be added in follow-ups.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-16 16:49:46 +02:00
Samuel Karp
af1edfd368
Merge pull request #43899 from thaJeztah/fix_build_api_errors 2022-08-13 16:21:38 -07:00
Tianon Gravi
4a14453d2d
Merge pull request #43883 from thaJeztah/image_router_warnings
api/server/router/image: address some linter warnings
2022-08-12 17:24:43 -07:00
Sebastiaan van Stijn
9861dd069b
vendor: github.com/moby/swarmkit/v2 v2.0.0-20220721174824-48dd89375d0a
full diff: 6068d1894d...48dd89375d

Finishes off the work to change references to cluster volumes in the API
from using "csi" as the magic word to "cluster". This reflects that the
volumes are "cluster volumes", not "csi volumes".

Notably, there is no change to the plugin definitions being "csinode"
and "csicontroller". This terminology is appropriate with regards to
plugins because it accurates reflects what the plugin is.

Signed-off-by: Drew Erny <derny@mirantis.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-09 14:03:50 +02:00
Sebastiaan van Stijn
acd0aa7d38
api/server/router/image: address some linter warnings
My IDE was complaining about some things;

- fix inconsistent receiver name (i vs s)
- fix some variables that collided with imports

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-08 13:07:50 +02:00
Sebastiaan van Stijn
2279803c8c
Merge pull request #43822 from thaJeztah/image_load_save
containerd integration: Implement load/save
2022-08-04 13:45:27 +02:00
Nicolas De Loof
50fb999bb1
add image load/save support
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-08-04 09:41:19 +02:00
Sebastiaan van Stijn
e0db8207f3
api: add BuildCache.Parents for API >= v1.42
This field was added to replace the deprecated "Parent" field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-04 09:30:06 +02:00
Sebastiaan van Stijn
ebf339628a
api: deprecate BuildCache.Parent in API >= v1.42
This field has been deprecated in BuildKit, so this follows the deprecation
in the Engine API.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-04 09:27:34 +02:00
Sebastiaan van Stijn
e0286d7f4e
api/types: add missing GoDoc for BuildCache fields.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-04 09:27:32 +02:00
Sebastiaan van Stijn
dc2b34af6a
api: swagger: document BuildCache fields.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-04 09:27:30 +02:00
Brian Goff
7e8df0e2c9
Merge pull request #43820 from thaJeztah/image_delete
containerd integration: Implement ImageDelete for containerd
2022-08-03 15:47:07 -07:00
Tianon Gravi
e60bddcc60
Merge pull request #43885 from thaJeztah/auth_header_refactor
Move AuthConfig to types/registry, and implement utilities for encoding/decoding
2022-08-03 11:31:26 -07:00
Sebastiaan van Stijn
0f5ac7761d
api: api/server/router/build: fix API errors
Some error conditions returned a non-typed error, which would be returned
as a 500 status by the API. This patch;

- Updates such errors to return an errdefs.InvalidParameter type
- Introduces a locally defined `invalidParam{}` type for convenience.
- Updates some error-strings to match Go conventions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-02 17:17:49 +02:00
Sebastiaan van Stijn
3dae8e9fc2
api: swagger: add missing "platform" query-arg on create
Commit 7a9cb29fb9 added a new "platform" query-
parameter to the `POST /containers/create` endpoint, but did not update the
swagger file and documentation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-29 23:19:51 +02:00
Sebastiaan van Stijn
7ca66e3cfc
api: add registry.EncodeAuthConfig
Based on EncodeAuthToBase64 in docker/cli;
1f4111d2bf/cli/command/registry.go (L30-L37)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-29 23:11:19 +02:00
Sebastiaan van Stijn
7819811835
api: add registry.DecodeAuthConfig, registry.DecodeAuthConfigBody
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-29 23:11:13 +02:00
Sebastiaan van Stijn
55d1a56826
plugin: use types/registry.AuthConfig
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-29 23:05:19 +02:00
Sebastiaan van Stijn
d8a43399a8
api/server/router: use types/registry.AuthConfig
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-29 23:05:14 +02:00
Sebastiaan van Stijn
818ee96219
api/types: move AuthConfig to registry types
Making the api types more focused per API type, and the general
api/types package somewhat smaller.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-29 23:05:12 +02:00
Sebastiaan van Stijn
857cb260c7
api: add const for 'X-Registry-Auth'
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-29 23:04:34 +02:00
Djordje Lukic
26c65447df
Implement ImageDelete for containerd
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-28 22:56:34 +02:00
Akihiro Suda
11b03710ed
Merge pull request #43798 from thaJeztah/remove_deprecated
Remove various deprecated types and fields
2022-07-14 22:32:42 +09:00