From 803f7c706ef4ce44aa6418c42c77dbf7e60ac66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helgi=20=C3=9Eormar=20=C3=9Eorbj=C3=B6rnsson?= Date: Wed, 22 Nov 2017 08:30:25 -0800 Subject: [PATCH] add a keepalive of 30s to the client (#3183) --- pkg/helm/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index dbaf01d96..33d56e88d 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -23,6 +23,7 @@ import ( "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/keepalive" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/proto/hapi/chart" @@ -289,6 +290,11 @@ func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) opts := []grpc.DialOption{ grpc.WithTimeout(5 * time.Second), grpc.WithBlock(), + grpc.WithKeepaliveParams(keepalive.ClientParameters{ + // Send keepalive every 30 seconds to prevent the connection from + // getting closed by upstreams + Time: time.Duration(30) * time.Second, + }), } switch { case h.opts.useTLS: