add advertise grpc address option
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
4bc08c92c2
commit
f18d19aeb5
5 changed files with 22 additions and 15 deletions
|
@ -5,5 +5,3 @@ auto-elects in the event of a current master failure. Non-node peers are also s
|
||||||
can only access the network but do not provide routing capabilities.
|
can only access the network but do not provide routing capabilities.
|
||||||
|
|
||||||
![Heimdall](docs/overview.png)
|
![Heimdall](docs/overview.png)
|
||||||
|
|
||||||
#
|
|
||||||
|
|
|
@ -60,6 +60,12 @@ func main() {
|
||||||
Value: fmt.Sprintf("tcp://%s:%d", heimdall.GetIP(), defaultGRPCPort),
|
Value: fmt.Sprintf("tcp://%s:%d", heimdall.GetIP(), defaultGRPCPort),
|
||||||
EnvVar: "HEIMDALL_GRPC_ADDR",
|
EnvVar: "HEIMDALL_GRPC_ADDR",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "advertise-grpc-address",
|
||||||
|
Usage: "public advertise grpc address",
|
||||||
|
Value: fmt.Sprintf("tcp://%s:%d", heimdall.GetIP(), defaultGRPCPort),
|
||||||
|
EnvVar: "HEIMDALL_ADVERTISE_GRPC_ADDR",
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "redis-url, r",
|
Name: "redis-url, r",
|
||||||
Usage: "uri for datastore backend",
|
Usage: "uri for datastore backend",
|
||||||
|
|
|
@ -41,17 +41,18 @@ import (
|
||||||
|
|
||||||
func runServer(cx *cli.Context) error {
|
func runServer(cx *cli.Context) error {
|
||||||
cfg := &heimdall.Config{
|
cfg := &heimdall.Config{
|
||||||
ID: cx.String("id"),
|
ID: cx.String("id"),
|
||||||
GRPCAddress: cx.String("addr"),
|
GRPCAddress: cx.String("addr"),
|
||||||
GRPCPeerAddress: cx.String("peer"),
|
AdvertiseGRPCAddress: cx.String("advertise-grpc-address"),
|
||||||
ClusterKey: cx.String("cluster-key"),
|
GRPCPeerAddress: cx.String("peer"),
|
||||||
NodeNetwork: cx.String("node-network"),
|
ClusterKey: cx.String("cluster-key"),
|
||||||
PeerNetwork: cx.String("peer-network"),
|
NodeNetwork: cx.String("node-network"),
|
||||||
EndpointIP: cx.String("endpoint-ip"),
|
PeerNetwork: cx.String("peer-network"),
|
||||||
EndpointPort: cx.Int("endpoint-port"),
|
EndpointIP: cx.String("endpoint-ip"),
|
||||||
InterfaceName: cx.String("interface-name"),
|
EndpointPort: cx.Int("endpoint-port"),
|
||||||
RedisURL: cx.String("redis-url"),
|
InterfaceName: cx.String("interface-name"),
|
||||||
AdvertiseRedisURL: cx.String("advertise-redis-url"),
|
RedisURL: cx.String("redis-url"),
|
||||||
|
AdvertiseRedisURL: cx.String("advertise-redis-url"),
|
||||||
}
|
}
|
||||||
|
|
||||||
errCh := make(chan error, 1)
|
errCh := make(chan error, 1)
|
||||||
|
|
|
@ -29,6 +29,8 @@ type Config struct {
|
||||||
ID string
|
ID string
|
||||||
// GRPCAddress is the address for the grpc server
|
// GRPCAddress is the address for the grpc server
|
||||||
GRPCAddress string
|
GRPCAddress string
|
||||||
|
// AdvertiseGRPCAddress is the public address for the grpc server
|
||||||
|
AdvertiseGRPCAddress string
|
||||||
// GRPCPeerAddress is the peer address to join
|
// GRPCPeerAddress is the peer address to join
|
||||||
GRPCPeerAddress string
|
GRPCPeerAddress string
|
||||||
// ClusterKey is a preshared key for cluster peers
|
// ClusterKey is a preshared key for cluster peers
|
||||||
|
|
|
@ -99,7 +99,7 @@ func (s *Server) configureNode() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// ignore self
|
// ignore self
|
||||||
if node.Addr == s.cfg.GRPCAddress {
|
if node.ID == s.cfg.ID {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ func (s *Server) updateMasterInfo(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
m := &v1.Master{
|
m := &v1.Master{
|
||||||
ID: s.cfg.ID,
|
ID: s.cfg.ID,
|
||||||
GRPCAddress: s.cfg.GRPCAddress,
|
GRPCAddress: s.cfg.AdvertiseGRPCAddress,
|
||||||
RedisURL: s.cfg.AdvertiseRedisURL,
|
RedisURL: s.cfg.AdvertiseRedisURL,
|
||||||
}
|
}
|
||||||
data, err := proto.Marshal(m)
|
data, err := proto.Marshal(m)
|
||||||
|
|
Loading…
Reference in a new issue