mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
fix(ecr): return a proxyEndpoint for the request's region (#4277)
GetAuthorizationToken built the docker login endpoint from the configured default region while the matching repositoryUri used the region of the call, so any non-default region advertised two different registry hosts. Both now resolve the region the same way. Closes #4264 Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
This commit is contained in:
1 parent
766166fc35
commit
4de043cf88
3 files changed
+90
-3
No files matched your search
+9
-2
@@ -160,7 +160,14 @@ public class EcrRegistryManager {
|
||||
return config.services().ecr().tlsUri() && config.tls().enabled();
|
||||
}
|
||||
|
||||
/** Returns the proxy endpoint a docker daemon should log into for any ECR repo. */
|
||||
/**
|
||||
* Returns the proxy endpoint a docker daemon should log into for any ECR repo.
|
||||
*
|
||||
* <p>An ECR registry is regional, so the region in the endpoint is the region of the
|
||||
* calling request, matching the one in the {@link #getRepositoryUri} of every repository
|
||||
* in that registry. A client logs in to this endpoint and then pushes to those URIs, so
|
||||
* the two must name the same host.
|
||||
*/
|
||||
public String getProxyEndpoint() {
|
||||
if (tlsUriEnabled()) {
|
||||
String host = "path".equalsIgnoreCase(config.services().ecr().uriStyle())
|
||||
@@ -171,7 +178,7 @@ public class EcrRegistryManager {
|
||||
}
|
||||
String scheme = config.services().ecr().tlsEnabled() ? "https" : "http";
|
||||
return scheme + "://" + regionResolver.getAccountId() + ".dkr.ecr."
|
||||
+ regionResolver.getDefaultRegion() + ".localhost:" + config.port();
|
||||
+ regionResolver.getRegion() + ".localhost:" + config.port();
|
||||
}
|
||||
|
||||
/** Returns the effective registry port. Stable across calls once {@link #ensureStarted} runs. */
|
||||
|
||||
Reference in new issue
Block a user