update readme; add id to hpeer version
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
f845269a5a
commit
2996e1d229
5 changed files with 264 additions and 7 deletions
|
@ -29,7 +29,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/gomodule/redigo/redis"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
@ -73,7 +72,7 @@ func (s *Server) getOrAllocatePeerIP(ctx context.Context, id string) (net.IP, *n
|
|||
func (s *Server) getNodeIP(ctx context.Context, id string) (net.IP, *net.IPNet, error) {
|
||||
subnet, err := redis.String(s.local(ctx, "GET", s.getNodeNetworkKey(id)))
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrap(err, "error getting node ip")
|
||||
return nil, nil, err
|
||||
}
|
||||
r, err := parseSubnetRange(subnet)
|
||||
if err != nil {
|
||||
|
|
|
@ -301,7 +301,10 @@ func (s *Server) updateMasterInfo(ctx context.Context) error {
|
|||
// build redis url with gateway ip
|
||||
gatewayIP, _, err := s.getNodeIP(ctx, s.cfg.ID)
|
||||
if err != nil {
|
||||
logrus.Error("updateMasterInfo.getNodeIP")
|
||||
if err == redis.ErrNil {
|
||||
logrus.Warnf("node does not have an IP assigned yet")
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
u, err := url.Parse(s.cfg.RedisURL)
|
||||
|
|
|
@ -142,7 +142,7 @@ func (s *Server) Run() error {
|
|||
return err
|
||||
}
|
||||
|
||||
logrus.Debugf("master info received: %+v", r)
|
||||
logrus.Debugf("master info received: id=%s grpc=%s", r.Master.ID, r.Master.GRPCAddress)
|
||||
// start tunnel
|
||||
if err := s.updatePeerConfig(ctx, r.Node, r.Peers); err != nil {
|
||||
return errors.Wrap(err, "error updating peer config")
|
||||
|
@ -354,7 +354,6 @@ func (s *Server) ensureNetworkSubnet(ctx context.Context, id string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
logrus.Debugf("node networks: %s", nodeNetworkKeys)
|
||||
lookup := map[string]struct{}{}
|
||||
for _, netKey := range nodeNetworkKeys {
|
||||
n, err := redis.String(s.local(ctx, "GET", netKey))
|
||||
|
@ -364,8 +363,6 @@ func (s *Server) ensureNetworkSubnet(ctx context.Context, id string) error {
|
|||
lookup[n] = struct{}{}
|
||||
}
|
||||
|
||||
logrus.Debugf("lookup: %+v", lookup)
|
||||
|
||||
subnet := r.Subnet
|
||||
size, _ := subnet.Mask.Size()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue