Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow blank port for minio client to work with S3 #2996

Merged
merged 1 commit into from
Feb 8, 2020

Conversation

pavanaiyar
Copy link
Contributor

@pavanaiyar pavanaiyar commented Feb 6, 2020

Background

As of current, supplying a minioServiceHost of s3.amazonaws.com with
any port incurs an error.

Per the results of:

testBucket := func(hostPort string) error {
	client, _ := minio.New(hostPort, accessKey, secretKey, false)
	_, err := client.BucketExists(bucket)
	return err
}

for _, endpoint := range []string{
	"s3.amazonaws.com:443",
	"s3.amazonaws.com:80",
	"s3.amazonaws.com:",
	"s3.amazonaws.com",
} {
	fmt.Printf("Endpoint: %s, Error: %v\n", endpoint, testBucket(endpoint))
}
Endpoint: s3.amazonaws.com:443, Error: Get http://s3.amazonaws.com:443/kflow-test/?location=: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x00\x00\x00\x02\x01\x00"
Endpoint: s3.amazonaws.com:80, Error: Head http://s3.amazonaws.com/kflow-test/: 301 response missing Location header
Endpoint: s3.amazonaws.com:, Error: Head http://s3.amazonaws.com/kflow-test/: 301 response missing Location header
Endpoint: s3.amazonaws.com, Error: <nil>

Only the connection without a port specified works.

This change allows passing a blank port to support this.


This change is Reviewable

Background
---
As of current, supplying a minioServiceHost of `s3.amazonaws.com` with
any port incurs an error.

Per the results of:

```
testBucket := func(hostPort string) error {
	client, _ := minio.New(hostPort, accessKey, secretKey, false)
	_, err := client.BucketExists(bucket)
	return err
}

for _, endpoint := range []string{
	"s3.amazonaws.com:443",
	"s3.amazonaws.com:80",
	"s3.amazonaws.com:",
	"s3.amazonaws.com",
} {
	fmt.Printf("Endpoint: %s, Error: %v\n", endpoint, testBucket(endpoint))
}
```

```
Endpoint: s3.amazonaws.com:443, Error: Get http://s3.amazonaws.com:443/kflow-test/?location=: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x00\x00\x00\x02\x01\x00"
Endpoint: s3.amazonaws.com:80, Error: Head http://s3.amazonaws.com/kflow-test/: 301 response missing Location header
Endpoint: s3.amazonaws.com:, Error: Head http://s3.amazonaws.com/kflow-test/: 301 response missing Location header
Endpoint: s3.amazonaws.com, Error: <nil>
```

Only the connection without a port specified works.

This change allows passing a blank port to support this.
@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@k8s-ci-robot
Copy link
Contributor

Hi @pavanaiyar. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@pavanaiyar
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link
Collaborator

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@pavanaiyar
Copy link
Contributor Author

@googlebot I fixed it.

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@pavanaiyar
Copy link
Contributor Author

/assign @IronPan

@pavanaiyar
Copy link
Contributor Author

/assign neuromage

@Ark-kun
Copy link
Contributor

Ark-kun commented Feb 6, 2020

/ok-to-test
/lgtm

with any port incurs an error.
Are you sure those were correct ports for S3?

@pavanaiyar
Copy link
Contributor Author

/retest

@pavanaiyar
Copy link
Contributor Author

@Ark-kun Thanks for reviewing.

Are you sure those were correct ports for S3?

As far as I'm aware it's a regular ol' http/https service that'll default to 80/443. All examples on minio specify the legacy global endpoint s3.amazonaws.com alone, without a port: https://github.com/minio/minio-go/search?l=Go&p=7&q=%22s3.amazonaws.com%22 (although I am not sure why it behaves weirdly when supplying host: or host:port)

@IronPan
Copy link
Member

IronPan commented Feb 8, 2020

/ok-to-test
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: IronPan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pavanaiyar
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit 5c83817 into kubeflow:master Feb 8, 2020
Jeffwan pushed a commit to Jeffwan/pipelines that referenced this pull request Dec 9, 2020
Background
---
As of current, supplying a minioServiceHost of `s3.amazonaws.com` with
any port incurs an error.

Per the results of:

```
testBucket := func(hostPort string) error {
	client, _ := minio.New(hostPort, accessKey, secretKey, false)
	_, err := client.BucketExists(bucket)
	return err
}

for _, endpoint := range []string{
	"s3.amazonaws.com:443",
	"s3.amazonaws.com:80",
	"s3.amazonaws.com:",
	"s3.amazonaws.com",
} {
	fmt.Printf("Endpoint: %s, Error: %v\n", endpoint, testBucket(endpoint))
}
```

```
Endpoint: s3.amazonaws.com:443, Error: Get http://s3.amazonaws.com:443/kflow-test/?location=: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x00\x00\x00\x02\x01\x00"
Endpoint: s3.amazonaws.com:80, Error: Head http://s3.amazonaws.com/kflow-test/: 301 response missing Location header
Endpoint: s3.amazonaws.com:, Error: Head http://s3.amazonaws.com/kflow-test/: 301 response missing Location header
Endpoint: s3.amazonaws.com, Error: <nil>
```

Only the connection without a port specified works.

This change allows passing a blank port to support this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants