pull/3703/merge
Alexey Makhov 7 years ago committed by GitHub
commit cd44542525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -60,6 +60,8 @@ const (
tlsCertsEnvVar = "TILLER_TLS_CERTS" tlsCertsEnvVar = "TILLER_TLS_CERTS"
// historyMaxEnvVar is the name of the env var for setting max history. // historyMaxEnvVar is the name of the env var for setting max history.
historyMaxEnvVar = "TILLER_HISTORY_MAX" historyMaxEnvVar = "TILLER_HISTORY_MAX"
// maxMsgSizeEnvVar is the name of the env var for setting gRPC message size limit.
maxMsgSizeEnvVar = "TILLER_MAX_MSG_SIZE"
storageMemory = "memory" storageMemory = "memory"
storageConfigMap = "configmap" storageConfigMap = "configmap"
@ -84,6 +86,7 @@ var (
caCertFile = flag.String("tls-ca-cert", tlsDefaultsFromEnv("tls-ca-cert"), "trust certificates signed by this CA") caCertFile = flag.String("tls-ca-cert", tlsDefaultsFromEnv("tls-ca-cert"), "trust certificates signed by this CA")
maxHistory = flag.Int("history-max", historyMaxFromEnv(), "maximum number of releases kept in release history, with 0 meaning no limit") maxHistory = flag.Int("history-max", historyMaxFromEnv(), "maximum number of releases kept in release history, with 0 meaning no limit")
printVersion = flag.Bool("version", false, "print the version number") printVersion = flag.Bool("version", false, "print the version number")
maxMsgSize = flag.Int("max-msg-size", maxMsgSizeFromEnv(), "gRPC message size limit")
// rootServer is the root gRPC server. // rootServer is the root gRPC server.
// //
@ -174,6 +177,11 @@ func start() {
MinTime: time.Duration(20) * time.Second, // For compatibility with the client keepalive.ClientParameters MinTime: time.Duration(20) * time.Second, // For compatibility with the client keepalive.ClientParameters
})) }))
// If set, configure gRPC max msg size
if *maxMsgSize > 0 {
opts = append(opts, grpc.MaxRecvMsgSize(*maxMsgSize), grpc.MaxSendMsgSize(*maxMsgSize))
}
rootServer = tiller.NewServer(opts...) rootServer = tiller.NewServer(opts...)
healthpb.RegisterHealthServer(rootServer, healthSrv) healthpb.RegisterHealthServer(rootServer, healthSrv)
@ -288,3 +296,16 @@ func historyMaxFromEnv() int {
func tlsEnableEnvVarDefault() bool { return os.Getenv(tlsEnableEnvVar) != "" } func tlsEnableEnvVarDefault() bool { return os.Getenv(tlsEnableEnvVar) != "" }
func tlsVerifyEnvVarDefault() bool { return os.Getenv(tlsVerifyEnvVar) != "" } func tlsVerifyEnvVarDefault() bool { return os.Getenv(tlsVerifyEnvVar) != "" }
func maxMsgSizeFromEnv() int {
val := os.Getenv(maxMsgSizeEnvVar)
if val == "" {
return 0
}
ret, err := strconv.Atoi(val)
if err != nil {
log.Printf("Invalid max msg size %q. Defaulting to %d.", val, tiller.DefaultMaxMsgSize)
return 0
}
return ret
}

@ -29,15 +29,15 @@ import (
"k8s.io/helm/pkg/version" "k8s.io/helm/pkg/version"
) )
// maxMsgSize use 20MB as the default message size limit. // DefaultMaxMsgSize use 20MB as the default message size limit.
// grpc library default is 4MB // grpc library default is 4MB
const maxMsgSize = 1024 * 1024 * 20 const DefaultMaxMsgSize = 1024 * 1024 * 20
// DefaultServerOpts returns the set of default grpc ServerOption's that Tiller requires. // DefaultServerOpts returns the set of default grpc ServerOption's that Tiller requires.
func DefaultServerOpts() []grpc.ServerOption { func DefaultServerOpts() []grpc.ServerOption {
return []grpc.ServerOption{ return []grpc.ServerOption{
grpc.MaxRecvMsgSize(maxMsgSize), grpc.MaxRecvMsgSize(DefaultMaxMsgSize),
grpc.MaxSendMsgSize(maxMsgSize), grpc.MaxSendMsgSize(DefaultMaxMsgSize),
grpc.UnaryInterceptor(newUnaryInterceptor()), grpc.UnaryInterceptor(newUnaryInterceptor()),
grpc.StreamInterceptor(newStreamInterceptor()), grpc.StreamInterceptor(newStreamInterceptor()),
} }

Loading…
Cancel
Save