modification on manager.go added
@@ -201,7 +201,34 @@ func (m *manager) generateConfig(rules []api.Rule, instances []api.ServiceInstan
format := fmt.Sprintf(envoyLogFormat, buildSourceName(inst.ServiceName, inst.Tags), traceKey, traceVal)
listeners := BuildListeners(m.listenerPort, filters, format, m.loggingDir+accessLog, m.tcpProxyConfigs)
- rdsClusters := BuildRDSClusters(m.tcpProxyConfigs, m.sdsPort)
+
+ staticClusters := []Cluster{
+ {
+ Name: "rds",
+ Type: "strict_dns",
+ ConnectTimeoutMs: 1000,
+ LbType: "round_robin",
+ Hosts: []Host{
+ {
+ URL: fmt.Sprintf("tcp://127.0.0.1:%v", m.sdsPort),
+ },
+ },
+ MaxRequestsPerConnection: 1,
+ },
+ }
+
+ for _, proxy := range m.tcpProxyConfigs {
+ cluster := Cluster{
+ Name: proxy.Service,
+ ServiceName: proxy.Service,
+ Type: "sds",
+ ConnectTimeoutMs: 1000,
+ LbType: "round_robin",
+ MaxRequestsPerConnection: 1,
+ }
+ staticClusters = append(staticClusters, cluster)
+ }
+
return Config{
RootRuntime: RootRuntime{
SymlinkRoot: m.workingDir + runtimePath,
@@ -213,7 +240,7 @@ func (m *manager) generateConfig(rules []api.Rule, instances []api.ServiceInstan
Port: m.adminPort,
},
ClusterManager: ClusterManager{
- Clusters: rdsClusters,
+ Clusters: staticClusters,
SDS: SDS{
Cluster: Cluster{
Name: "sds",
@@ -248,37 +275,6 @@ func (m *manager) generateConfig(rules []api.Rule, instances []api.ServiceInstan
}, nil
}
-func BuildRDSClusters(tcpProxyList []config.TCPProxyConfig, sdsPort int) []Cluster {
- clusters := []Cluster{
- {
- Name: "rds",
- Type: "strict_dns",
- ConnectTimeoutMs: 1000,
- LbType: "round_robin",
- Hosts: []Host{
- {
- URL: fmt.Sprintf("tcp://127.0.0.1:%v", sdsPort),
- },
- },
- MaxRequestsPerConnection: 1,
- },
- }
-
- for _, proxy := range tcpProxyList {
- cluster := Cluster{
- Name: proxy.Service,
- ServiceName: proxy.Service,
- Type: "sds",
- ConnectTimeoutMs: 1000,
- LbType: "round_robin",
- MaxRequestsPerConnection: 1,
- }
- clusters = append(clusters, cluster)
- }
-
- return clusters
-}
-
func BuildListeners(httpPort int, filters []Filter, format string, httpAccessLogPath string, tcpProxyList []config.TCPProxyConfig) []Listener {
// Build Http Listeners
listeners := []Listener{
