|
|
@ -30,6 +30,10 @@ import (
|
|
|
|
rls "k8s.io/helm/pkg/proto/hapi/services"
|
|
|
|
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.
|
|
|
|
// Client manages client side of the Helm-Tiller protocol.
|
|
|
|
type Client struct {
|
|
|
|
type Client struct {
|
|
|
|
opts options
|
|
|
|
opts options
|
|
|
@ -303,13 +307,13 @@ func (h *Client) PingTiller() error {
|
|
|
|
// are constructed here.
|
|
|
|
// are constructed here.
|
|
|
|
func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) {
|
|
|
|
func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) {
|
|
|
|
opts := []grpc.DialOption{
|
|
|
|
opts := []grpc.DialOption{
|
|
|
|
grpc.WithTimeout(5 * time.Second),
|
|
|
|
|
|
|
|
grpc.WithBlock(),
|
|
|
|
grpc.WithBlock(),
|
|
|
|
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
|
|
|
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
|
|
|
// Send keepalive every 30 seconds to prevent the connection from
|
|
|
|
// Send keepalive every 30 seconds to prevent the connection from
|
|
|
|
// getting closed by upstreams
|
|
|
|
// getting closed by upstreams
|
|
|
|
Time: time.Duration(30) * time.Second,
|
|
|
|
Time: time.Duration(30) * time.Second,
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
|
|
|
|
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch {
|
|
|
|
switch {
|
|
|
|
case h.opts.useTLS:
|
|
|
|
case h.opts.useTLS:
|
|
|
@ -317,7 +321,9 @@ func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error)
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
opts = append(opts, grpc.WithInsecure())
|
|
|
|
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 nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return conn, nil
|
|
|
|
return conn, nil
|
|
|
|