-
Notifications
You must be signed in to change notification settings - Fork 343
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: support block I/O QoS #1144
koordlet: support block I/O QoS #1144
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1144 +/- ##
==========================================
- Coverage 66.10% 65.02% -1.09%
==========================================
Files 303 311 +8
Lines 31593 32719 +1126
==========================================
+ Hits 20885 21274 +389
- Misses 9179 9884 +705
- Partials 1529 1561 +32
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 12 files with indirect coverage changes 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 in Codecov by Sentry. |
5d2fe53
to
7ba6beb
Compare
resmanager *resmanager | ||
executor resourceexecutor.ResourceUpdateExecutor | ||
blkioScanner util.LocalStorageScanner | ||
pvcInformer cache.SharedIndexInformer |
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 remember we have a TODO here about "getting pod volume from local"
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.
can we solve the problem now or leave a todo here
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 have extended the interface of the states informer by adding the GetVolumeName
function, which allows users to retrieve the relevant storage volume name through the PVC name.
strategy := nodeSLO.Spec.ResourceQOSStrategy | ||
// lsr | ||
if strategy.LSRClass != nil && strategy.LSRClass.BlkIOQOS != nil && *strategy.LSRClass.BlkIOQOS.Enable && len(strategy.LSRClass.BlkIOQOS.Blocks) != 0 { | ||
klog.Warningf("%s: configuring blkio of LSRClass is not supported!", BlkIOReconcileName) |
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.
consider create an warning event to NodeSLO or Pod for bad format config
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.
create warning event in reconcile may cause too many events?
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.
we can add a flow control, like create event at least 10 minutes or more
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 should add more information to the "NodeSLO" status field, such as warnings and error messages to provide better visibility into the status of the node.
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.
yes, this is also an option. we can compare before update to avoid too many requests, and warning events can also be used for alarm
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.
Currently, there is no definition for the status of NodeSLO. Shall we create a to-do for it?
7ba6beb
to
36193e4
Compare
} | ||
|
||
// resourceType sysutil.ResourceType, parentDir string, value string, updateFunc UpdateFunc | ||
func NewBlkIOResourceUpdater(file sysutil.Resource, value string, parentDir string) *CgroupResourceUpdater { |
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.
Could we register the cgroup updater of the blkio resource in DefaultCgroupUpdaterFactory to support cgroups-v2 and maintain the blkio updater uniformly? Afterward, the callers can use the blkio updater via DefaultCgroupUpdaterFactory.New(resourceType, cgroupParent, value, auditor)
.
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.
done
pkg/koordlet/util/blkio_scanner.go
Outdated
} | ||
) | ||
|
||
func NewLocalStorageScanner(interval time.Duration) LocalStorageScanner { |
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.
could you move the scanner as a plugin of the metric advisor(collector) since it starts a goroutine to collect the node disk info periodically? or we may leave a TODO here?
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.
done
// GetPodCgroupDirWithKube gets the full pod cgroup parent dir with the podParentDir (excluding kubepods dir). | ||
// @podKubeRelativeDir kubepods-burstable.slice/kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/ | ||
// @return kubepods.slice/kubepods-burstable.slice/kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/ | ||
func GetPodCgroupDirWithKube(podParentDir string) 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.
Please do not use GetPodCgroupDirWithKube
anymore, as it is just removed recently. Instead, use the podMeta.podParentDir
directly. See #1129.
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.
done
3efd6be
to
6bf6915
Compare
pkg/koordlet/metriccache/api.go
Outdated
type NodeLocalStorageInfo struct { | ||
util.LocalStorageInfo | ||
// map is not thread safe. so "concurrent read/write of Map" can cause error. | ||
RWLock sync.RWMutex |
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.
is it no longer in use?
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.
It is used in BlkIOReconcile module (pkg/koordlet/resmanager/blkio_reconcile.go) for getting storage info.
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.
perhaps the mutex lock is unnecessary
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.
done
klog.Errorf("insert node local storage info error: %v", err) | ||
} | ||
|
||
n.started.Store(true) |
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.
Some other modules rely on the status started
of the CPU Info while sharing the status in collectNodeLocalStorageInfo
may corrupt the condition.
e.g. The nodeTopologyInformer requires the CPU Info synced, so it can report the correct CPU topology.
How about moving the collection of the local storage into a new plugin?
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.
Maybe we can rename NodeInfoCollector
plugin to NodeCPUInfoCollector
plugin, and add a new plugin named NodeStorageInfoCollector
?
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.
Or just remove n.started.Store(true)
?
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.
Yes, I prefer option one.
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.
done
// deviceName: /dev/sdb | ||
// diskNumber: 253:16 | ||
func (b *BlkIOReconcile) getDiskNumberFromDevice(deviceName string) (string, error) { | ||
storageInfo, err := b.resmanager.metricCache.GetNodeLocalStorageInfo(&metriccache.QueryParam{}) |
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.
perhaps we only need to invoke GetNodeLocalStorageInfo
once in a reconcile
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.
done
pkg/koordlet/util/node.go
Outdated
// GetCgroupRootBlkIOAbsoluteDir gets the root blkio directory | ||
// @output /sys/fs/cgroup/blkio | ||
func GetCgroupRootBlkIOAbsoluteDir() string { | ||
return path.Join(system.Conf.CgroupRootDir, system.CgroupBlkioDir) |
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.
please use filepath.Join
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.
done
a38f0ff
to
e1bb381
Compare
// @return like kubepods-burstable.slice/kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/ | ||
// /sys/fs/cgroup/blkio/kubepods.slice/kubepods-burstable.slice/kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice | ||
func GetPodCgroupBlkIOAbsolutePath(podParentDir string) string { | ||
return path.Join(system.Conf.CgroupRootDir, system.CgroupBlkioDir, podParentDir) |
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.
A minor issue: Please use filepath.Join
and check the other modifications where the path
pkg is still adopted.
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.
There are many other people's codes that also use the path.Join function, do I need to change them all at once?
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.
Not required in this patch. Feel free to do the cleanup in another PR.
a530b0f
to
63ab8ea
Compare
consider using mount info to get the pvc path |
76a07b7
to
4b480ff
Compare
46ff289
to
2264019
Compare
Signed-off-by: 惠志 <[email protected]>
2264019
to
930b61d
Compare
/lgtm |
/approve |
/assign @FillZpp @jasonliu747 |
/approve |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FillZpp, jasonliu747, 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 |
s.volumeNameMap[util.GetNamespacedName(pvc.Namespace, pvc.Name)] = pvc.Spec.VolumeName | ||
} | ||
|
||
func newPVCInformer(client clientset.Interface) cache.SharedIndexInformer { |
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.
the pvc informer should be restrict on the node, otherwise it may be raise the memory used and the kube-apiserver pressure.
Ⅰ. Describe what this PR does
Ⅱ. Does this pull request fix one issue?
fixes #1003
Ⅲ. Describe how to verify it
Ⅳ. Special notes for reviews
V. Checklist
make test