CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 80
fixes: fix resource adjustment to properly ignore unset/unadjusted fields. #28
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
Conversation
When adjusting CPU or memory resources, check for each field whether it is set (IOW adjusted by a plugin) before updating. The field getters return the corresponding golang zero value for unset fields. Therefore unconditionally adjusting unset Spec fields resets the fields instead. This manifests itself by all container CPU resources getting cleared when NRI is enabled but no plugins are running or none of the running plugins are adjust resources. Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
0a80942
to
b21fd1d
Compare
Codecov ReportBase: 69.75% // Head: 63.33% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #28 +/- ##
==========================================
- Coverage 69.75% 63.33% -6.43%
==========================================
Files 7 9 +2
Lines 1531 1781 +250
==========================================
+ Hits 1068 1128 +60
- Misses 333 502 +169
- Partials 130 151 +21
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
b21fd1d
to
85fdf6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
return spec | ||
} | ||
|
||
func Int64(v int64) *int64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use generic here, like
func ToPtr[T any](v T) *T {
return &v
}
Just share a idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ! Good point and I'll include that change in a subsequent PR when adding more test cases to the suite.
@fuweid Could we tag the current HEAD as v0.3.0 ? Then I could update cobtsinerd #8140 to point at it. I might have one more fix that we could try to sqeeze in, but it should not break backward compatibility, so I think that wouldn't require a tag (and we could always tag it as v0.3.1 if we prefer releases to be tag-aligned). |
When adjusting CPU or memory resources, check for each field whether it is set (IOW adjusted by a plugin) before updating. The field getters return the corresponding golang zero value for unset fields. Therefore unconditionally adjusting unset Spec fields resets the fields instead. This manifests itself by all container CPU resources getting cleared when NRI is enabled but no plugins are running or none of the running plugins are adjust resources.