Skip to content

Commit

Permalink
Replace use of docker.io with public.ecr.aws to avoid docker hub …
Browse files Browse the repository at this point in the history
…pull rate limit errors (#228)

* Replace use of `docker.io` with `public.ecr.aws` to avoid docker hub pull rate limit errors

* Address PR review feedback
  • Loading branch information
dimitar-kostadinov authored Jul 26, 2024
1 parent c924400 commit 28ea7dd
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
16 changes: 8 additions & 8 deletions test/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ import (
)

const (
// DockerNginx1230Image is the docker.io nginx:1.23.0 image.
DockerNginx1230Image = "docker.io/library/nginx:1.23.0"
// DockerNginx1240Image is the docker.io nginx:1.24.0 image.
DockerNginx1240Image = "docker.io/library/nginx:1.24.0"
// DockerNginx1250Image is the docker.io nginx:1.25.0 image.
DockerNginx1250Image = "docker.io/library/nginx:1.25.0"
// PublicEcrAwsNginx1230Image is the public.ecr.aws/nginx/nginx:1.23.0 image.
PublicEcrAwsNginx1230Image = "public.ecr.aws/nginx/nginx:1.23.0"
// PublicEcrAwsNginx1240Image is the public.ecr.aws/nginx/nginx:1.24.0 image.
PublicEcrAwsNginx1240Image = "public.ecr.aws/nginx/nginx:1.24.0"
// PublicEcrAwsNginx1250Image is the public.ecr.aws/nginx/nginx:1.25.0 image.
PublicEcrAwsNginx1250Image = "public.ecr.aws/nginx/nginx:1.25.0"

// ArtifactRegistryNginx1176Image is the europe-docker.pkg.dev/gardener-project/releases/3rd/nginx:1.17.6 image (copy of docker.io/library/nginx:1.17.6).
ArtifactRegistryNginx1176Image = "europe-docker.pkg.dev/gardener-project/releases/3rd/nginx:1.17.6"
// RegistryK8sNginx1154Image is the registry.k8s.io/e2e-test-images/nginx:1.15-4 image.
RegistryK8sNginx1154Image = "registry.k8s.io/e2e-test-images/nginx:1.15-4"
// PublicEcrAwsNginx1199Image is the public.ecr.aws/nginx/nginx:1.19.9 image.
PublicEcrAwsNginx1199Image = "public.ecr.aws/nginx/nginx:1.19.9"
// GithubRegistryNginx1261Image is the ghcr.io/linuxserver/nginx:1.26.1 image.
GithubRegistryNginx1261Image = "ghcr.io/linuxserver/nginx:1.26.1"

// jqExtractRegistryLocation is a jq command that extracts the source location of the '/var/lib/registry' mount from the container's config.json file.
jqExtractRegistryLocation = `jq -j '.mounts[] | select(.destination=="/var/lib/registry") | .source' /run/containerd/io.containerd.runtime.v2.task/k8s.io/%s/config.json`
Expand Down
26 changes: 13 additions & 13 deletions test/e2e/cache/create_enable_add_remove_disable_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var _ = Describe("Registry Cache Extension Tests", Label("cache"), func() {
Expect(f.UpdateShoot(ctx, f.Shoot, func(shoot *gardencorev1beta1.Shoot) error {
size := resource.MustParse("2Gi")
common.AddOrUpdateRegistryCacheExtension(shoot, []v1alpha3.RegistryCache{
{Upstream: "docker.io", Volume: &v1alpha3.Volume{Size: &size}},
{Upstream: "public.ecr.aws", Volume: &v1alpha3.Volume{Size: &size}},
})

return nil
Expand All @@ -48,17 +48,17 @@ var _ = Describe("Registry Cache Extension Tests", Label("cache"), func() {
defer cancel()
common.WaitUntilRegistryCacheConfigurationsAreApplied(ctx, f.Logger, f.ShootFramework.ShootClient)

By("[docker.io] Verify registry-cache works")
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootFramework.ShootClient, common.DockerNginx1230Image)
By("[public.ecr.aws] Verify registry-cache works")
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootFramework.ShootClient, common.PublicEcrAwsNginx1230Image)

By("Add the public.ecr.aws upstream to the registry-cache extension")
By("Add the ghcr.io upstream to the registry-cache extension")
ctx, cancel = context.WithTimeout(parentCtx, 10*time.Minute)
defer cancel()
Expect(f.UpdateShoot(ctx, f.Shoot, func(shoot *gardencorev1beta1.Shoot) error {
size := resource.MustParse("2Gi")
common.AddOrUpdateRegistryCacheExtension(shoot, []v1alpha3.RegistryCache{
{Upstream: "docker.io", Volume: &v1alpha3.Volume{Size: &size}},
{Upstream: "public.ecr.aws", Volume: &v1alpha3.Volume{Size: &size}},
{Upstream: "ghcr.io", Volume: &v1alpha3.Volume{Size: &size}},
})

return nil
Expand All @@ -69,25 +69,25 @@ var _ = Describe("Registry Cache Extension Tests", Label("cache"), func() {
defer cancel()
common.WaitUntilRegistryCacheConfigurationsAreApplied(ctx, f.Logger, f.ShootFramework.ShootClient)

By("[public.ecr.aws] Verify registry-cache works")
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootFramework.ShootClient, common.PublicEcrAwsNginx1199Image)
By("[ghcr.io] Verify registry-cache works")
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootFramework.ShootClient, common.GithubRegistryNginx1261Image)

By("Remove the public.ecr.aws upstream from the registry-cache extension")
By("Remove the ghcr.io upstream from the registry-cache extension")
ctx, cancel = context.WithTimeout(parentCtx, 10*time.Minute)
defer cancel()
Expect(f.UpdateShoot(ctx, f.Shoot, func(shoot *gardencorev1beta1.Shoot) error {
size := resource.MustParse("2Gi")
common.AddOrUpdateRegistryCacheExtension(shoot, []v1alpha3.RegistryCache{
{Upstream: "docker.io", Volume: &v1alpha3.Volume{Size: &size}},
{Upstream: "public.ecr.aws", Volume: &v1alpha3.Volume{Size: &size}},
})

return nil
})).To(Succeed())

By("[public.ecr.aws] Verify registry configuration is removed")
By("[ghcr.io] Verify registry configuration is removed")
ctx, cancel = context.WithTimeout(parentCtx, 2*time.Minute)
defer cancel()
common.VerifyRegistryCacheConfigurationsAreRemoved(ctx, f.Logger, f.ShootFramework.ShootClient, false, []string{"public.ecr.aws"})
common.VerifyRegistryCacheConfigurationsAreRemoved(ctx, f.Logger, f.ShootFramework.ShootClient, false, []string{"ghcr.io"})

By("Disable the registry-cache extension")
ctx, cancel = context.WithTimeout(parentCtx, 10*time.Minute)
Expand All @@ -98,10 +98,10 @@ var _ = Describe("Registry Cache Extension Tests", Label("cache"), func() {
return nil
})).To(Succeed())

By("[docker.io] Verify registry configuration is removed")
By("[public.ecr.aws] Verify registry configuration is removed")
ctx, cancel = context.WithTimeout(parentCtx, 2*time.Minute)
defer cancel()
common.VerifyRegistryCacheConfigurationsAreRemoved(ctx, f.Logger, f.ShootFramework.ShootClient, true, []string{"docker.io"})
common.VerifyRegistryCacheConfigurationsAreRemoved(ctx, f.Logger, f.ShootFramework.ShootClient, true, []string{"public.ecr.aws"})

By("Delete Shoot")
ctx, cancel = context.WithTimeout(parentCtx, 15*time.Minute)
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/cache/create_enabled_force_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var _ = Describe("Registry Cache Extension Tests", Label("cache"), func() {
shoot := e2e.DefaultShoot("e2e-cache-fd")
size := resource.MustParse("2Gi")
common.AddOrUpdateRegistryCacheExtension(shoot, []v1alpha3.RegistryCache{
{Upstream: "docker.io", Volume: &v1alpha3.Volume{Size: &size}},
{Upstream: "public.ecr.aws", Volume: &v1alpha3.Volume{Size: &size}},
})
f.Shoot = shoot

Expand All @@ -41,7 +41,7 @@ var _ = Describe("Registry Cache Extension Tests", Label("cache"), func() {
common.WaitUntilRegistryCacheConfigurationsAreApplied(ctx, f.Logger, f.ShootFramework.ShootClient)

By("Verify registry-cache works")
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootFramework.ShootClient, common.DockerNginx1230Image)
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootFramework.ShootClient, common.PublicEcrAwsNginx1230Image)

By("Force Delete Shoot")
ctx, cancel = context.WithTimeout(parentCtx, 10*time.Minute)
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/cache/create_enabled_hibernate_reconcile_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var _ = Describe("Registry Cache Extension Tests", Label("cache"), func() {
shoot := e2e.DefaultShoot("e2e-cache-hib")
size := resource.MustParse("2Gi")
common.AddOrUpdateRegistryCacheExtension(shoot, []v1alpha3.RegistryCache{
{Upstream: "docker.io", Volume: &v1alpha3.Volume{Size: &size}},
{Upstream: "public.ecr.aws", Volume: &v1alpha3.Volume{Size: &size}},
})
f.Shoot = shoot

Expand All @@ -43,7 +43,7 @@ var _ = Describe("Registry Cache Extension Tests", Label("cache"), func() {
common.WaitUntilRegistryCacheConfigurationsAreApplied(ctx, f.Logger, f.ShootFramework.ShootClient)

By("Verify registry-cache works")
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootFramework.ShootClient, common.DockerNginx1230Image)
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootFramework.ShootClient, common.PublicEcrAwsNginx1230Image)

By("Hibernate Shoot")
ctx, cancel = context.WithTimeout(parentCtx, 10*time.Minute)
Expand Down
6 changes: 3 additions & 3 deletions test/testmachinery/shoot/enable_disable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var _ = Describe("Shoot registry cache testing", func() {
}

common.AddOrUpdateRegistryCacheExtension(shoot, []v1alpha3.RegistryCache{
{Upstream: "docker.io", Volume: &v1alpha3.Volume{Size: &size}},
{Upstream: "public.ecr.aws", Volume: &v1alpha3.Volume{Size: &size}},
})

return nil
Expand All @@ -50,7 +50,7 @@ var _ = Describe("Shoot registry cache testing", func() {
common.WaitUntilRegistryCacheConfigurationsAreApplied(ctx, f.Logger, f.ShootClient)

By("Verify registry-cache works")
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootClient, common.DockerNginx1230Image)
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootClient, common.PublicEcrAwsNginx1230Image)

By("Disable the registry-cache extension")
ctx, cancel = context.WithTimeout(parentCtx, 10*time.Minute)
Expand All @@ -64,7 +64,7 @@ var _ = Describe("Shoot registry cache testing", func() {
By("Verify registry configuration is removed")
ctx, cancel = context.WithTimeout(parentCtx, 2*time.Minute)
defer cancel()
common.VerifyRegistryCacheConfigurationsAreRemoved(ctx, f.Logger, f.ShootClient, true, []string{"docker.io"})
common.VerifyRegistryCacheConfigurationsAreRemoved(ctx, f.Logger, f.ShootClient, true, []string{"public.ecr.aws"})
}, defaultTestTimeout, framework.WithCAfterTest(func(ctx context.Context) {
if common.HasRegistryCacheExtension(f.Shoot) {
By("Disable the registry-cache extension")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var _ = Describe("Shoot registry cache testing", func() {
}

common.AddOrUpdateRegistryCacheExtension(shoot, []v1alpha3.RegistryCache{
{Upstream: "docker.io", Volume: &v1alpha3.Volume{Size: &size}},
{Upstream: "public.ecr.aws", Volume: &v1alpha3.Volume{Size: &size}},
})

return nil
Expand All @@ -54,7 +54,7 @@ var _ = Describe("Shoot registry cache testing", func() {
By("Verify registry-cache works")
// We are using nginx:1.24.0 as nginx:1.23.0 is already used by the "should enable and disable the registry-cache extension" test.
// Hence, nginx:1.23.0 will be present in the Node.
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootClient, common.DockerNginx1240Image)
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootClient, common.PublicEcrAwsNginx1240Image)

By("Hibernate Shoot")
ctx, cancel = context.WithTimeout(parentCtx, 15*time.Minute)
Expand Down Expand Up @@ -83,7 +83,7 @@ var _ = Describe("Shoot registry cache testing", func() {

By("Verify registry-cache works after wake up")
// We are using nginx:1.25.0 as nginx:1.24.0 is already used above and already present in the Node and in the registry cache.
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootClient, common.DockerNginx1250Image)
common.VerifyRegistryCache(parentCtx, f.Logger, f.ShootClient, common.PublicEcrAwsNginx1250Image)
}, hibernationTestTimeout, framework.WithCAfterTest(func(ctx context.Context) {
if v1beta1helper.HibernationIsEnabled(f.Shoot) {
By("Wake up Shoot")
Expand Down

0 comments on commit 28ea7dd

Please sign in to comment.