Merge pull request #5077 from yancl/master

change gossip dns conn limit by ENV
This commit is contained in:
k8s-ci-robot 2018-07-19 21:40:52 -07:00 committed by GitHub
commit 2dbb6e84f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 1 deletions

View File

@ -118,6 +118,12 @@ func (i *Installation) buildSystemdJob() *nodetasks.Service {
buffer.WriteString("\" ") 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 // Pass in required credentials when using user-defined s3 endpoint
if os.Getenv("S3_ENDPOINT") != "" { if os.Getenv("S3_ENDPOINT") != "" {
buffer.WriteString("\"S3_ENDPOINT=") buffer.WriteString("\"S3_ENDPOINT=")

View File

@ -371,6 +371,15 @@ func (t *ProtokubeBuilder) ProtokubeEnvironmentVariables() string {
// TODO write out an environments file for this. This is getting a tad long. // 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 // Pass in required credentials when using user-defined s3 endpoint
if os.Getenv("AWS_REGION") != "" { if os.Getenv("AWS_REGION") != "" {
buffer.WriteString(" ") buffer.WriteString(" ")

View File

@ -60,6 +60,11 @@ func (b *BootstrapScript) KubeEnv(ig *kops.InstanceGroup) (string, error) {
func (b *BootstrapScript) buildEnvironmentVariables(cluster *kops.Cluster) (map[string]string, error) { func (b *BootstrapScript) buildEnvironmentVariables(cluster *kops.Cluster) (map[string]string, error) {
env := make(map[string]string) 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") != "" { if os.Getenv("S3_ENDPOINT") != "" {
env["S3_ENDPOINT"] = os.Getenv("S3_ENDPOINT") env["S3_ENDPOINT"] = os.Getenv("S3_ENDPOINT")
env["S3_REGION"] = os.Getenv("S3_REGION") env["S3_REGION"] = os.Getenv("S3_REGION")

View File

@ -19,6 +19,7 @@ package mesh
import ( import (
"fmt" "fmt"
"net" "net"
"os"
"strconv" "strconv"
"time" "time"
@ -39,10 +40,23 @@ type MeshGossiper struct {
} }
func NewMeshGossiper(listen string, channelName string, nodeName string, password []byte, seeds gossip.SeedProvider) (*MeshGossiper, error) { 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{ meshConfig := mesh.Config{
ProtocolMinVersion: mesh.ProtocolMinVersion, ProtocolMinVersion: mesh.ProtocolMinVersion,
Password: password, Password: password,
ConnLimit: 64, ConnLimit: connLimit,
PeerDiscovery: true, PeerDiscovery: true,
//TrustedSubnets: []*net.IPNet{}, //TrustedSubnets: []*net.IPNet{},
} }