mirror of https://github.com/k3s-io/k3s
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: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 8ad7d141e8
)
pull/4479/head
parent
93960b6fa9
commit
56e3b66b21
|
@ -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 == "" {
|
||||
|
|
Loading…
Reference in New Issue