Skip to content

authz tests: delay response in context cancelled scenario #133310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stlaz
Copy link
Member

@stlaz stlaz commented Jul 30, 2025

What type of PR is this?

/kind flake

What this PR does / why we need it:

It delays authorizer response right after context cancellation to avoid racing with the stdlib's net/http transport context cancellation handling.

Which issue(s) this PR is related to:

Fixes #131069

Special notes for your reviewer:

https://cs.opensource.google/go/go/+/refs/tags/go1.24.5:src/net/http/transport.go;l=2864-2872

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/flake Categorizes issue or PR as related to a flaky test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 30, 2025
@stlaz
Copy link
Member Author

stlaz commented Jul 30, 2025

/test pull-kubernetes-unit
DRA unit test failure

 === RUN   TestPlugin/extended-resource-name-bind-failure/prebind
    dynamicresources_test.go:1824: Assumed claims are different (- expected, + actual):
          []v1.Object(
        - 	{
        - 		s"&ResourceClaim{ObjectMeta:{my-pod-extended-resources-0 my-pod-extended-resources- default    0 0001-01-01 00:00:00 +0000 UTC <ni"...,
        - 	},
        + 	nil,
          )
--- FAIL: TestPlugin/extended-resource-name-bind-failure/prebind (0.01s) 

seems to be tracked in #133302

@enj enj moved this to Needs Triage in SIG Auth Jul 30, 2025
@stlaz stlaz force-pushed the testauthz-delay branch 2 times, most recently from 3248d47 to 7a800b3 Compare July 31, 2025 08:21
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 31, 2025
The net/http transport checks for immediate response when
its handling context cancellation. The unit test was racing
with this check by responding too fast.

Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
@stlaz stlaz force-pushed the testauthz-delay branch from 7a800b3 to efcf97f Compare July 31, 2025 08:22
@aramase aramase moved this from Needs Triage to In Review in SIG Auth Aug 4, 2025
@aramase
Copy link
Member

aramase commented Aug 4, 2025

/triage accepted
/assign liggitt

(assigned as part of SIG Auth triage)

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 4, 2025
@liggitt
Copy link
Member

liggitt commented Aug 6, 2025

/lgtm
/approve

Thanks for the fix, locally this eliminated a ~1% flake.

This isn't urgent, but I'd like to pull this test-only flake fix into release-1.34 after the rc.0 cut

cc @kubernetes/release-managers

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 6, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 414d6460c599a23e49f11c299a88dff073dcb014

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, stlaz

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 6, 2025
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. area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/flake Categorizes issue or PR as related to a flaky test. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

Failure cluster [76ae0294...]: TestAuthorizerMetrics/canceled_request
4 participants