From 98e5006ecfefe7c1b1ab10c9e9e906407101ded1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Thu, 15 Feb 2018 14:02:14 +0100 Subject: [PATCH 1/2] Bump client side grpc max msg size Set it to match the server side, or the default limit of 4MB will still apply when upgrading charts. Fixes #3512 --- pkg/helm/client.go | 5 +++++ pkg/tiller/server.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 83c97f9a8..f5dc5a001 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -30,6 +30,10 @@ import ( rls "k8s.io/helm/pkg/proto/hapi/services" ) +// maxMsgSize use 20MB as the default message size limit. +// grpc library default is 4MB +const maxMsgSize = 1024 * 1024 * 20 + // Client manages client side of the Helm-Tiller protocol. type Client struct { opts options @@ -310,6 +314,7 @@ func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) // getting closed by upstreams Time: time.Duration(30) * time.Second, }), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)), } switch { case h.opts.useTLS: diff --git a/pkg/tiller/server.go b/pkg/tiller/server.go index 95276018e..818cfd47a 100644 --- a/pkg/tiller/server.go +++ b/pkg/tiller/server.go @@ -31,7 +31,7 @@ import ( // maxMsgSize use 20MB as the default message size limit. // grpc library default is 4MB -var maxMsgSize = 1024 * 1024 * 20 +const maxMsgSize = 1024 * 1024 * 20 // DefaultServerOpts returns the set of default grpc ServerOption's that Tiller requires. func DefaultServerOpts() []grpc.ServerOption { From 9bac0a4c30d1eb879acdd68617336834b48937c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Thu, 15 Feb 2018 14:19:09 +0100 Subject: [PATCH 2/2] Update deprecated grpc dial timeout The docs say: use DialContext instead. --- pkg/helm/client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index f5dc5a001..c7ef4d89e 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -307,7 +307,6 @@ func (h *Client) PingTiller() error { // are constructed here. 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 @@ -322,7 +321,9 @@ func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) default: opts = append(opts, grpc.WithInsecure()) } - if conn, err = grpc.Dial(h.opts.host, opts...); err != nil { + ctx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() + if conn, err = grpc.DialContext(ctx, h.opts.host, opts...); err != nil { return nil, err } return conn, nil