mirror of https://github.com/k3s-io/k3s
Skip setting up client tls when etcd server does not have tls enabled
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>pull/5439/head
parent
90ce62ceaa
commit
f1c323c268
|
@ -608,18 +608,20 @@ func getClientConfig(ctx context.Context, runtime *config.ControlRuntime, endpoi
|
||||||
if len(endpoints) == 0 {
|
if len(endpoints) == 0 {
|
||||||
endpoints = getEndpoints(runtime)
|
endpoints = getEndpoints(runtime)
|
||||||
}
|
}
|
||||||
tlsConfig, err := toTLSConfig(runtime)
|
|
||||||
if err != nil {
|
config := &etcd.Config{
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &etcd.Config{
|
|
||||||
Endpoints: endpoints,
|
Endpoints: endpoints,
|
||||||
TLS: tlsConfig,
|
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
DialTimeout: defaultDialTimeout,
|
DialTimeout: defaultDialTimeout,
|
||||||
DialKeepAliveTime: defaultKeepAliveTime,
|
DialKeepAliveTime: defaultKeepAliveTime,
|
||||||
DialKeepAliveTimeout: defaultKeepAliveTimeout,
|
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.
|
// getEndpoints returns the endpoints from the runtime config if set, otherwise the default endpoint.
|
||||||
|
|
Loading…
Reference in New Issue