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
Monitor - delete iptable rule if API not reachable through Haproxy #14
Monitor - delete iptable rule if API not reachable through Haproxy #14
Conversation
/approve |
pkg/monitor/monitor.go
Outdated
@@ -144,16 +146,21 @@ func Monitor(clusterName, clusterDomain, templatePath, cfgPath, apiVip string, a | |||
|
|||
ok, err := utils.IsKubernetesHealthy(lbPort) | |||
if err == nil && ok { | |||
log.Info("API reachable through HAProxy") | |||
if k8sIsHealthy == false { |
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 k8sIsHealthy == false { | |
if ! k8sIsHealthy { |
pkg/monitor/monitor.go
Outdated
err := ensureHAProxyPreRoutingRule(apiVip, apiPort, lbPort) | ||
if err != nil { | ||
log.WithFields(logrus.Fields{"err": err}).Error("Failed to ensure HAProxy PREROUTING rule to direct traffic to the LB") | ||
} | ||
} else { | ||
log.Info("API still not reachable through HAProxy") | ||
cleanHAProxyPreRoutingRule(apiVip, apiPort, lbPort) | ||
if k8sIsHealthy == true { |
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 k8sIsHealthy == true { | |
if k8sIsHealthy { |
If Haproxy went down for some reason, the Iptable rule that redirects API traffic to Haproxy LB, should be removed. This change also updates logging to report LB status only upon a change instead of reporting the current status every 15 seconds.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bcrochet, celebdor, yboaron The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
If Haproxy went down for some reason, the Iptable rule that
redirects API traffic to Haproxy LB, should be removed.