Skip to content

Commit

Permalink
Skip setting up client tls when etcd server does not have tls enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Davidson <[email protected]>
  • Loading branch information
brandond committed Mar 30, 2022
1 parent 98036ce commit 4eb3a48
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pkg/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4eb3a48

Please sign in to comment.