mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
docker: always use API version negotiation when initializing clients (#24237)
During a refactoring of the docker driver in #23966 we introduced a bug: API version negotiation option was not passed to every new client call.
This commit is contained in:
committed by
GitHub
parent
d12128c380
commit
1ac14f4869
3
.changelog/24237.txt
Normal file
3
.changelog/24237.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
docker: Always negotiate API version when initializing clients
|
||||
```
|
||||
@@ -225,13 +225,18 @@ func (d *dockerLogger) getDockerClient(opts *StartOpts) (*client.Client, error)
|
||||
d.logger.Debug("using TLS client connection to docker", "endpoint", opts.Endpoint)
|
||||
newClient, err = client.NewClientWithOpts(
|
||||
client.WithHost(opts.Endpoint),
|
||||
client.WithTLSClientConfig(opts.TLSCA, opts.TLSCert, opts.TLSKey))
|
||||
client.WithTLSClientConfig(opts.TLSCA, opts.TLSCert, opts.TLSKey),
|
||||
client.WithAPIVersionNegotiation(),
|
||||
)
|
||||
if err != nil {
|
||||
merr.Errors = append(merr.Errors, err)
|
||||
}
|
||||
} else {
|
||||
d.logger.Debug("using plaintext client connection to docker", "endpoint", opts.Endpoint)
|
||||
newClient, err = client.NewClientWithOpts(client.WithHost(opts.Endpoint))
|
||||
newClient, err = client.NewClientWithOpts(
|
||||
client.WithHost(opts.Endpoint),
|
||||
client.WithAPIVersionNegotiation(),
|
||||
)
|
||||
if err != nil {
|
||||
merr.Errors = append(merr.Errors, err)
|
||||
}
|
||||
|
||||
@@ -1927,13 +1927,17 @@ func (d *Driver) newDockerClient(timeout time.Duration) (*client.Client, error)
|
||||
newClient, err = client.NewClientWithOpts(
|
||||
client.WithHost(dockerEndpoint),
|
||||
client.WithTLSClientConfig(ca, cert, key),
|
||||
client.WithAPIVersionNegotiation(),
|
||||
)
|
||||
if err != nil {
|
||||
merr.Errors = append(merr.Errors, err)
|
||||
}
|
||||
} else {
|
||||
d.logger.Debug("using standard client connection", "endpoint", dockerEndpoint)
|
||||
newClient, err = client.NewClientWithOpts(client.WithHost(dockerEndpoint))
|
||||
newClient, err = client.NewClientWithOpts(
|
||||
client.WithHost(dockerEndpoint),
|
||||
client.WithAPIVersionNegotiation(),
|
||||
)
|
||||
if err != nil {
|
||||
merr.Errors = append(merr.Errors, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user