-
Notifications
You must be signed in to change notification settings - Fork 580
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
Warn instead of fatal if deleted host is not found in k8s. #78
Conversation
hosts/hosts.go
Outdated
err := k8s.CordonUncordon(kubeClient, toDeleteHost.HostnameOverride, true) | ||
if err != nil { | ||
if _, err := k8s.GetNode(kubeClient, toDeleteHost.HostnameOverride); err != nil { | ||
if !apierrors.IsNotFound(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.
Start with if apierrors.isNotFound
, and if met, log a messgae Can't find k8s node by name []
e0eca94
to
3a42725
Compare
hosts/hosts.go
Outdated
logrus.Warnf("[hosts] Can't find node by name [%s]") | ||
return nil | ||
} else { | ||
return 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 don't think there is a need for else
. Just return err
3a42725
to
9e50f0d
Compare
hosts/hosts.go
Outdated
if !apierrors.IsNotFound(err) { | ||
return err | ||
} else { | ||
logrus.Warnf("[hosts] Host [%s] is not a Kubernetes node") |
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.
specify the host name for %s
9e50f0d
to
30eb95c
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.
LGTM
#70