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

test/e2e/framework/kubelet/:remove the direct dependency to k8s.io/kubernetes/pkg #89641

Merged
merged 1 commit into from Mar 30, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion test/e2e/framework/kubelet/BUILD
Expand Up @@ -12,7 +12,6 @@ go_library(
deps = [
"//pkg/kubelet/apis/config:go_default_library",
"//pkg/kubelet/apis/stats/v1alpha1:go_default_library",
"//pkg/kubelet/dockershim/metrics:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library",
Expand Down
19 changes: 15 additions & 4 deletions test/e2e/framework/kubelet/stats.go
Expand Up @@ -34,14 +34,25 @@ import (
clientset "k8s.io/client-go/kubernetes"
restclient "k8s.io/client-go/rest"
kubeletstatsv1alpha1 "k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1"
dockermetrics "k8s.io/kubernetes/pkg/kubelet/dockershim/metrics"
"k8s.io/kubernetes/test/e2e/framework"
e2emetrics "k8s.io/kubernetes/test/e2e/framework/metrics"
)

const (
// timeout for proxy requests.
proxyTimeout = 2 * time.Minute

// dockerOperationsKey is the key for docker operation metrics.
// copied from k8s.io/kubernetes/pkg/kubelet/dockershim/metrics
dockerOperationsKey = "docker_operations_total"

// dockerOperationsErrorsKey is the key for the operation error metrics.
// copied from k8s.io/kubernetes/pkg/kubelet/dockershim/metrics
dockerOperationsErrorsKey = "docker_operations_errors_total"

// dockerOperationsTimeoutKey is the key for the operation timeout metrics.
// copied from k8s.io/kubernetes/pkg/kubelet/dockershim/metrics
dockerOperationsTimeoutKey = "docker_operations_timeout_total"
)

// ContainerResourceUsage is a structure for gathering container resource usage.
Expand Down Expand Up @@ -190,9 +201,9 @@ func getNodeRuntimeOperationErrorRate(c clientset.Interface, node string) (NodeR
}
// If no corresponding metrics are found, the returned samples will be empty. Then the following
// loop will be skipped automatically.
allOps := ms[dockermetrics.DockerOperationsKey]
errOps := ms[dockermetrics.DockerOperationsErrorsKey]
timeoutOps := ms[dockermetrics.DockerOperationsTimeoutKey]
allOps := ms[dockerOperationsKey]
errOps := ms[dockerOperationsErrorsKey]
timeoutOps := ms[dockerOperationsTimeoutKey]
for _, sample := range allOps {
operation := string(sample.Metric["operation_type"])
result[operation] = &RuntimeOperationErrorRate{TotalNumber: float64(sample.Value)}
Expand Down