Skip to content

Commit

Permalink
drivers/docker: refactor use of clients in docker driver (#17731)
Browse files Browse the repository at this point in the history
* drivers/docker: refactor use of clients in docker driver

This PR refactors how we manage the two underlying clients used by the
docker driver for communicating with the docker daemon. We keep two clients
- one with a hard-coded timeout that applies to all operations no matter
what, intended for use with short lived / async calls to docker. The other
has no timeout and is the responsibility of the caller to set a context
that will ensure the call eventually terminates.

The use of these two clients has been confusing and mistakes were made
in a number of places where calls were making use of the wrong client.

This PR makes it so that a user must explicitly call a function to get
the client that makes sense for that use case.

Fixes #17023

* cr: followup items
  • Loading branch information
shoenig committed Jun 26, 2023
1 parent 05c84d6 commit ec4fa55
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 124 deletions.
3 changes: 3 additions & 0 deletions .changelog/17731.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
drivers/docker: Fixed a bug where long-running docker operations would incorrectly timeout
```
2 changes: 1 addition & 1 deletion drivers/docker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ func (d *Driver) SetConfig(c *base.Config) error {
d.clientConfig = c.AgentConfig.Driver
}

dockerClient, _, err := d.dockerClients()
dockerClient, err := d.getDockerClient()
if err != nil {
return fmt.Errorf("failed to get docker client: %v", err)
}
Expand Down
Loading

0 comments on commit ec4fa55

Please sign in to comment.