diff --git a/nodeup/pkg/bootstrap/install.go b/nodeup/pkg/bootstrap/install.go index aab98405ed..61ebb501e9 100644 --- a/nodeup/pkg/bootstrap/install.go +++ b/nodeup/pkg/bootstrap/install.go @@ -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=") diff --git a/nodeup/pkg/model/protokube.go b/nodeup/pkg/model/protokube.go index 63da955d96..c198bcdc3e 100644 --- a/nodeup/pkg/model/protokube.go +++ b/nodeup/pkg/model/protokube.go @@ -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(" ") diff --git a/pkg/model/bootstrapscript.go b/pkg/model/bootstrapscript.go index 7cf5da7dea..b763d139d6 100644 --- a/pkg/model/bootstrapscript.go +++ b/pkg/model/bootstrapscript.go @@ -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") diff --git a/protokube/pkg/gossip/mesh/gossip.go b/protokube/pkg/gossip/mesh/gossip.go index 614e2a1157..336a560239 100644 --- a/protokube/pkg/gossip/mesh/gossip.go +++ b/protokube/pkg/gossip/mesh/gossip.go @@ -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{}, }