clean up unused var containerCache

This commit is contained in:
RyderXia 2020-07-21 16:57:36 +08:00
parent adabcc31f0
commit 2214117cd1
2 changed files with 2 additions and 5 deletions

View File

@ -29,7 +29,6 @@ import (
utilfeature "k8s.io/apiserver/pkg/util/feature" utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/klog/v2" "k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/features"
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
) )
// This const block defines the metric names for the kubelet metrics. // This const block defines the metric names for the kubelet metrics.
@ -369,7 +368,7 @@ var (
var registerMetrics sync.Once var registerMetrics sync.Once
// Register registers all metrics. // Register registers all metrics.
func Register(containerCache kubecontainer.RuntimeCache, collectors ...metrics.StableCollector) { func Register(collectors ...metrics.StableCollector) {
// Register the metrics. // Register the metrics.
registerMetrics.Do(func() { registerMetrics.Do(func() {
legacyregistry.MustRegister(NodeName) legacyregistry.MustRegister(NodeName)

View File

@ -650,9 +650,7 @@ func TestRelistIPChange(t *testing.T) {
} }
func TestRunningPodAndContainerCount(t *testing.T) { func TestRunningPodAndContainerCount(t *testing.T) {
fakeRuntime := &containertest.FakeRuntime{} metrics.Register()
runtimeCache, _ := kubecontainer.NewRuntimeCache(fakeRuntime)
metrics.Register(runtimeCache)
testPleg := newTestGenericPLEG() testPleg := newTestGenericPLEG()
pleg, runtime := testPleg.pleg, testPleg.runtime pleg, runtime := testPleg.pleg, testPleg.runtime