mirror of
https://git.vectorsigma.ru/public/k3s.git
synced 2026-07-30 05:09:52 +00:00
Skip setting up client tls when etcd server does not have tls enabled
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
committed by
Brad Davidson
parent
90ce62ceaa
commit
f1c323c268
@@ -608,18 +608,20 @@ func getClientConfig(ctx context.Context, runtime *config.ControlRuntime, endpoi
|
||||
if len(endpoints) == 0 {
|
||||
endpoints = getEndpoints(runtime)
|
||||
}
|
||||
tlsConfig, err := toTLSConfig(runtime)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &etcd.Config{
|
||||
|
||||
config := &etcd.Config{
|
||||
Endpoints: endpoints,
|
||||
TLS: tlsConfig,
|
||||
Context: ctx,
|
||||
DialTimeout: defaultDialTimeout,
|
||||
DialKeepAliveTime: defaultKeepAliveTime,
|
||||
DialKeepAliveTimeout: defaultKeepAliveTimeout,
|
||||
}, nil
|
||||
}
|
||||
|
||||
var err error
|
||||
if strings.HasPrefix(endpoints[0], "https://") {
|
||||
config.TLS, err = toTLSConfig(runtime)
|
||||
}
|
||||
return config, err
|
||||
}
|
||||
|
||||
// getEndpoints returns the endpoints from the runtime config if set, otherwise the default endpoint.
|
||||
|
||||
Reference in New Issue
Block a user