mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #67061 from Random-Liu/fix-docker-registry
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix docker registry used in e2e test. See https://github.com/kubernetes/kubernetes/pull/66055#issuecomment-410947650. Fix docker registry used in e2e test, so that it works with all container runtimes. **Release note**: ```release-note none ``` /cc @kubernetes/sig-node-pr-reviews @kubernetes/sig-testing-pr-reviews
This commit is contained in:
commit
8a47559203
@ -216,11 +216,12 @@ func WaitForReplicationControllerwithSelector(c clientset.Interface, namespace s
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// trimDockerIO is the function for trimming the docker.io from the beginning of the imagename.
|
// trimDockerRegistry is the function for trimming the docker.io/library from the beginning of the imagename.
|
||||||
// If community docker installed it will not prefix the registry names with the dockerimages vs registry names prefixed with other runtimes or docker installed via RHEL extra repo.
|
// If community docker installed it will not prefix the registry names with the dockerimages vs registry names prefixed with other runtimes or docker installed via RHEL extra repo.
|
||||||
// So this function will help to trim the docker.io if exists
|
// So this function will help to trim the docker.io/library if exists
|
||||||
func trimDockerIO(imagename string) string {
|
func trimDockerRegistry(imagename string) string {
|
||||||
return strings.Replace(imagename, "docker.io/", "", 1)
|
imagename = strings.Replace(imagename, "docker.io/", "", 1)
|
||||||
|
return strings.Replace(imagename, "library/", "", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validatorFn is the function which is individual tests will implement.
|
// validatorFn is the function which is individual tests will implement.
|
||||||
@ -234,7 +235,7 @@ type validatorFn func(c clientset.Interface, podID string) error
|
|||||||
// "testname": which gets bubbled up to the logging/failure messages if errors happen.
|
// "testname": which gets bubbled up to the logging/failure messages if errors happen.
|
||||||
// "validator" function: This function is given a podID and a client, and it can do some specific validations that way.
|
// "validator" function: This function is given a podID and a client, and it can do some specific validations that way.
|
||||||
func ValidateController(c clientset.Interface, containerImage string, replicas int, containername string, testname string, validator validatorFn, ns string) {
|
func ValidateController(c clientset.Interface, containerImage string, replicas int, containername string, testname string, validator validatorFn, ns string) {
|
||||||
containerImage = trimDockerIO(containerImage)
|
containerImage = trimDockerRegistry(containerImage)
|
||||||
getPodsTemplate := "--template={{range.items}}{{.metadata.name}} {{end}}"
|
getPodsTemplate := "--template={{range.items}}{{.metadata.name}} {{end}}"
|
||||||
// NB: kubectl adds the "exists" function to the standard template functions.
|
// NB: kubectl adds the "exists" function to the standard template functions.
|
||||||
// This lets us check to see if the "running" entry exists for each of the containers
|
// This lets us check to see if the "running" entry exists for each of the containers
|
||||||
@ -266,7 +267,7 @@ waitLoop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentImage := RunKubectlOrDie("get", "pods", podID, "-o", "template", getImageTemplate, fmt.Sprintf("--namespace=%v", ns))
|
currentImage := RunKubectlOrDie("get", "pods", podID, "-o", "template", getImageTemplate, fmt.Sprintf("--namespace=%v", ns))
|
||||||
currentImage = trimDockerIO(currentImage)
|
currentImage = trimDockerRegistry(currentImage)
|
||||||
if currentImage != containerImage {
|
if currentImage != containerImage {
|
||||||
Logf("%s is created but running wrong image; expected: %s, actual: %s", podID, containerImage, currentImage)
|
Logf("%s is created but running wrong image; expected: %s, actual: %s", podID, containerImage, currentImage)
|
||||||
continue waitLoop
|
continue waitLoop
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
dockerHubRegistry = "docker.io"
|
dockerLibraryRegistry = "docker.io/library"
|
||||||
e2eRegistry = "gcr.io/kubernetes-e2e-test-images"
|
e2eRegistry = "gcr.io/kubernetes-e2e-test-images"
|
||||||
gcRegistry = "k8s.gcr.io"
|
gcRegistry = "k8s.gcr.io"
|
||||||
PrivateRegistry = "gcr.io/k8s-authenticated-test"
|
PrivateRegistry = "gcr.io/k8s-authenticated-test"
|
||||||
@ -52,7 +52,7 @@ var (
|
|||||||
AdmissionWebhook = ImageConfig{e2eRegistry, "webhook", "1.12v2", false}
|
AdmissionWebhook = ImageConfig{e2eRegistry, "webhook", "1.12v2", false}
|
||||||
APIServer = ImageConfig{e2eRegistry, "sample-apiserver", "1.0", false}
|
APIServer = ImageConfig{e2eRegistry, "sample-apiserver", "1.0", false}
|
||||||
AppArmorLoader = ImageConfig{e2eRegistry, "apparmor-loader", "1.0", false}
|
AppArmorLoader = ImageConfig{e2eRegistry, "apparmor-loader", "1.0", false}
|
||||||
BusyBox = ImageConfig{dockerHubRegistry, "busybox", "1.29", false}
|
BusyBox = ImageConfig{dockerLibraryRegistry, "busybox", "1.29", false}
|
||||||
CheckMetadataConcealment = ImageConfig{gcRegistry, "check-metadata-concealment", "v0.0.3", false}
|
CheckMetadataConcealment = ImageConfig{gcRegistry, "check-metadata-concealment", "v0.0.3", false}
|
||||||
CudaVectorAdd = ImageConfig{e2eRegistry, "cuda-vector-add", "1.0", false}
|
CudaVectorAdd = ImageConfig{e2eRegistry, "cuda-vector-add", "1.0", false}
|
||||||
Dnsutils = ImageConfig{e2eRegistry, "dnsutils", "1.1", false}
|
Dnsutils = ImageConfig{e2eRegistry, "dnsutils", "1.1", false}
|
||||||
@ -74,8 +74,8 @@ var (
|
|||||||
Net = ImageConfig{e2eRegistry, "net", "1.0", false}
|
Net = ImageConfig{e2eRegistry, "net", "1.0", false}
|
||||||
Netexec = ImageConfig{e2eRegistry, "netexec", "1.0", false}
|
Netexec = ImageConfig{e2eRegistry, "netexec", "1.0", false}
|
||||||
Nettest = ImageConfig{e2eRegistry, "nettest", "1.0", false}
|
Nettest = ImageConfig{e2eRegistry, "nettest", "1.0", false}
|
||||||
Nginx = ImageConfig{dockerHubRegistry, "nginx", "1.14-alpine", false}
|
Nginx = ImageConfig{dockerLibraryRegistry, "nginx", "1.14-alpine", false}
|
||||||
NginxNew = ImageConfig{dockerHubRegistry, "nginx", "1.15-alpine", false}
|
NginxNew = ImageConfig{dockerLibraryRegistry, "nginx", "1.15-alpine", false}
|
||||||
Nonewprivs = ImageConfig{e2eRegistry, "nonewprivs", "1.0", false}
|
Nonewprivs = ImageConfig{e2eRegistry, "nonewprivs", "1.0", false}
|
||||||
NoSnatTest = ImageConfig{e2eRegistry, "no-snat-test", "1.0", false}
|
NoSnatTest = ImageConfig{e2eRegistry, "no-snat-test", "1.0", false}
|
||||||
NoSnatTestProxy = ImageConfig{e2eRegistry, "no-snat-test-proxy", "1.0", false}
|
NoSnatTestProxy = ImageConfig{e2eRegistry, "no-snat-test-proxy", "1.0", false}
|
||||||
|
Loading…
Reference in New Issue
Block a user