Skip to content

Added support to specifiy custom endpoint - #1512

Merged
BrianBland merged 1 commit into
distribution:masterfrom
kmala:master
Mar 10, 2016
Merged

BrianBland merged 1 commit into
distribution:masterfrom
kmala:master

Conversation

@kmala

@kmala kmala commented Mar 5, 2016

Copy link
Copy Markdown

Main purpose of this PR is to enhance the support to provide custom endpoint url which can be used to connect to other S3 compatibly storage services like Minio.

I also want to know if there is any reason preventing from adding the extra condition to create a bucket if it doesn't exist similar to https://github.com/docker/distribution/blob/master/registry/storage/driver/azure/azure.go#L87

@codecov-io

Copy link
Copy Markdown

Current coverage is 52.73%

Merging #1512 into master will decrease coverage by -7.09% as of 2be1b4e

@@            master   #1512   diff @@
======================================
  Files          128     128       
  Stmts        10938   10952    +14
  Branches       884     780   -104
  Methods          0       0       
======================================
- Hit           6544    5775   -769
+ Partial        884     780   -104
- Missed        3510    4397   +887

Review entire Coverage Diff as of 2be1b4e


Uncovered Suggestions

  1. +0.27% via .../driver/s3-aws/s3.go#263...292
  2. +0.20% via registry/registry.go#106...127
  3. +0.17% via registry/registry.go#217...235
  4. See 7 more...

Powered by Codecov. Updated on successful CI builds.

@dmp42

dmp42 commented Mar 7, 2016

Copy link
Copy Markdown
Contributor

cc @BrianBland

Comment thread registry/storage/driver/s3-aws/s3.go Outdated
return nil, fmt.Errorf("Invalid region provided: %v", region)
}

regionEndpoint, ok := parameters["regionendpoint"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should only one of region and regionendpoint be provided? If so, you should change the check for the region parameter above as well as the documentation to reflect this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i want both region and region endpoint to be provided because it is required during creation of s3 client object.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the region value actually used for non-S3 endpoints? It doesn't seem to be the case for Minio

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes Minio requires it to be 'us-east-1'

@kmala

kmala commented Mar 8, 2016

Copy link
Copy Markdown
Author

@BrianBland i had made the changes mentioned.
Also can you answer the question i asked regarding creation of the bucket if it doesn't exist

@BrianBland

Copy link
Copy Markdown
Contributor

@kmala I think the reason for doing this is to minimize the required permissions for running the S3 driver, as listing buckets/creating buckets requires permissions other than operations within a specific bucket in S3. I'm personally not opposed to adding this behavior, but we should either document the permissions required or ignore errors.

@kmala

kmala commented Mar 9, 2016

Copy link
Copy Markdown
Author

@BrianBland Can you review it again and see if something needs to be done

Comment thread docs/storage-drivers/s3.md Outdated

`region`: The name of the aws region in which you would like to store objects (for example `us-east-1`). For a list of regions, you can look at http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html

`regionendpoint`: empty for Amazon S3 or url for S3 compatible APIs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`regionendpoint`: (optional) Endpoint URL for S3 compatible APIs. This should not be provided when using Amazon S3.

@kmala

kmala commented Mar 9, 2016

Copy link
Copy Markdown
Author

@BrianBland added your review comments

Comment thread registry/storage/driver/s3-aws/s3.go Outdated
return nil, fmt.Errorf("No bucket parameter provided")
}

regionEndpoint, ok := parameters["regionendpoint"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I actually just noticed this, but this should follow the pattern of nil checking like the other parameters, otherwise it's possible for fmt.Sprint(regionEndpoint) to return "<nil>". Other than that this looks good to me

@BrianBland

Copy link
Copy Markdown
Contributor

LGTM, thanks for the quick updates

@kmala

kmala commented Mar 10, 2016

Copy link
Copy Markdown
Author

@BrianBland can this be merged

@RichardScothern

Copy link
Copy Markdown

LGTM

BrianBland added a commit that referenced this pull request Mar 10, 2016
Added support to specifiy custom endpoint
@BrianBland
BrianBland merged commit ab49f85 into distribution:master Mar 10, 2016
thaJeztah pushed a commit to thaJeztah/distribution that referenced this pull request Apr 22, 2021
Added support to specifiy custom endpoint
thaJeztah pushed a commit to thaJeztah/distribution that referenced this pull request Jan 19, 2022
Added support to specifiy custom endpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants