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

Copy link

codecov bot commented May 8, 2024

Codecov Report

Attention: Patch coverage is 88.63636% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 55.91%. Comparing base (7a1e3f1) to head (abf090f).
Report is 12 commits behind head on main.

Files Patch % Lines
pkg/webhook/mutating/node/allocatable_mutator.go 90.69% 2 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%   55.91%   -0.04%     
==========================================
  Files         532      533       +1     
  Lines       49593    49691      +98     
==========================================
+ Hits        27744    27783      +39     
- Misses      18316    18363      +47     
- Partials     3533     3545      +12     
Flag Coverage Δ
unittest 55.91% <88.63%> (-0.04%) ⬇️

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

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