mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Scheduler: remove direct import to /pkg/util/parsers
This commit is contained in:
parent
4bdb72ed11
commit
0b715ea690
@ -22,7 +22,6 @@ go_library(
|
||||
"//pkg/kubelet/container:go_default_library",
|
||||
"//pkg/kubelet/events:go_default_library",
|
||||
"//pkg/kubelet/util/sliceutils:go_default_library",
|
||||
"//pkg/util/parsers:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
|
@ -28,7 +28,6 @@ import (
|
||||
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
|
||||
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
"k8s.io/kubernetes/pkg/kubelet/events"
|
||||
"k8s.io/kubernetes/pkg/util/parsers"
|
||||
)
|
||||
|
||||
// imageManager provides the functionalities for image pulling.
|
||||
@ -161,7 +160,7 @@ func applyDefaultImageTag(image string) (string, error) {
|
||||
// image to be fully qualified as docker.io/$name if it's a short name
|
||||
// (e.g. just busybox). We don't want that to happen to keep the CRI
|
||||
// agnostic wrt image names and default hostnames.
|
||||
image = image + ":" + parsers.DefaultImageTag
|
||||
image = image + ":latest"
|
||||
}
|
||||
return image, nil
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ go_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//pkg/scheduler/framework/v1alpha1:go_default_library",
|
||||
"//pkg/util/parsers:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
],
|
||||
@ -20,7 +19,6 @@ go_test(
|
||||
deps = [
|
||||
"//pkg/scheduler/framework/v1alpha1:go_default_library",
|
||||
"//pkg/scheduler/internal/cache:go_default_library",
|
||||
"//pkg/util/parsers: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",
|
||||
],
|
||||
|
@ -24,7 +24,6 @@ import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||
"k8s.io/kubernetes/pkg/util/parsers"
|
||||
)
|
||||
|
||||
// The two thresholds are used as bounds for the image score range. They correspond to a reasonable size range for
|
||||
@ -122,7 +121,7 @@ func scaledImageScore(imageState *framework.ImageStateSummary, totalNumNodes int
|
||||
// in node status; note that if users consistently use one registry format, this should not happen.
|
||||
func normalizedImageName(name string) string {
|
||||
if strings.LastIndex(name, ":") <= strings.LastIndex(name, "/") {
|
||||
name = name + ":" + parsers.DefaultImageTag
|
||||
name = name + ":latest"
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||
"k8s.io/kubernetes/pkg/scheduler/internal/cache"
|
||||
"k8s.io/kubernetes/pkg/util/parsers"
|
||||
)
|
||||
|
||||
func TestImageLocalityPriority(t *testing.T) {
|
||||
@ -69,7 +68,7 @@ func TestImageLocalityPriority(t *testing.T) {
|
||||
Images: []v1.ContainerImage{
|
||||
{
|
||||
Names: []string{
|
||||
"gcr.io/40:" + parsers.DefaultImageTag,
|
||||
"gcr.io/40:latest",
|
||||
"gcr.io/40:v1",
|
||||
"gcr.io/40:v1",
|
||||
},
|
||||
@ -77,14 +76,14 @@ func TestImageLocalityPriority(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Names: []string{
|
||||
"gcr.io/300:" + parsers.DefaultImageTag,
|
||||
"gcr.io/300:latest",
|
||||
"gcr.io/300:v1",
|
||||
},
|
||||
SizeBytes: int64(300 * mb),
|
||||
},
|
||||
{
|
||||
Names: []string{
|
||||
"gcr.io/2000:" + parsers.DefaultImageTag,
|
||||
"gcr.io/2000:latest",
|
||||
},
|
||||
SizeBytes: int64(2000 * mb),
|
||||
},
|
||||
@ -95,13 +94,13 @@ func TestImageLocalityPriority(t *testing.T) {
|
||||
Images: []v1.ContainerImage{
|
||||
{
|
||||
Names: []string{
|
||||
"gcr.io/250:" + parsers.DefaultImageTag,
|
||||
"gcr.io/250:latest",
|
||||
},
|
||||
SizeBytes: int64(250 * mb),
|
||||
},
|
||||
{
|
||||
Names: []string{
|
||||
"gcr.io/10:" + parsers.DefaultImageTag,
|
||||
"gcr.io/10:latest",
|
||||
"gcr.io/10:v1",
|
||||
},
|
||||
SizeBytes: int64(10 * mb),
|
||||
|
@ -26,11 +26,6 @@ import (
|
||||
dockerref "github.com/docker/distribution/reference"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultImageTag is the default tag for docker image.
|
||||
DefaultImageTag = "latest"
|
||||
)
|
||||
|
||||
// ParseImageName parses a docker image string into three parts: repo, tag and digest.
|
||||
// If both tag and digest are empty, a default image tag will be returned.
|
||||
func ParseImageName(image string) (string, string, string, error) {
|
||||
@ -53,7 +48,7 @@ func ParseImageName(image string) (string, string, string, error) {
|
||||
}
|
||||
// If no tag was specified, use the default "latest".
|
||||
if len(tag) == 0 && len(digest) == 0 {
|
||||
tag = DefaultImageTag
|
||||
tag = "latest"
|
||||
}
|
||||
return repoToPull, tag, digest, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user