mirror of https://github.com/status-im/consul.git
config: update GRPCPort and addr in runtime config
This commit is contained in:
parent
7d73fd7ae5
commit
895bf9adec
|
@ -661,7 +661,7 @@ func (a *Agent) Failed() <-chan struct{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) listenAndServeXDS() error {
|
func (a *Agent) listenAndServeXDS() error {
|
||||||
if len(a.config.GRPCAddrs) < 1 {
|
if len(a.config.XDSAddrs) < 1 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -683,7 +683,7 @@ func (a *Agent) listenAndServeXDS() error {
|
||||||
}
|
}
|
||||||
a.grpcServer = xds.NewGRPCServer(xdsServer, tlsConfig)
|
a.grpcServer = xds.NewGRPCServer(xdsServer, tlsConfig)
|
||||||
|
|
||||||
ln, err := a.startListeners(a.config.GRPCAddrs)
|
ln, err := a.startListeners(a.config.XDSAddrs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,7 +428,7 @@ func (b *builder) Build() (rt RuntimeConfig, err error) {
|
||||||
httpPort := b.portVal("ports.http", c.Ports.HTTP)
|
httpPort := b.portVal("ports.http", c.Ports.HTTP)
|
||||||
httpsPort := b.portVal("ports.https", c.Ports.HTTPS)
|
httpsPort := b.portVal("ports.https", c.Ports.HTTPS)
|
||||||
serverPort := b.portVal("ports.server", c.Ports.Server)
|
serverPort := b.portVal("ports.server", c.Ports.Server)
|
||||||
grpcPort := b.portVal("ports.grpc", c.Ports.GRPC)
|
xdsPort := b.portVal("ports.xds", c.Ports.GRPC)
|
||||||
serfPortLAN := b.portVal("ports.serf_lan", c.Ports.SerfLAN)
|
serfPortLAN := b.portVal("ports.serf_lan", c.Ports.SerfLAN)
|
||||||
serfPortWAN := b.portVal("ports.serf_wan", c.Ports.SerfWAN)
|
serfPortWAN := b.portVal("ports.serf_wan", c.Ports.SerfWAN)
|
||||||
proxyMinPort := b.portVal("ports.proxy_min_port", c.Ports.ProxyMinPort)
|
proxyMinPort := b.portVal("ports.proxy_min_port", c.Ports.ProxyMinPort)
|
||||||
|
@ -555,7 +555,7 @@ func (b *builder) Build() (rt RuntimeConfig, err error) {
|
||||||
dnsAddrs := b.makeAddrs(b.expandAddrs("addresses.dns", c.Addresses.DNS), clientAddrs, dnsPort)
|
dnsAddrs := b.makeAddrs(b.expandAddrs("addresses.dns", c.Addresses.DNS), clientAddrs, dnsPort)
|
||||||
httpAddrs := b.makeAddrs(b.expandAddrs("addresses.http", c.Addresses.HTTP), clientAddrs, httpPort)
|
httpAddrs := b.makeAddrs(b.expandAddrs("addresses.http", c.Addresses.HTTP), clientAddrs, httpPort)
|
||||||
httpsAddrs := b.makeAddrs(b.expandAddrs("addresses.https", c.Addresses.HTTPS), clientAddrs, httpsPort)
|
httpsAddrs := b.makeAddrs(b.expandAddrs("addresses.https", c.Addresses.HTTPS), clientAddrs, httpsPort)
|
||||||
grpcAddrs := b.makeAddrs(b.expandAddrs("addresses.grpc", c.Addresses.GRPC), clientAddrs, grpcPort)
|
xdsAddrs := b.makeAddrs(b.expandAddrs("addresses.xds", c.Addresses.GRPC), clientAddrs, xdsPort)
|
||||||
|
|
||||||
for _, a := range dnsAddrs {
|
for _, a := range dnsAddrs {
|
||||||
if x, ok := a.(*net.TCPAddr); ok {
|
if x, ok := a.(*net.TCPAddr); ok {
|
||||||
|
@ -1013,8 +1013,8 @@ func (b *builder) Build() (rt RuntimeConfig, err error) {
|
||||||
EncryptKey: stringVal(c.EncryptKey),
|
EncryptKey: stringVal(c.EncryptKey),
|
||||||
EncryptVerifyIncoming: boolVal(c.EncryptVerifyIncoming),
|
EncryptVerifyIncoming: boolVal(c.EncryptVerifyIncoming),
|
||||||
EncryptVerifyOutgoing: boolVal(c.EncryptVerifyOutgoing),
|
EncryptVerifyOutgoing: boolVal(c.EncryptVerifyOutgoing),
|
||||||
GRPCPort: grpcPort,
|
XDSPort: xdsPort,
|
||||||
GRPCAddrs: grpcAddrs,
|
XDSAddrs: xdsAddrs,
|
||||||
HTTPMaxConnsPerClient: intVal(c.Limits.HTTPMaxConnsPerClient),
|
HTTPMaxConnsPerClient: intVal(c.Limits.HTTPMaxConnsPerClient),
|
||||||
HTTPSHandshakeTimeout: b.durationVal("limits.https_handshake_timeout", c.Limits.HTTPSHandshakeTimeout),
|
HTTPSHandshakeTimeout: b.durationVal("limits.https_handshake_timeout", c.Limits.HTTPSHandshakeTimeout),
|
||||||
KeyFile: stringVal(c.KeyFile),
|
KeyFile: stringVal(c.KeyFile),
|
||||||
|
|
|
@ -715,27 +715,27 @@ type RuntimeConfig struct {
|
||||||
// hcl: encrypt_verify_outgoing = (true|false)
|
// hcl: encrypt_verify_outgoing = (true|false)
|
||||||
EncryptVerifyOutgoing bool
|
EncryptVerifyOutgoing bool
|
||||||
|
|
||||||
// GRPCPort is the port the gRPC server listens on. Currently this only
|
// XDSPort is the port the xDS gRPC server listens on. This port only
|
||||||
// exposes the xDS and ext_authz APIs for Envoy and it is disabled by default.
|
// exposes the xDS and ext_authz APIs for Envoy and it is disabled by default.
|
||||||
//
|
//
|
||||||
// hcl: ports { grpc = int }
|
// hcl: ports { grpc = int }
|
||||||
// flags: -grpc-port int
|
// flags: -grpc-port int
|
||||||
GRPCPort int
|
XDSPort int
|
||||||
|
|
||||||
// GRPCAddrs contains the list of TCP addresses and UNIX sockets the gRPC
|
// XDSAddrs contains the list of TCP addresses and UNIX sockets the xDS gRPC
|
||||||
// server will bind to. If the gRPC endpoint is disabled (ports.grpc <= 0)
|
// server will bind to. If the xDS endpoint is disabled (ports.xds <= 0)
|
||||||
// the list is empty.
|
// the list is empty.
|
||||||
//
|
//
|
||||||
// The addresses are taken from 'addresses.grpc' which should contain a
|
// The addresses are taken from 'addresses.xds' which should contain a
|
||||||
// space separated list of ip addresses, UNIX socket paths and/or
|
// space separated list of ip addresses, UNIX socket paths and/or
|
||||||
// go-sockaddr templates. UNIX socket paths must be written as
|
// go-sockaddr templates. UNIX socket paths must be written as
|
||||||
// 'unix://<full path>', e.g. 'unix:///var/run/consul-grpc.sock'.
|
// 'unix://<full path>', e.g. 'unix:///var/run/consul-xds.sock'.
|
||||||
//
|
//
|
||||||
// If 'addresses.grpc' was not provided the 'client_addr' addresses are
|
// If 'addresses.xds' was not provided the 'client_addr' addresses are
|
||||||
// used.
|
// used.
|
||||||
//
|
//
|
||||||
// hcl: client_addr = string addresses { grpc = string } ports { grpc = int }
|
// hcl: client_addr = string addresses { grpc = string } ports { grpc = int }
|
||||||
GRPCAddrs []net.Addr
|
XDSAddrs []net.Addr
|
||||||
|
|
||||||
// HTTPAddrs contains the list of TCP addresses and UNIX sockets the HTTP
|
// HTTPAddrs contains the list of TCP addresses and UNIX sockets the HTTP
|
||||||
// server will bind to. If the HTTP endpoint is disabled (ports.http <= 0)
|
// server will bind to. If the HTTP endpoint is disabled (ports.http <= 0)
|
||||||
|
|
|
@ -342,8 +342,8 @@ func TestLoad_IntegrationWithFlags(t *testing.T) {
|
||||||
rt.GossipWANProbeTimeout = 100 * time.Millisecond
|
rt.GossipWANProbeTimeout = 100 * time.Millisecond
|
||||||
rt.GossipWANSuspicionMult = 3
|
rt.GossipWANSuspicionMult = 3
|
||||||
rt.ConsulServerHealthInterval = 10 * time.Millisecond
|
rt.ConsulServerHealthInterval = 10 * time.Millisecond
|
||||||
rt.GRPCPort = 8502
|
rt.XDSPort = 8502
|
||||||
rt.GRPCAddrs = []net.Addr{tcpAddr("127.0.0.1:8502")}
|
rt.XDSAddrs = []net.Addr{tcpAddr("127.0.0.1:8502")}
|
||||||
rt.RPCConfig.EnableStreaming = true
|
rt.RPCConfig.EnableStreaming = true
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1056,8 +1056,8 @@ func TestLoad_IntegrationWithFlags(t *testing.T) {
|
||||||
rt.HTTPAddrs = []net.Addr{tcpAddr("0.0.0.0:2")}
|
rt.HTTPAddrs = []net.Addr{tcpAddr("0.0.0.0:2")}
|
||||||
rt.HTTPSPort = 3
|
rt.HTTPSPort = 3
|
||||||
rt.HTTPSAddrs = []net.Addr{tcpAddr("0.0.0.0:3")}
|
rt.HTTPSAddrs = []net.Addr{tcpAddr("0.0.0.0:3")}
|
||||||
rt.GRPCPort = 4
|
rt.XDSPort = 4
|
||||||
rt.GRPCAddrs = []net.Addr{tcpAddr("0.0.0.0:4")}
|
rt.XDSAddrs = []net.Addr{tcpAddr("0.0.0.0:4")}
|
||||||
rt.DataDir = dataDir
|
rt.DataDir = dataDir
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1129,8 +1129,8 @@ func TestLoad_IntegrationWithFlags(t *testing.T) {
|
||||||
rt.HTTPAddrs = []net.Addr{tcpAddr("2.2.2.2:2")}
|
rt.HTTPAddrs = []net.Addr{tcpAddr("2.2.2.2:2")}
|
||||||
rt.HTTPSPort = 3
|
rt.HTTPSPort = 3
|
||||||
rt.HTTPSAddrs = []net.Addr{tcpAddr("3.3.3.3:3")}
|
rt.HTTPSAddrs = []net.Addr{tcpAddr("3.3.3.3:3")}
|
||||||
rt.GRPCPort = 4
|
rt.XDSPort = 4
|
||||||
rt.GRPCAddrs = []net.Addr{tcpAddr("4.4.4.4:4")}
|
rt.XDSAddrs = []net.Addr{tcpAddr("4.4.4.4:4")}
|
||||||
rt.DataDir = dataDir
|
rt.DataDir = dataDir
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1153,8 +1153,8 @@ func TestLoad_IntegrationWithFlags(t *testing.T) {
|
||||||
rt.HTTPAddrs = []net.Addr{tcpAddr("1.2.3.4:2"), tcpAddr("[2001:db8::1]:2")}
|
rt.HTTPAddrs = []net.Addr{tcpAddr("1.2.3.4:2"), tcpAddr("[2001:db8::1]:2")}
|
||||||
rt.HTTPSPort = 3
|
rt.HTTPSPort = 3
|
||||||
rt.HTTPSAddrs = []net.Addr{tcpAddr("1.2.3.4:3"), tcpAddr("[2001:db8::1]:3")}
|
rt.HTTPSAddrs = []net.Addr{tcpAddr("1.2.3.4:3"), tcpAddr("[2001:db8::1]:3")}
|
||||||
rt.GRPCPort = 4
|
rt.XDSPort = 4
|
||||||
rt.GRPCAddrs = []net.Addr{tcpAddr("1.2.3.4:4"), tcpAddr("[2001:db8::1]:4")}
|
rt.XDSAddrs = []net.Addr{tcpAddr("1.2.3.4:4"), tcpAddr("[2001:db8::1]:4")}
|
||||||
rt.DataDir = dataDir
|
rt.DataDir = dataDir
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1189,8 +1189,8 @@ func TestLoad_IntegrationWithFlags(t *testing.T) {
|
||||||
rt.HTTPAddrs = []net.Addr{tcpAddr("2.2.2.2:2"), unixAddr("unix://http"), tcpAddr("[2001:db8::20]:2")}
|
rt.HTTPAddrs = []net.Addr{tcpAddr("2.2.2.2:2"), unixAddr("unix://http"), tcpAddr("[2001:db8::20]:2")}
|
||||||
rt.HTTPSPort = 3
|
rt.HTTPSPort = 3
|
||||||
rt.HTTPSAddrs = []net.Addr{tcpAddr("3.3.3.3:3"), unixAddr("unix://https"), tcpAddr("[2001:db8::30]:3")}
|
rt.HTTPSAddrs = []net.Addr{tcpAddr("3.3.3.3:3"), unixAddr("unix://https"), tcpAddr("[2001:db8::30]:3")}
|
||||||
rt.GRPCPort = 4
|
rt.XDSPort = 4
|
||||||
rt.GRPCAddrs = []net.Addr{tcpAddr("4.4.4.4:4"), unixAddr("unix://grpc"), tcpAddr("[2001:db8::40]:4")}
|
rt.XDSAddrs = []net.Addr{tcpAddr("4.4.4.4:4"), unixAddr("unix://grpc"), tcpAddr("[2001:db8::40]:4")}
|
||||||
rt.DataDir = dataDir
|
rt.DataDir = dataDir
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5458,8 +5458,8 @@ func TestLoad_FullConfig(t *testing.T) {
|
||||||
EncryptKey: "A4wELWqH",
|
EncryptKey: "A4wELWqH",
|
||||||
EncryptVerifyIncoming: true,
|
EncryptVerifyIncoming: true,
|
||||||
EncryptVerifyOutgoing: true,
|
EncryptVerifyOutgoing: true,
|
||||||
GRPCPort: 4881,
|
XDSPort: 4881,
|
||||||
GRPCAddrs: []net.Addr{tcpAddr("32.31.61.91:4881")},
|
XDSAddrs: []net.Addr{tcpAddr("32.31.61.91:4881")},
|
||||||
HTTPAddrs: []net.Addr{tcpAddr("83.39.91.39:7999")},
|
HTTPAddrs: []net.Addr{tcpAddr("83.39.91.39:7999")},
|
||||||
HTTPBlockEndpoints: []string{"RBvAFcGD", "fWOWFznh"},
|
HTTPBlockEndpoints: []string{"RBvAFcGD", "fWOWFznh"},
|
||||||
AllowWriteHTTPFrom: []*net.IPNet{cidr("127.0.0.0/8"), cidr("22.33.44.55/32"), cidr("0.0.0.0/0")},
|
AllowWriteHTTPFrom: []*net.IPNet{cidr("127.0.0.0/8"), cidr("22.33.44.55/32"), cidr("0.0.0.0/0")},
|
||||||
|
|
|
@ -182,8 +182,6 @@
|
||||||
"EnterpriseRuntimeConfig": {},
|
"EnterpriseRuntimeConfig": {},
|
||||||
"ExposeMaxPort": 0,
|
"ExposeMaxPort": 0,
|
||||||
"ExposeMinPort": 0,
|
"ExposeMinPort": 0,
|
||||||
"GRPCAddrs": [],
|
|
||||||
"GRPCPort": 0,
|
|
||||||
"GossipLANGossipInterval": "0s",
|
"GossipLANGossipInterval": "0s",
|
||||||
"GossipLANGossipNodes": 0,
|
"GossipLANGossipNodes": 0,
|
||||||
"GossipLANProbeInterval": "0s",
|
"GossipLANProbeInterval": "0s",
|
||||||
|
@ -410,5 +408,7 @@
|
||||||
"VerifyServerHostname": false,
|
"VerifyServerHostname": false,
|
||||||
"Version": "",
|
"Version": "",
|
||||||
"VersionPrerelease": "",
|
"VersionPrerelease": "",
|
||||||
"Watches": []
|
"Watches": [],
|
||||||
|
"XDSAddrs": [],
|
||||||
|
"XDSPort": 0
|
||||||
}
|
}
|
|
@ -201,7 +201,7 @@ func (c *cmd) run(args []string) int {
|
||||||
ui.Info(fmt.Sprintf(" Datacenter: '%s' (Segment: '%s')", config.Datacenter, segment))
|
ui.Info(fmt.Sprintf(" Datacenter: '%s' (Segment: '%s')", config.Datacenter, segment))
|
||||||
ui.Info(fmt.Sprintf(" Server: %v (Bootstrap: %v)", config.ServerMode, config.Bootstrap))
|
ui.Info(fmt.Sprintf(" Server: %v (Bootstrap: %v)", config.ServerMode, config.Bootstrap))
|
||||||
ui.Info(fmt.Sprintf(" Client Addr: %v (HTTP: %d, HTTPS: %d, gRPC: %d, DNS: %d)", config.ClientAddrs,
|
ui.Info(fmt.Sprintf(" Client Addr: %v (HTTP: %d, HTTPS: %d, gRPC: %d, DNS: %d)", config.ClientAddrs,
|
||||||
config.HTTPPort, config.HTTPSPort, config.GRPCPort, config.DNSPort))
|
config.HTTPPort, config.HTTPSPort, config.XDSPort, config.DNSPort))
|
||||||
ui.Info(fmt.Sprintf(" Cluster Addr: %v (LAN: %d, WAN: %d)", config.AdvertiseAddrLAN,
|
ui.Info(fmt.Sprintf(" Cluster Addr: %v (LAN: %d, WAN: %d)", config.AdvertiseAddrLAN,
|
||||||
config.SerfPortLAN, config.SerfPortWAN))
|
config.SerfPortLAN, config.SerfPortWAN))
|
||||||
ui.Info(fmt.Sprintf(" Encrypt: Gossip: %v, TLS-Outgoing: %v, TLS-Incoming: %v, Auto-Encrypt-TLS: %t",
|
ui.Info(fmt.Sprintf(" Encrypt: Gossip: %v, TLS-Outgoing: %v, TLS-Incoming: %v, Auto-Encrypt-TLS: %t",
|
||||||
|
|
Loading…
Reference in New Issue