mirror of https://github.com/kubernetes/kops.git
Merge pull request #5077 from yancl/master
change gossip dns conn limit by ENV
This commit is contained in:
commit
2dbb6e84f6
|
@ -118,6 +118,12 @@ func (i *Installation) buildSystemdJob() *nodetasks.Service {
|
|||
buffer.WriteString("\" ")
|
||||
}
|
||||
|
||||
if os.Getenv("GOSSIP_DNS_CONN_LIMIT") != "" {
|
||||
buffer.WriteString("\"GOSSIP_DNS_CONN_LIMIT=")
|
||||
buffer.WriteString(os.Getenv("GOSSIP_DNS_CONN_LIMIT"))
|
||||
buffer.WriteString("\" ")
|
||||
}
|
||||
|
||||
// Pass in required credentials when using user-defined s3 endpoint
|
||||
if os.Getenv("S3_ENDPOINT") != "" {
|
||||
buffer.WriteString("\"S3_ENDPOINT=")
|
||||
|
|
|
@ -371,6 +371,15 @@ func (t *ProtokubeBuilder) ProtokubeEnvironmentVariables() string {
|
|||
|
||||
// TODO write out an environments file for this. This is getting a tad long.
|
||||
|
||||
// Passin gossip dns connection limit
|
||||
if os.Getenv("GOSSIP_DNS_CONN_LIMIT") != "" {
|
||||
buffer.WriteString(" ")
|
||||
buffer.WriteString("-e 'GOSSIP_DNS_CONN_LIMIT=")
|
||||
buffer.WriteString(os.Getenv("GOSSIP_DNS_CONN_LIMIT"))
|
||||
buffer.WriteString("'")
|
||||
buffer.WriteString(" ")
|
||||
}
|
||||
|
||||
// Pass in required credentials when using user-defined s3 endpoint
|
||||
if os.Getenv("AWS_REGION") != "" {
|
||||
buffer.WriteString(" ")
|
||||
|
|
|
@ -60,6 +60,11 @@ func (b *BootstrapScript) KubeEnv(ig *kops.InstanceGroup) (string, error) {
|
|||
|
||||
func (b *BootstrapScript) buildEnvironmentVariables(cluster *kops.Cluster) (map[string]string, error) {
|
||||
env := make(map[string]string)
|
||||
|
||||
if os.Getenv("GOSSIP_DNS_CONN_LIMIT") != "" {
|
||||
env["GOSSIP_DNS_CONN_LIMIT"] = os.Getenv("GOSSIP_DNS_CONN_LIMIT")
|
||||
}
|
||||
|
||||
if os.Getenv("S3_ENDPOINT") != "" {
|
||||
env["S3_ENDPOINT"] = os.Getenv("S3_ENDPOINT")
|
||||
env["S3_REGION"] = os.Getenv("S3_REGION")
|
||||
|
|
|
@ -19,6 +19,7 @@ package mesh
|
|||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -39,10 +40,23 @@ type MeshGossiper struct {
|
|||
}
|
||||
|
||||
func NewMeshGossiper(listen string, channelName string, nodeName string, password []byte, seeds gossip.SeedProvider) (*MeshGossiper, error) {
|
||||
|
||||
connLimit := 64
|
||||
gossipDnsConnLimit := os.Getenv("GOSSIP_DNS_CONN_LIMIT")
|
||||
if gossipDnsConnLimit != "" {
|
||||
limit, err := strconv.Atoi(gossipDnsConnLimit)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot parse env GOSSIP_DNS_CONN_LIMIT value: %v, err:%v", gossipDnsConnLimit, err)
|
||||
}
|
||||
connLimit = limit
|
||||
}
|
||||
|
||||
glog.Infof("gossip dns connection limit is:%d", connLimit)
|
||||
|
||||
meshConfig := mesh.Config{
|
||||
ProtocolMinVersion: mesh.ProtocolMinVersion,
|
||||
Password: password,
|
||||
ConnLimit: 64,
|
||||
ConnLimit: connLimit,
|
||||
PeerDiscovery: true,
|
||||
//TrustedSubnets: []*net.IPNet{},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue