-
Notifications
You must be signed in to change notification settings - Fork 312
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
koordlet: cgroup file read and write is privatized and consolidated into the resource executor package. #1024
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1024 +/- ##
==========================================
+ Coverage 67.41% 67.44% +0.03%
==========================================
Files 260 260
Lines 28752 28662 -90
==========================================
- Hits 19382 19330 -52
+ Misses 8018 7982 -36
+ Partials 1352 1350 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
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. |
b81ddb0
to
072e99f
Compare
// parsePSIStats parses the specified file for pressure stall information. | ||
func parsePSIStats(r io.Reader) (PSIStats, error) { |
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.
other files and struct can also be moved into resourceexecutor
pkg/koordlet/util/system/cgroup.go
Outdated
} | ||
return CgroupFileWrite(cgroupTaskDir, r, value) | ||
} | ||
|
||
func IsCgroupPathExist(parentDir string, r Resource) (bool, string) { |
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.
mv to resourceexecutor
@@ -193,16 +193,6 @@ func GetContainerCurMemLimitBytes(podParentDir string, c *corev1.ContainerStatus | |||
return strconv.ParseInt(strings.TrimSpace(string(rawContent)), 10, 64) | |||
} | |||
|
|||
// GetContainerCurTasks gets the TIDs of the given container's cgroup. | |||
// DEPRECATED: use resourceexecutor.CgroupReader instead. |
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.
check other deprecated func
@@ -191,8 +191,10 @@ func (c *ContainerContext) injectForOrigin() { | |||
klog.V(5).Infof("set container %v/%v/%v cpuset %v on cgroup parent %v", | |||
c.Request.PodMeta.Namespace, c.Request.PodMeta.Name, c.Request.ContainerMeta.Name, | |||
*c.Response.Resources.CPUSet, c.Request.CgroupParent) | |||
audit.V(2).Container(c.Request.ContainerMeta.ID).Reason("runtime-hooks").Message( | |||
"set container cpuset to %v", *c.Response.Resources.CPUSet).Do() | |||
if updated { |
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.
independent pr
d2e9566
to
d15b39b
Compare
if err != nil { | ||
klog.Infof("bvtupdater creat failed, dir %v, error %v", kubeQOSCgroupPath, err) | ||
} | ||
if err := bvtUpdater.Update(); err != nil { |
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.
set Update as private, use executor here
/hold cancel |
@@ -101,7 +104,8 @@ func injectMemoryLimit(cgroupParent string, memoryLimit int64) error { | |||
if err != nil { | |||
return err | |||
} | |||
return updater.Update() | |||
_, err = resourceexecutor.NewResourceUpdateExecutor().Update(false, updater) |
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.
pass resourceexecutor into server
@@ -101,7 +104,8 @@ func injectMemoryLimit(cgroupParent string, memoryLimit int64) error { | |||
if err != nil { | |||
return err | |||
} | |||
return updater.Update() | |||
_, err = resourceexecutor.NewResourceUpdateExecutor().Update(false, updater) |
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.
pass resourceexecutor into server
Signed-off-by: Re-Grh <1271013391@qq.com>
@@ -204,12 +205,18 @@ type Reconciler interface { | |||
Run(stopCh <-chan struct{}) error | |||
} | |||
|
|||
func NewReconciler(s statesinformer.StatesInformer) Reconciler { | |||
type Options struct { | |||
S statesinformer.StatesInformer |
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.
StatesInformer
cpuShareStr := strconv.FormatInt(cpuShares, 10) | ||
updater, err := resourceexecutor.DefaultCgroupUpdaterFactory.New(sysutil.CPUSharesName, cgroupParent, cpuShareStr) | ||
if err != nil { | ||
return err | ||
} | ||
_, err = resourceexecutor.NewResourceUpdateExecutor().Update(false, updater) | ||
_, err = e.Update(false, updater) |
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.
true
Signed-off-by: Re-Grh <1271013391@qq.com>
Signed-off-by: Re-Grh <1271013391@qq.com>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zwzhang0107 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 |
Ⅰ. Describe what this PR does
Ⅱ. Does this pull request fix one issue?
fix #1017
Ⅲ. Describe how to verify it
Ⅳ. Special notes for reviews
V. Checklist
make test