Skip to content

Commit

Permalink
Revert "Fix of BUG 1405440"
Browse files Browse the repository at this point in the history
This reverts commit 5b708a5.
  • Loading branch information
pecameron committed Mar 10, 2017
1 parent d922c93 commit 0d8009f
Showing 1 changed file with 18 additions and 30 deletions.
48 changes: 18 additions & 30 deletions pkg/cmd/admin/router/router.go
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,11 @@ 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}
probe = &kapi.Probe{}
healthzPort := defaultHealthzPort
if cfg.StatsPort > 0 {
healthzPort = cfg.StatsPort
Expand All @@ -459,6 +431,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 0d8009f

Please sign in to comment.