Unverified Commit 2e7bc1ef authored by OpenShift Merge Robot's avatar OpenShift Merge Robot Committed by GitHub
Browse files

Merge pull request #651 from Miciah/cherry-pick-650-to-release-4.8

[release-4.8] Bug 2000414: Configure router to use "source" for passthrough
parents e9e62957 647edc6c
......@@ -58,6 +58,7 @@ const (
RouterHeaderBufferMaxRewriteSize = "ROUTER_MAX_REWRITE_SIZE"
RouterLoadBalancingAlgorithmEnvName = "ROUTER_LOAD_BALANCE_ALGORITHM"
RouterTCPLoadBalancingAlgorithmEnvName = "ROUTER_TCP_BALANCE_SCHEME"
RouterDisableHTTP2EnvName = "ROUTER_DISABLE_HTTP2"
RouterDefaultEnableHTTP2Annotation = "ingress.operator.openshift.io/default-enable-http2"
......@@ -416,6 +417,11 @@ func desiredRouterDeployment(ci *operatorv1.IngressController, ingressController
return nil, fmt.Errorf("ingresscontroller %q has invalid spec.unsupportedConfigOverrides: %w", ci.Name, err)
}
}
// For non-TLS, edge-terminated, and reencrypt routes, use the "random"
// balancing algorithm by default, but allow an unsupported config
// override to override it. For passthrough routes, use the "source"
// balancing algorithm in order to provide some session-affinity.
loadBalancingAlgorithm := "random"
switch unsupportedConfigOverrides.LoadBalancingAlgorithm {
case "leastconn":
......@@ -424,6 +430,9 @@ func desiredRouterDeployment(ci *operatorv1.IngressController, ingressController
env = append(env, corev1.EnvVar{
Name: RouterLoadBalancingAlgorithmEnvName,
Value: loadBalancingAlgorithm,
}, corev1.EnvVar{
Name: RouterTCPLoadBalancingAlgorithmEnvName,
Value: "source",
})
if len(ci.Status.Domain) > 0 {
......
......@@ -219,6 +219,7 @@ func TestDesiredRouterDeployment(t *testing.T) {
}
checkDeploymentHasEnvVar(t, deployment, "ROUTER_LOAD_BALANCE_ALGORITHM", true, "random")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_TCP_BALANCE_SCHEME", true, "source")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_USE_PROXY_PROTOCOL", false, "")
......@@ -378,6 +379,7 @@ func TestDesiredRouterDeployment(t *testing.T) {
}
checkDeploymentHasEnvVar(t, deployment, "ROUTER_LOAD_BALANCE_ALGORITHM", true, "leastconn")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_TCP_BALANCE_SCHEME", true, "source")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_USE_PROXY_PROTOCOL", true, "true")
......@@ -447,6 +449,7 @@ func TestDesiredRouterDeployment(t *testing.T) {
}
checkDeploymentHasEnvVar(t, deployment, "ROUTER_LOAD_BALANCE_ALGORITHM", true, "random")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_TCP_BALANCE_SCHEME", true, "source")
checkDeploymentDoesNotHaveEnvVar(t, deployment, "ROUTER_USE_PROXY_PROTOCOL")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment