Skip to content

Commit

Permalink
Make nested /volume/ repo images overridable
Browse files Browse the repository at this point in the history
The multi-arch container images used in tests live in quay.io which
doesn't support nesting. By making the /volume/ images repo configurable,
we are able to override them despite our current limitation.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
  • Loading branch information
r4f4 committed Jul 17, 2020
1 parent acea382 commit 57657de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/utils/image/manifest.go
Expand Up @@ -31,6 +31,7 @@ type RegistryList struct {
DockerLibraryRegistry string `yaml:"dockerLibraryRegistry"`
DockerGluster string `yaml:"dockerGluster"`
E2eRegistry string `yaml:"e2eRegistry"`
E2eVolumeRegistry string `yaml:"e2eVolumeRegistry"`
InvalidRegistry string `yaml:"invalidRegistry"`
GcRegistry string `yaml:"gcRegistry"`
GcrReleaseRegistry string `yaml:"gcrReleaseRegistry"`
Expand Down Expand Up @@ -69,6 +70,7 @@ func initReg() RegistryList {
DockerLibraryRegistry: "docker.io/library",
DockerGluster: "docker.io/gluster",
E2eRegistry: "gcr.io/kubernetes-e2e-test-images",
E2eVolumeRegistry: "gcr.io/kubernetes-e2e-test-images/volume",
InvalidRegistry: "invalid.com/invalid",
GcRegistry: "k8s.gcr.io",
GcrReleaseRegistry: "gcr.io/gke-release",
Expand Down Expand Up @@ -100,6 +102,7 @@ var (
dockerLibraryRegistry = registry.DockerLibraryRegistry
dockerGluster = registry.DockerGluster
e2eRegistry = registry.E2eRegistry
e2eVolumeRegistry = registry.E2eVolumeRegistry
gcAuthenticatedRegistry = registry.GcAuthenticatedRegistry
gcRegistry = registry.GcRegistry
gcrReleaseRegistry = registry.GcrReleaseRegistry
Expand Down Expand Up @@ -247,10 +250,10 @@ func initImageConfigs() map[int]Config {
configs[SdDummyExporter] = Config{gcRegistry, "sd-dummy-exporter", "v0.2.0"}
configs[StartupScript] = Config{googleContainerRegistry, "startup-script", "v1"}
configs[TestWebserver] = Config{e2eRegistry, "test-webserver", "1.0"}
configs[VolumeNFSServer] = Config{e2eRegistry, "volume/nfs", "1.0"}
configs[VolumeISCSIServer] = Config{e2eRegistry, "volume/iscsi", "2.0"}
configs[VolumeGlusterServer] = Config{e2eRegistry, "volume/gluster", "1.0"}
configs[VolumeRBDServer] = Config{e2eRegistry, "volume/rbd", "1.0.1"}
configs[VolumeNFSServer] = Config{e2eVolumeRegistry, "nfs", "1.0"}
configs[VolumeISCSIServer] = Config{e2eVolumeRegistry, "iscsi", "2.0"}
configs[VolumeGlusterServer] = Config{e2eVolumeRegistry, "gluster", "1.0"}
configs[VolumeRBDServer] = Config{e2eVolumeRegistry, "rbd", "1.0.1"}
return configs
}

Expand Down Expand Up @@ -288,6 +291,8 @@ func ReplaceRegistryInImageURL(imageURL string) (string, error) {
switch registryAndUser {
case "gcr.io/kubernetes-e2e-test-images":
registryAndUser = e2eRegistry
case "gcr.io/kubernetes-e2e-test-images/volume":
registryAndUser = e2eVolumeRegistry
case "k8s.gcr.io":
registryAndUser = gcRegistry
case "gcr.io/k8s-authenticated-test":
Expand Down
8 changes: 8 additions & 0 deletions test/utils/image/manifest_test.go
Expand Up @@ -58,6 +58,13 @@ var registryTests = []struct {
err: nil,
},
},
{
"gcr.io/kubernetes-e2e-test-images/volume/test:123",
result{
result: "test.io/kubernetes-e2e-test-images/volume/test:123",
err: nil,
},
},
{
"k8s.gcr.io/test:123",
result{
Expand Down Expand Up @@ -107,6 +114,7 @@ func TestReplaceRegistryInImageURL(t *testing.T) {
// Set custom registries
dockerLibraryRegistry = "test.io/library"
e2eRegistry = "test.io/kubernetes-e2e-test-images"
e2eVolumeRegistry = "test.io/kubernetes-e2e-test-images/volume"
gcRegistry = "test.io"
gcrReleaseRegistry = "test.io/gke-release"
PrivateRegistry = "test.io/k8s-authenticated-test"
Expand Down

0 comments on commit 57657de

Please sign in to comment.