From c8c8ed269dc8280efb853f3f87acbf625c3b42a6 Mon Sep 17 00:00:00 2001 From: Flavian Missi Date: Wed, 6 Nov 2024 15:37:33 +0100 Subject: [PATCH] wip: support new aws regions without code changes --- pkg/storage/s3/s3.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/storage/s3/s3.go b/pkg/storage/s3/s3.go index 54ea41c15..b97b15362 100644 --- a/pkg/storage/s3/s3.go +++ b/pkg/storage/s3/s3.go @@ -353,6 +353,13 @@ func (d *driver) ConfigEnv() (envs envvar.List, err error) { if len(d.Config.RegionEndpoint) != 0 { envs = append(envs, envvar.EnvVar{Name: "REGISTRY_STORAGE_S3_REGIONENDPOINT", Value: d.Config.RegionEndpoint}) + } else { + // attempt to bypass validation error in distribution as a means + // to support new aws regions without requiring aws-sdk-go upgrades. + regionEndpoint, _ := d.endpointsResolver.EndpointFor("s3", d.Config.Region) + if regionEndpoint != "" { + envs = append(envs, envvar.EnvVar{Name: "REGISTRY_STORAGE_S3_REGIONENDPOINT", Value: regionEndpoint}) + } } if len(d.Config.KeyID) != 0 {