mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Set FsId and usedBytes for windows image file system
This commit is contained in:
parent
cac0263c12
commit
b1361037ff
@ -127,6 +127,7 @@ go_library(
|
||||
] + select({
|
||||
"@io_bazel_rules_go//go/platform:windows": [
|
||||
"//pkg/features:go_default_library",
|
||||
"//pkg/kubelet/winstats:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
|
@ -21,19 +21,36 @@ package dockershim
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||
"k8s.io/kubernetes/pkg/kubelet/winstats"
|
||||
)
|
||||
|
||||
// ImageFsInfo returns information of the filesystem that is used to store images.
|
||||
func (ds *dockerService) ImageFsInfo(_ context.Context, _ *runtimeapi.ImageFsInfoRequest) (*runtimeapi.ImageFsInfoResponse, error) {
|
||||
// For Windows Stats to work correctly, a file system must be provided. For now, provide a fake filesystem.
|
||||
info, err := ds.client.Info()
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to get docker info: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
statsClient := &winstats.StatsClient{}
|
||||
fsinfo, err := statsClient.GetDirFsInfo(info.DockerRootDir)
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to get dir fsInfo for %q: %v", info.DockerRootDir, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
filesystems := []*runtimeapi.FilesystemUsage{
|
||||
{
|
||||
Timestamp: time.Now().UnixNano(),
|
||||
UsedBytes: &runtimeapi.UInt64Value{Value: 0},
|
||||
UsedBytes: &runtimeapi.UInt64Value{Value: fsinfo.Usage},
|
||||
InodesUsed: &runtimeapi.UInt64Value{Value: 0},
|
||||
FsId: &runtimeapi.FilesystemIdentifier{
|
||||
Mountpoint: info.DockerRootDir,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user