Commit 8ad7d141 authored by Brad Davidson's avatar Brad Davidson Committed by Brad Davidson

Close etcd clients to avoid leaking GRPC connections

If you don't explicitly close the etcd client when you're done with it, the GRPC connection hangs around in the background. Normally this is harmelss, but in the case of the temporary etcd we start up on 2399 to reconcile bootstrap data, the client will start logging errors afterwards when the server goes away. Signed-off-by: 's avatarBrad Davidson <brad.davidson@rancher.com>
parent e7d14e56
......@@ -393,6 +393,7 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker,
if err != nil {
return err
}
defer storageClient.Close()
ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
......
......@@ -48,6 +48,7 @@ func Save(ctx context.Context, config *config.Control, etcdConfig endpoint.ETCDC
if err != nil {
return err
}
defer storageClient.Close()
if _, _, err = getBootstrapKeyFromStorage(ctx, storageClient, normalizedToken, token); err != nil {
return err
......@@ -102,6 +103,7 @@ func (c *Cluster) storageBootstrap(ctx context.Context) error {
if err != nil {
return err
}
defer storageClient.Close()
token := c.config.Token
if token == "" {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment