Skip to content

Commit

Permalink
NE-585 Make ROUTER_BACKEND_CHECK_INTERVAL configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
candita committed Mar 2, 2022
1 parent 5040f65 commit eeb2ed5
Show file tree
Hide file tree
Showing 21 changed files with 422 additions and 42 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,5 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/openshift/api => github.com/candita/api v0.0.0-20220301225112-bd018e2d6a07
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqO
github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/candita/api v0.0.0-20220301225112-bd018e2d6a07 h1:8zzuZmQ0ANOB9LCOHT53wHEWwAW1QwRZk18Xm2LKm/w=
github.com/candita/api v0.0.0-20220301225112-bd018e2d6a07/go.mod h1:F/eU6jgr6Q2VhMu1mSpMmygxAELd7+BUxs3NHZ25jV4=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
Expand Down Expand Up @@ -614,10 +616,6 @@ github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/openshift/api v0.0.0-20210331162552-3e31249e6a55/go.mod h1:dZ4kytOo3svxJHNYd0J55hwe/6IQG5gAUHUE0F3Jkio=
github.com/openshift/api v0.0.0-20210331193751-3acddb19d360/go.mod h1:dZ4kytOo3svxJHNYd0J55hwe/6IQG5gAUHUE0F3Jkio=
github.com/openshift/api v0.0.0-20220121101128-0a830aea20c2 h1:k7WUmWEs5+SYT6j4tiB9sLJ7uOYeR/U/eFEWbUjGvgM=
github.com/openshift/api v0.0.0-20220121101128-0a830aea20c2/go.mod h1:F/eU6jgr6Q2VhMu1mSpMmygxAELd7+BUxs3NHZ25jV4=
github.com/openshift/build-machinery-go v0.0.0-20210209125900-0da259a2c359/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/build-machinery-go v0.0.0-20211213093930-7e33a7eb4ce3/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/client-go v0.0.0-20210331195552-cf6c2669e01f/go.mod h1:hHaRJ6vp2MRd/CpuZ1oJkqnMGy5eEnoAkQmKPZKcUPI=
Expand Down
9 changes: 9 additions & 0 deletions manifests/00-custom-resource-definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,15 @@ spec:
format: int32
minimum: 4096
type: integer
healthCheckInterval:
description: "healthCheckInterval defines how long the router
waits between two consecutive health checks on its configured
backends. This value is applied globally as a default for all
routes, but may be overridden per-route by the route annotation
\"router.openshift.io/haproxy.health.check.interval\". \n If
unset, the default healthCheckInterval is 5s."
format: duration
type: string
serverFinTimeout:
description: "serverFinTimeout defines how long a connection will
be held open while waiting for the server/backend response to
Expand Down
8 changes: 4 additions & 4 deletions pkg/manifests/bindata.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pkg/operator/controller/ingress/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ func desiredRouterDeployment(ci *operatorv1.IngressController, ingressController
if ci.Spec.TuningOptions.TLSInspectDelay != nil && ci.Spec.TuningOptions.TLSInspectDelay.Duration > 0*time.Second {
env = append(env, corev1.EnvVar{Name: "ROUTER_INSPECT_DELAY", Value: durationToHAProxyTimespec(ci.Spec.TuningOptions.TLSInspectDelay.Duration)})
}
if ci.Spec.TuningOptions.HealthCheckInterval != nil && ci.Spec.TuningOptions.HealthCheckInterval.Duration > 5*time.Second {
env = append(env, corev1.EnvVar{Name: "ROUTER_BACKEND_CHECK_TIMEOUT",
Value: durationToHAProxyTimespec(ci.Spec.TuningOptions.HealthCheckInterval.Duration)})
}

nodeSelector := map[string]string{
"kubernetes.io/os": "linux",
Expand Down
4 changes: 4 additions & 0 deletions pkg/operator/controller/ingress/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ func TestDesiredRouterDeployment(t *testing.T) {
checkDeploymentHasEnvVar(t, deployment, "ROUTER_DEFAULT_SERVER_FIN_TIMEOUT", false, "")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_DEFAULT_TUNNEL_TIMEOUT", false, "")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_INSPECT_DELAY", false, "")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_BACKEND_CHECK_TIMEOUT", false, "")

checkDeploymentHasEnvVar(t, deployment, RouterEnableCompression, false, "")
checkDeploymentHasEnvVar(t, deployment, RouterCompressionMIMETypes, false, "")
Expand Down Expand Up @@ -364,6 +365,8 @@ func TestDesiredRouterDeployment(t *testing.T) {
ci.Spec.TuningOptions.ServerFinTimeout = &metav1.Duration{4 * time.Second}
ci.Spec.TuningOptions.TunnelTimeout = &metav1.Duration{30 * time.Minute}
ci.Spec.TuningOptions.TLSInspectDelay = &metav1.Duration{5 * time.Second}
ci.Spec.TuningOptions.HealthCheckInterval = &metav1.Duration{15 * time.Second}

ci.Spec.TLSSecurityProfile = &configv1.TLSSecurityProfile{
Type: configv1.TLSProfileCustomType,
Custom: &configv1.CustomTLSProfile{
Expand Down Expand Up @@ -473,6 +476,7 @@ func TestDesiredRouterDeployment(t *testing.T) {
checkDeploymentHasEnvVar(t, deployment, "ROUTER_DEFAULT_SERVER_FIN_TIMEOUT", true, "4s")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_DEFAULT_TUNNEL_TIMEOUT", true, "30m")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_INSPECT_DELAY", true, "5s")
checkDeploymentHasEnvVar(t, deployment, "ROUTER_BACKEND_CHECK_TIMEOUT", true, "15s")

checkDeploymentHasEnvVar(t, deployment, RouterEnableCompression, true, "true")
checkDeploymentHasEnvVar(t, deployment, RouterCompressionMIMETypes, true, "text/html application/*")
Expand Down
13 changes: 9 additions & 4 deletions vendor/github.com/openshift/api/Dockerfile.build

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eeb2ed5

Please sign in to comment.