mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Kubelet:
Centralize Capacity discovery of standard resources in Container manager. Have storage derive node capacity from container manager. Move certain cAdvisor interfaces to the cAdvisor package in the process. This patch fixes a bug in container manager where it was writing to a map without synchronization. Signed-off-by: Vishnu kannan <vishnuk@google.com>
This commit is contained in:
committed by
Michelle Au
parent
cb1f5605a6
commit
82f7820066
@@ -224,6 +224,25 @@ func NewContainerManager(mountUtil mount.Interface, cadvisorInterface cadvisor.I
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
rootfs, err := cadvisorInterface.RootFsInfo()
|
||||
if err != nil {
|
||||
capacity[v1.ResourceStorageScratch] = resource.MustParse("0Gi")
|
||||
} else {
|
||||
for rName, rCap := range cadvisor.StorageScratchCapacityFromFsInfo(rootfs) {
|
||||
capacity[rName] = rCap
|
||||
}
|
||||
}
|
||||
|
||||
if hasDedicatedImageFs, _ := cadvisorInterface.HasDedicatedImageFs(); hasDedicatedImageFs {
|
||||
imagesfs, err := cadvisorInterface.ImagesFsInfo()
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to get Image filesystem information: %v", err)
|
||||
} else {
|
||||
for rName, rCap := range cadvisor.StorageOverlayCapacityFromFsInfo(imagesfs) {
|
||||
capacity[rName] = rCap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cgroupRoot := nodeConfig.CgroupRoot
|
||||
cgroupManager := NewCgroupManager(subsystems, nodeConfig.CgroupDriver)
|
||||
|
||||
Reference in New Issue
Block a user