Skip to content
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

[v0.3] Add ContainerFilesystems to ImageFsInfoResponse #407

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 11 additions & 2 deletions core/imagefs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ func (ds *dockerService) imageFsInfo() (*runtimeapi.ImageFsInfoResponse, error)
InodesUsed: &runtimeapi.UInt64Value{
Value: iNodesUsed,
},
},
},
}},
ContainerFilesystems: []*runtimeapi.FilesystemUsage{
{
Timestamp: time.Now().UnixNano(),
FsId: &runtimeapi.FilesystemIdentifier{
Mountpoint: ds.dockerRootDir,
},
UsedBytes: &runtimeapi.UInt64Value{
Value: ds.containerStatsCache.getWriteableLayer(),
},
}},
}, nil
}
2 changes: 1 addition & 1 deletion core/sandbox_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/stretchr/testify/require"

runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
"k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubelet/pkg/types"

"github.com/Mirantis/cri-dockerd/config"
"github.com/Mirantis/cri-dockerd/libdocker"
Expand Down
11 changes: 11 additions & 0 deletions core/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ func (cs *cstats) getContainerRWSize() uint64 {
return cs.rwLayerSize
}

func (c *containerStatsCache) getWriteableLayer() uint64 {
c.RLock()
defer c.RUnlock()

var totalLayerSize uint64
for _, stat := range c.stats {
totalLayerSize += stat.rwLayerSize
}
return totalLayerSize
}

func (c *containerStatsCache) getStats(containerID string) *cstats {
c.RLock()
defer c.RUnlock()
Expand Down
122 changes: 64 additions & 58 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/Mirantis/cri-dockerd

go 1.21
go 1.22.0

toolchain go1.22.5

require (
github.com/Microsoft/hcsshim v0.11.4
Expand All @@ -26,52 +28,52 @@ require (
golang.org/x/sync v0.6.0
golang.org/x/sys v0.18.0
google.golang.org/grpc v1.62.0
k8s.io/api v0.27.13
k8s.io/apimachinery v0.27.13
k8s.io/apiserver v0.27.8
k8s.io/client-go v0.27.13
k8s.io/component-base v0.27.13
k8s.io/component-helpers v0.27.8
k8s.io/cri-api v0.27.8
k8s.io/cri-api/v1alpha2 v0.25.8
k8s.io/kubernetes v1.27.13
k8s.io/utils v0.0.0-20230209194617-a36077c30491
k8s.io/api v0.29.10
k8s.io/apimachinery v0.29.10
k8s.io/apiserver v0.29.10
k8s.io/client-go v0.29.10
k8s.io/component-base v0.29.10
k8s.io/component-helpers v0.29.10
k8s.io/cri-api v0.29.10
k8s.io/cri-api/v1alpha2 v0.29.10
k8s.io/kubelet v0.0.0
k8s.io/kubernetes v1.29.10
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/containerd v1.6.26 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/cadvisor v0.47.2 // indirect
github.com/google/cel-go v0.12.7 // indirect
github.com/google/gnostic v0.7.0 // indirect
github.com/google/cadvisor v0.48.1 // indirect
github.com/google/cel-go v0.17.7 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
Expand All @@ -84,30 +86,31 @@ require (
github.com/jonboulle/clockwork v0.3.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/lithammer/dedent v1.1.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78 // indirect
github.com/opencontainers/selinux v1.10.1 // indirect
github.com/opencontainers/selinux v1.11.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/vishvananda/netns v0.0.2 // indirect
github.com/vishvananda/netns v0.0.4 // indirect
github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510 // indirect
go.etcd.io/etcd/api/v3 v3.5.7 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
go.etcd.io/etcd/client/v3 v3.5.7 // indirect
go.etcd.io/etcd/api/v3 v3.5.10 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect
go.etcd.io/etcd/client/v3 v3.5.10 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 // indirect
Expand All @@ -119,9 +122,10 @@ require (
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
Expand All @@ -137,41 +141,43 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.29.10 // indirect
k8s.io/cloud-provider v0.27.8 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/mount-utils v0.27.8 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace (
google.golang.org/grpc/naming => google.golang.org/grpc v1.29.0
k8s.io/api => k8s.io/api v0.27.8
k8s.io/apimachinery => k8s.io/apimachinery v0.27.8
k8s.io/apiserver => k8s.io/apiserver v0.27.13
k8s.io/cli-runtime => k8s.io/cli-runtime v0.27.8
k8s.io/client-go => k8s.io/client-go v0.27.8
k8s.io/cloud-provider => k8s.io/cloud-provider v0.27.8
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.27.8
k8s.io/code-generator => k8s.io/code-generator v0.27.8
k8s.io/component-base => k8s.io/component-base v0.27.8
k8s.io/component-helpers => k8s.io/component-helpers v0.26.0
k8s.io/controller-manager => k8s.io/controller-manager v0.27.8
k8s.io/cri-api => k8s.io/cri-api v0.27.8
k8s.io/api => k8s.io/api v0.29.10
k8s.io/apimachinery => k8s.io/apimachinery v0.29.10
k8s.io/apiserver => k8s.io/apiserver v0.29.10
k8s.io/cli-runtime => k8s.io/cli-runtime v0.29.10
k8s.io/client-go => k8s.io/client-go v0.29.10
k8s.io/cloud-provider => k8s.io/cloud-provider v0.29.10
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.29.10
k8s.io/code-generator => k8s.io/code-generator v0.29.10
k8s.io/component-base => k8s.io/component-base v0.29.10
k8s.io/component-helpers => k8s.io/component-helpers v0.29.10
k8s.io/controller-manager => k8s.io/controller-manager v0.29.10
k8s.io/cri-api => k8s.io/cri-api v0.30.1
k8s.io/cri-api/v1alpha2 => k8s.io/cri-api v0.25.16
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.27.8
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.27.8
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.27.8
k8s.io/kube-proxy => k8s.io/kube-proxy v0.27.8
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.27.8
k8s.io/kubectl => k8s.io/kubectl v0.27.8
k8s.io/kubelet => k8s.io/kubelet v0.27.8
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.27.8
k8s.io/metrics => k8s.io/metrics v0.27.8
k8s.io/mount-utils => k8s.io/mount-utils v0.27.8
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.27.8
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.27.8
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.29.10
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.29.10
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.29.10
k8s.io/kube-proxy => k8s.io/kube-proxy v0.29.10
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.29.10
k8s.io/kubectl => k8s.io/kubectl v0.29.10
k8s.io/kubelet => k8s.io/kubelet v0.29.10
k8s.io/kubernetes => k8s.io/kubernetes v1.29.10
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.29.10
k8s.io/metrics => k8s.io/metrics v0.29.10
k8s.io/mount-utils => k8s.io/mount-utils v0.29.10
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.29.10
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.29.10
)
Loading
Loading