e2e: Add backend health check e2e case via active http
What this PR does / why we need it:
Check whether backend health check via active http works in e2e, inspired by https://github.com/projectcontour/contour/blob/main/test/e2e/httpproxy/http_health_checks_test.go.
EG use the default 50% from Envoy as cluster panic threshold. In case of health check fail, all endpoints in cluster become unhealthy and panic mode is activated, request is distributed to all unhealthy echo-basic endpoints and get response from echo-basic, with same behavior as case of health check pass.
To make those two cases distinguishable, in case of health check fail, Envoy should not distribute request to unhealthy endpoint, respond with 503 no healthy upstream directly. This requires cluster panic mode is disabled.
Since EG doesn't have knob to configure cluster panic threshold currently, I use EnvoyPatchPolicy to disable cluster panic mode in this PR.
Issues about panic threshold in contour: https://github.com/projectcontour/contour/issues/579. https://github.com/projectcontour/contour/issues/1846
Which issue(s) this PR fixes:
xref #2417
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 69.01%. Comparing base (
5050e36) to head (bf9cabf). Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #3677 +/- ##
==========================================
- Coverage 69.02% 69.01% -0.01%
==========================================
Files 176 176
Lines 21688 21688
==========================================
- Hits 14971 14969 -2
- Misses 5637 5638 +1
- Partials 1080 1081 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
thanks for picking this one up @aoledk !
would be great to also make sure we can check if the membership_degraded stat https://www.envoyproxy.io/docs/envoy/latest/configuration/upstream/cluster_manager/cluster_stats is also bumped
similar to whats done here https://github.com/envoyproxy/gateway/blob/d784c3237765aa258c3526b32765dd9c3abf6415/test/e2e/tests/connection_limit.go#L70
We can use membership_healthy to tell whether active http health check works, instead of membership_degraded which requires upstream host to respond with special x-envoy-degraded header ^1, IMO it's out of this issue's scope.
- In case of health check pass,
membership_healthyshould > 0. - In case of health check fail,
membership_healthyshould == 0.
# TYPE envoy_cluster_membership_degraded gauge
envoy_cluster_membership_degraded{envoy_cluster_name="httproute/gateway-conformance-infra/http-with-health-check-active-http-fail/rule/0"} 0
envoy_cluster_membership_degraded{envoy_cluster_name="httproute/gateway-conformance-infra/http-with-health-check-active-http-pass/rule/0"} 0
# TYPE envoy_cluster_membership_excluded gauge
envoy_cluster_membership_excluded{envoy_cluster_name="httproute/gateway-conformance-infra/http-with-health-check-active-http-fail/rule/0"} 0
envoy_cluster_membership_excluded{envoy_cluster_name="httproute/gateway-conformance-infra/http-with-health-check-active-http-pass/rule/0"} 0
# TYPE envoy_cluster_membership_healthy gauge
envoy_cluster_membership_healthy{envoy_cluster_name="httproute/gateway-conformance-infra/http-with-health-check-active-http-fail/rule/0"} 0
envoy_cluster_membership_healthy{envoy_cluster_name="httproute/gateway-conformance-infra/http-with-health-check-active-http-pass/rule/0"} 2
# TYPE envoy_cluster_membership_total gauge
envoy_cluster_membership_total{envoy_cluster_name="httproute/gateway-conformance-infra/http-with-health-check-active-http-fail/rule/0"} 2
envoy_cluster_membership_total{envoy_cluster_name="httproute/gateway-conformance-infra/http-with-health-check-active-http-pass/rule/0"} 2
membership_health works, thanks !
/retest