-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 3452 #3500
Issue 3452 #3500
Conversation
Still needs unit test |
…g of catalog nodes that have been removed from serf
18cdaee
to
2a9e25d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted some small stuff and then this should be good to merge.
agent/consul/leader.go
Outdated
for _, service := range services.Services { | ||
if service.ID == structs.ConsulServiceID { | ||
serverPort = service.Port | ||
_, node, err := state.GetNode(check.Node) | ||
if err != nil { | ||
s.logger.Printf("[ERR] Unable to look up node with name %v, got error:%v", check.Node, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be [ERR] consul:
for the prefix, and we usually just do a colon before the error, so [ERR] consul: Unable to look up node with name %q: %v"
agent/consul/leader.go
Outdated
for _, service := range services.Services { | ||
if service.ID == structs.ConsulServiceID { | ||
serverPort = service.Port | ||
_, node, err := state.GetNode(check.Node) | ||
if err != nil { | ||
s.logger.Printf("[ERR] Unable to look up node with name %v, got error:%v", check.Node, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can't get an address we should probably just bail rather than let the net.ParseIP
return something bogus below. I'd add a label and do a continue CHECKS
here for the error.
agent/consul/leader_test.go
Outdated
joinLAN(t, s1, s2) | ||
joinLAN(t, s1, s3) | ||
|
||
state := s1.fsm.State() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this down before the first retry.Run
just since it seems out of place here.
agent/consul/leader_test.go
Outdated
Status: api.HealthCritical, | ||
}) | ||
|
||
// call reconcileReaped with a map that does not contain s2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment should say s3
.
agent/consul/leader_test.go
Outdated
} | ||
}) | ||
|
||
// Make a failed healthcheck for s2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this health check to be registered.
agent/consul/leader_test.go
Outdated
// Should be deregistered; we have to poll quickly here because | ||
// anti-entropy will put it back. | ||
reaped := false | ||
for start := time.Now(); time.Since(start) < 5*time.Second; { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a little flaky, but since AE is fairly slow this should be ok. I'd use retry.Run
here though and have it fail with an error if the node is still registered, that'll simplify the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
agent/consul/leader.go
Outdated
for _, service := range services.Services { | ||
if service.ID == structs.ConsulServiceID { | ||
_, node, err := state.GetNode(check.Node) | ||
if err != nil { | ||
s.logger.Printf("[ERR] consul: Unable to look up node with name %q:%v", check.Node, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a space after the ":"
agent/consul/leader.go
Outdated
if err != nil { | ||
s.logger.Printf("[ERR] consul: Unable to look up node with name %q:%v", check.Node, err) | ||
continue checks | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop the else :-)
Fixes #3452.