OCPBUGS-86789: Make LateConnections test outcome-based#31412
Conversation
The '[Late] API LBs follow /readyz of kube-apiserver and stop sending requests' test failed on the mere presence of a LateConnections event. That event only proves an LB routed a new connection to a terminating kube-apiserver late in the shutdown window; it says nothing about whether any client was harmed. With shutdown-send-retry-after enabled (the OpenShift default), late requests are rejected with 429 + Retry-After + Connection: close and clients transparently retry against a healthy backend. These events were silently swallowed for years due to a type assertion bug in the openshift/kubernetes carry patch and started being emitted after the Kube 1.36 rebase, turning inherent LB convergence latency into hard test failures across multiple platforms (in-cluster kubernetes.default/OVN path on metal, cloud LBs on Azure/AWS). Make the test verify the outcome instead of the mechanism: when a LateConnections event is found, inspect the kube-apiserver audit log of the affected node for the surrounding time window and - flake (not fail) when all late requests were gracefully rejected with 429, keeping a fingerprint of slow LB convergence, - fail when late requests were answered with 5xx, - fail when no graceful rejection is recorded at all, since the late connections were then probably reset without a response, - fail when audit logs cannot be inspected or the event cannot be attributed to a node. Signed-off-by: Mateusz Kowalski <mko@redhat.com> Generated-by: AI
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
@mkowalski: This pull request references Jira Issue OCPBUGS-86789, which is valid. 3 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mkowalski The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
WalkthroughThe graceful termination test now correlates ChangesGraceful termination testing
Sequence Diagram(s)sequenceDiagram
participant LateConnectionsTest
participant nodeNameFromKASEvent
participant auditEntriesForNodeInWindow
participant KubeAPIServerAuditLogs
LateConnectionsTest->>nodeNameFromKASEvent: Attribute late event to a node
nodeNameFromKASEvent-->>LateConnectionsTest: Return node name
LateConnectionsTest->>auditEntriesForNodeInWindow: Query audit entries for the event window
auditEntriesForNodeInWindow->>KubeAPIServerAuditLogs: List and parse audit logs
KubeAPIServerAuditLogs-->>auditEntriesForNodeInWindow: Return filtered audit events
auditEntriesForNodeInWindow-->>LateConnectionsTest: Return response statuses
LateConnectionsTest->>LateConnectionsTest: Classify 429, 5xx, or missing responses
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 2 warnings)
✅ Passed checks (12 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@mkowalski: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
What
Makes the
[sig-api-machinery][Feature:APIServer][Late] API LBs follow /readyz of kube-apiserver and stop sending requeststest outcome-based instead of failing on the mere presence of aLateConnectionsevent.When a
LateConnectionsevent is found, the test now inspects the kube-apiserver audit log of the affected node for the surrounding time window and:429 + Retry-After— keeping a fingerprint of slow LB convergence without failing the run,Why
The
LateConnections/NonReadyRequestsevents were silently swallowed for ~5 years due to a type assertion bug in the openshift/kubernetes carry patch (unexpectedRequestsEventf.Store(s.Eventf)stored a method value whose dynamic type never matched theeventfFuncassertion). The Kube 1.36 rebase fixed the conversion, the events started being emitted, and this test began failing across multiple platforms — see Component Readiness regressions 44896 (metal-ipi ovn ipv4/ipv6/dualstack) and 44949 (azure ovn serial), tracked in OCPBUGS-86789.Analysis of all 12 failing job runs shows the event only proves that a load balancer routed a new connection to a terminating kube-apiserver late in the shutdown window. No LB implementation can be perfectly synchronized with
/readyz:kubernetes.default/OVN path goes stale when ovn-kubernetes' EndpointSlice informers lose their API watches through the api-int VIP during the control-plane rollout itself (~50 watch failures observed in the minute preceding the event inperiodic-ci-openshift-release-main-nightly-5.0-e2e-metal-ipi-ovn-dualstack/2079715174809341952),Meanwhile
shutdown-send-retry-after=trueis the OpenShift default: late requests get429 + Retry-After + Connection: closeand well-behaved clients transparently retry against a healthy backend. Routing late is a mechanism detail; harming a client is the outcome that matters. The test now distinguishes the two.Notes
LateConnectionsevent exists, so healthy runs pay zero extra cost; this is a[Late]test so runtime pressure is low.send-retry-after-while-not-ready-onceon all topologies).🤖 This PR was generated by AI on behalf of @mkowalski, who has reviewed it.
Summary by CodeRabbit