Skip to content

NO-JIRA: Improve graceful shutdown LB test output with more details of late requests - #31158

Merged
dgoodwin merged 2 commits into
openshift:mainfrom
dgoodwin:improve-lb-test-output
May 12, 2026
Merged

dgoodwin merged 2 commits into
openshift:mainfrom
dgoodwin:improve-lb-test-output

Conversation

@dgoodwin

@dgoodwin dgoodwin commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Enhance further by correlating with graceful shutdown intervals

Summary by CodeRabbit

  • Improvements
    • Richer tracking of API server requests observed during graceful shutdown: captures full request details (audit metadata, requester, response status, annotations) and correlates each request to shutdown intervals to report elapsed time since shutdown start. Test reporting now surfaces formatted late-request details for clearer diagnostics and failure messages.

…quests

Enhance further by correlating with graceful shutdown intervals
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Audit-log graceful-shutdown tracking now records detailed late-request records (metadata, actor/source, response code, elapsed time placeholder) instead of only audit IDs, and correlates those records with GracefulAPIServerShutdown intervals to compute elapsed time since shutdown before test evaluation.

Changes

Graceful Shutdown Request Tracking

Layer / File(s) Summary
Data Shape
pkg/monitortests/kubeapiserver/auditloganalyzer/handle_requests_during_graceful_shutdown.go
Adds lateRequest struct (audit metadata, request/actor fields, response code, elapsedSinceShutdown) and lateRequest.String() for formatted output.
Storage Update
pkg/monitortests/kubeapiserver/auditloganalyzer/handle_requests_during_graceful_shutdown.go
Replaces lateRequestTracking.auditIDs []string with lateRequests []lateRequest.
Event Handling
pkg/monitortests/kubeapiserver/auditloganalyzer/handle_requests_during_graceful_shutdown.go
HandleAuditLogEvent still filters by openshift.io/during-graceful and ignores loopback entries; now extracts ResponseStatus.Code (if present) and appends a lateRequest with elapsedSinceShutdown initialized as unknown (-1).
Correlation
pkg/monitortests/kubeapiserver/auditloganalyzer/handle_requests_during_graceful_shutdown.go
Adds correlateWithShutdownIntervals(finalIntervals monitorapi.Intervals) which filters for GracefulAPIServerShutdown intervals and sets each lateRequest.elapsedSinceShutdown = reqTime.Sub(shutdown.From) when the request timestamp falls within an interval.

Test Evaluation Integration

Layer / File(s) Summary
Evaluation Hook
pkg/monitortests/kubeapiserver/auditloganalyzer/monitortest.go
EvaluateTestsFromConstructedIntervals now calls w.requestsDuringShutdownChecker.correlateWithShutdownIntervals(finalIntervals) before evaluating results.
Failure Detection / Output
pkg/monitortests/kubeapiserver/auditloganalyzer/monitortest.go
Kube-apiserver shutdown JUnit check now uses len(w.requestsDuringShutdownChecker.lateRequests) (not auditIDs) and formats failures using each lateRequest.String() instead of raw audit IDs.

Sequence Diagram

sequenceDiagram
  participant AuditLog as AuditLog/Event
  participant Analyzer as GracefulShutdownAnalyzer
  participant Intervals as ShutdownIntervalsStore
  participant Evaluator as TestEvaluator

  AuditLog->>Analyzer: Emit audit event (with openshift.io/during-graceful)
  Analyzer->>Analyzer: Build lateRequest (metadata, response code, elapsed=-1)
  Evaluator->>Intervals: Provide finalIntervals
  Evaluator->>Analyzer: invoke correlateWithShutdownIntervals(finalIntervals)
  Analyzer->>Intervals: filter GracefulAPIServerShutdown intervals
  Analyzer->>Analyzer: match lateRequest timestamp -> set elapsedSinceShutdown
  Analyzer->>Evaluator: return correlated lateRequests for test evaluation
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The modified test name is static and deterministic with no dynamic values. PR only changes test body and failure output formatting, not the test name itself.
Test Structure And Quality ✅ Passed Check not applicable. The PR modifies monitoring/audit analysis infrastructure code, not Ginkgo tests. No Ginkgo test blocks are present.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests (It, Describe, Context, When, etc.) are added in this PR. Changes are to monitoring framework helper code (audit log analysis). Check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests added. PR modifies monitoring framework utility code for tracking late requests during graceful shutdown, not test declarations.
Topology-Aware Scheduling Compatibility ✅ Passed This PR only modifies test/monitoring framework code for audit log analysis. No deployment manifests, operator code, or workload scheduling constraints are introduced.
Ote Binary Stdout Contract ✅ Passed No new stdout writes to process-level code. PR adds fmt.Sprintf in String() method (returns string, not stdout). Existing fmt.Printf calls predate this PR.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR does not add Ginkgo e2e tests. Changes are monitor utility code for tracking graceful shutdown. No IPv4 assumptions or external connectivity requirements found.
Title check ✅ Passed The title accurately summarizes the main change: improving graceful shutdown LB test output by adding more details about late requests, which matches the enhanced request tracking and correlation logic in the code changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
openshift-ci Bot requested review from deads2k and p0lyn0mial May 11, 2026 18:20
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@pkg/monitortests/kubeapiserver/auditloganalyzer/handle_requests_during_graceful_shutdown.go`:
- Around line 94-110: correlateWithShutdownIntervals mutates l.lateRequests and
elapsedSinceShutdown without holding the mutex used by HandleAuditLogEvent,
causing a data race; wrap the loop that updates l.lateRequests in the same
lock/unlock used for event ingestion (the mutex used inside HandleAuditLogEvent)
so all reads/writes to l.lateRequests are synchronized, ensuring you acquire the
mutex before iterating/updating and release it after the updates complete inside
lateRequestTracking.correlateWithShutdownIntervals.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: cf7442b3-701c-4118-b427-e19e0075f519

📥 Commits

Reviewing files that changed from the base of the PR and between 5ab531b and e75517d.

📒 Files selected for processing (2)
  • pkg/monitortests/kubeapiserver/auditloganalyzer/handle_requests_during_graceful_shutdown.go
  • pkg/monitortests/kubeapiserver/auditloganalyzer/monitortest.go

@openshift-merge-bot openshift-merge-bot Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label May 11, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@xueqzhan

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 11, 2026
@openshift-ci

openshift-ci Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dgoodwin, xueqzhan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dgoodwin

Copy link
Copy Markdown
Contributor Author

/override ci/prow/e2e-vsphere-ovn-upi

@openshift-ci

openshift-ci Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

@dgoodwin: Overrode contexts on behalf of dgoodwin: ci/prow/e2e-vsphere-ovn-upi

Details

In response to this:

/override ci/prow/e2e-vsphere-ovn-upi

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 kubernetes-sigs/prow repository.

@openshift-ci

openshift-ci Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

@dgoodwin: all tests passed!

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

@dgoodwin dgoodwin changed the title Improve graceful shutdown LB test output with more details of late requests NO-JIRA: Improve graceful shutdown LB test output with more details of late requests May 12, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 12, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@dgoodwin: This pull request explicitly references no jira issue.

Details

In response to this:

Enhance further by correlating with graceful shutdown intervals

Summary by CodeRabbit

  • Improvements
  • Richer tracking of API server requests observed during graceful shutdown: captures full request details (audit metadata, requester, response status, annotations) and correlates each request to shutdown intervals to report elapsed time since shutdown start. Test reporting now surfaces formatted late-request details for clearer diagnostics and failure messages.

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.

@dgoodwin

Copy link
Copy Markdown
Contributor Author

/verified bypass

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label May 12, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@dgoodwin: The verified label has been added.

Details

In response to this:

/verified bypass

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.

@dgoodwin
dgoodwin merged commit 2dbf857 into openshift:main May 12, 2026
@dgoodwin
dgoodwin deleted the improve-lb-test-output branch May 12, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants