@@ -409,12 +409,31 @@ func (d *driver) ConfigEnv() (envs envvar.List, err error) {
409
409
envs = append (envs , envvar.EnvVar {Name : "REGISTRY_STORAGE_S3_KEYID" , Value : d .Config .KeyID })
410
410
}
411
411
412
+ // virtualHostedStyle tells the registry to use urls in the form of
413
+ // bucket-name.s3-endpoint.etc.
414
+ // the forcePathStyle setting was introduced to control the same
415
+ // behaviour, but it's named after the opposite setting (path style
416
+ // instead of virtual hosted style):
417
+ // s3-endpoint.etc/bucket-name.
418
+ // the PR that introduced virtual hosted style to upstream distribution
419
+ // was never merged: https://github.com/distribution/distribution/pull/3131/files
420
+ // and it's only present in our fork:
421
+ // * https://github.com/openshift/docker-distribution/commit/e33e2357eb705f2ed7481e3510fceedb01a95bb6
422
+ // * https://github.com/openshift/docker-distribution/commit/063574e3222f00556ec5113dddca9a0ac28ed4cb
423
+ // the upstream introduction of the force path style config happened in:
424
+ // * https://github.com/distribution/distribution/commit/15de9e21bad774b24e48a46d9238a5714e7ceb6c
425
+ // and it's also present in our fork.
426
+ // TODO: drop commits from openshift/docker-distribution during next rebase:
427
+ // * https://github.com/openshift/docker-distribution/commit/e33e2357eb705f2ed7481e3510fceedb01a95bb6
428
+ // * https://github.com/openshift/docker-distribution/commit/063574e3222f00556ec5113dddca9a0ac28ed4cb
429
+ // Jira tracker: https://issues.redhat.com/browse/IR-470
430
+ forcePathStyle := ! d .Config .VirtualHostedStyle
412
431
envs = append (envs ,
413
432
envvar.EnvVar {Name : "REGISTRY_STORAGE" , Value : "s3" },
414
433
envvar.EnvVar {Name : "REGISTRY_STORAGE_S3_BUCKET" , Value : d .Config .Bucket },
415
434
envvar.EnvVar {Name : "REGISTRY_STORAGE_S3_REGION" , Value : d .Config .Region },
416
435
envvar.EnvVar {Name : "REGISTRY_STORAGE_S3_ENCRYPT" , Value : d .Config .Encrypt },
417
- envvar.EnvVar {Name : "REGISTRY_STORAGE_S3_VIRTUALHOSTEDSTYLE " , Value : d . Config . VirtualHostedStyle },
436
+ envvar.EnvVar {Name : "REGISTRY_STORAGE_S3_FORCEPATHSTYLE " , Value : forcePathStyle },
418
437
envvar.EnvVar {Name : "REGISTRY_STORAGE_S3_CREDENTIALSCONFIGPATH" , Value : filepath .Join (imageRegistrySecretMountpoint , imageRegistrySecretDataKey )},
419
438
)
420
439
0 commit comments