Skip to content

Commit

Permalink
Roll back fix for 1405440
Browse files Browse the repository at this point in the history
The fix to use a TCP connection check to check whether the HAProxy
process is alive or not doesn't work without a iptables rule for port
1936. The original test using HTTPGet works because HTTPGet supports
a Host field that can be set with "localhost" when host networking is
used. The TCPSocketAction does not support a Host field.

Rolling back the fix until a new fix is developed.

bug 1405440

Signed-off-by: Phil Cameron <pcameron@redhat.com>
  • Loading branch information
pecameron committed Mar 9, 2017
1 parent 39ceb75 commit 8218b14
Showing 1 changed file with 17 additions and 30 deletions.
47 changes: 17 additions & 30 deletions pkg/cmd/admin/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,6 @@ const (
// Default stats and healthz port.
defaultStatsPort = 1936
defaultHealthzPort = defaultStatsPort

// Default initial delay for probes are 10 seconds
defaultProbeInitialDelay = 10
)

// NewCmdRouter implements the OpenShift CLI router command.
Expand Down Expand Up @@ -405,36 +402,10 @@ func generateSecretsConfig(cfg *RouterConfig, namespace string, defaultCert []by
return secrets, volumes, mounts, nil
}

func generateLivenessProbeConfig(cfg *RouterConfig, ports []kapi.ContainerPort) *kapi.Probe {
func generateProbeConfigForRouter(cfg *RouterConfig, ports []kapi.ContainerPort) *kapi.Probe {
var probe *kapi.Probe

if cfg.Type == "haproxy-router" {
probe = &kapi.Probe{InitialDelaySeconds: defaultProbeInitialDelay}
healthzPort := defaultHealthzPort
if cfg.StatsPort > 0 {
healthzPort = cfg.StatsPort
}

// https://bugzilla.redhat.com/show_bug.cgi?id=1405440
// To avoid the failure of HTTP requests due to connection limit in high load scenarios,
// a TCP connection check can be used to check whether the HAProxy process is alive or not.
// This is the most lightweight & cheapest TRUE solution to the BUG.
probe.Handler.TCPSocket = &kapi.TCPSocketAction{
Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: int32(healthzPort),
},
}
}

return probe
}

func generateReadinessProbeConfig(cfg *RouterConfig, ports []kapi.ContainerPort) *kapi.Probe {
var probe *kapi.Probe

if cfg.Type == "haproxy-router" {
probe = &kapi.Probe{InitialDelaySeconds: defaultProbeInitialDelay}
healthzPort := defaultHealthzPort
if cfg.StatsPort > 0 {
healthzPort = cfg.StatsPort
Expand All @@ -459,6 +430,22 @@ func generateReadinessProbeConfig(cfg *RouterConfig, ports []kapi.ContainerPort)
return probe
}

func generateLivenessProbeConfig(cfg *RouterConfig, ports []kapi.ContainerPort) *kapi.Probe {
probe := generateProbeConfigForRouter(cfg, ports)
if probe != nil {
probe.InitialDelaySeconds = 10
}
return probe
}

func generateReadinessProbeConfig(cfg *RouterConfig, ports []kapi.ContainerPort) *kapi.Probe {
probe := generateProbeConfigForRouter(cfg, ports)
if probe != nil {
probe.InitialDelaySeconds = 10
}
return probe
}

func generateMetricsExporterContainer(cfg *RouterConfig, env app.Environment) *kapi.Container {
containerName := "metrics-exporter"
if len(cfg.MetricsImage) > 0 {
Expand Down

0 comments on commit 8218b14

Please sign in to comment.