Skip to content
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

refector: refector node webhook #578

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

Conversation

googs1025
Copy link
Contributor

What type of PR is this?

/kind refactor

What this PR does / why we need it:

refactor node webhook

Which issue(s) this PR fixes:

Fix: #577

Special notes for your reviewer:

Modify the original code, please help to check whether it is consistent with the previous one

@googs1025 googs1025 force-pushed the refector_node_webhook branch from edcc4f3 to 52da9dc Compare May 8, 2024 10:46
Copy link

codecov bot commented May 8, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 6 lines in your changes missing coverage. Please review.

Project coverage is 56.01%. Comparing base (7a1e3f1) to head (3c34e87).
Report is 190 commits behind head on main.

Files with missing lines Patch % Lines
pkg/webhook/mutating/node/allocatable_mutator.go 88.63% 3 Missing and 2 partials ⚠️
pkg/webhook/mutating/node/node.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #578      +/-   ##
==========================================
+ Coverage   55.94%   56.01%   +0.07%     
==========================================
  Files         532      576      +44     
  Lines       49593    66980   +17387     
==========================================
+ Hits        27744    37520    +9776     
- Misses      18316    25468    +7152     
- Partials     3533     3992     +459     
Flag Coverage Δ
unittest 56.01% <86.66%> (+0.07%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@googs1025
Copy link
Contributor Author

@caohe @luomingmeng @WangZzzhe /PTAL thanks!

if err != nil {
klog.Error(err)
} else {
newCapacity = &quantity
klog.V(6).Infof("node %s mem capacity by annotation: %v", node.Name, newCapacity.String())
klog.V(6).Infof("node %s %s capacity by annotation: %v", node.Name, newCapacity.String(), newCapacity.String())
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is newCapacity.String() logged twice?

if err != nil {
klog.Error(err)
} else {
newAllocatable = &quantity
klog.V(6).Infof("node %s mem allocatable by annotation: %v", node.Name, newAllocatable.String())
klog.V(6).Infof("node %s %s allocatable by annotation: %v", node.Name, newCapacity.String(), newAllocatable.String())
Copy link
Collaborator

Choose a reason for hiding this comment

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

The second param was used to log resource type, and the same is true for line 93

@googs1025 googs1025 force-pushed the refector_node_webhook branch from abf090f to 3c34e87 Compare November 2, 2024 12:14
@googs1025
Copy link
Contributor Author

sorry for late. can we go next?

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

Successfully merging this pull request may close these issues.

Refactor some methods of node webhook
2 participants