Skip to content

fix: wrong Pod's UID and emtpy Pod's name in log of webhook.go #1092

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

Shouren
Copy link
Collaborator

@Shouren Shouren commented May 28, 2025

What type of PR is this?
/kind bug

What this PR does / why we need it:
This PR updates the Handle() func in pkg/scheduler/webhook.go. The previous implementation using req.UID and req.Name when logging. However, according to the doc of AdmissionRequest as below:

// UID is an identifier for the individual request/response. It allows us to distinguish instances of requests which are
// otherwise identical (parallel requests, requests when earlier requests did not modify etc)
// The UID is meant to track the round trip (request/response) between the KAS and the WebHook, not the user request.
// It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging.
UID types.UID json:"uid" protobuf:"bytes,1,opt,name=uid"

req.UID is not equal to pod.UID, as shown in the following screenshot.

CleanShot 2025-05-27 at 17 36 39

And the req.Name might be empty according the above doc:

// Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and
// rely on the server to generate the name. If that is the case, this field will contain an empty string.
// +optional
Name string json:"name,omitempty" protobuf:"bytes,5,opt,name=name"

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
@archlitchi

Does this PR introduce a user-facing change?:

@hami-robott hami-robott bot added kind/bug Something isn't working dco-signoff: yes labels May 28, 2025
@hami-robott hami-robott bot requested review from chaunceyjiang and wawa0210 May 28, 2025 03:01
Copy link
Contributor

hami-robott bot commented May 28, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Shouren
Once this PR has been reviewed and has the lgtm label, please assign wawa0210 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@hami-robott hami-robott bot added the size/S label May 28, 2025
Copy link

codecov bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/scheduler/webhook.go 50.00% 3 Missing ⚠️
Flag Coverage Δ
unittests 61.08% <50.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/scheduler/webhook.go 56.00% <50.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant