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

bucket: Use auto lookup type #1211

Merged
merged 1 commit into from
Aug 31, 2023
Merged

bucket: Use auto lookup type #1211

merged 1 commit into from
Aug 31, 2023

Conversation

zhiyu0729
Copy link
Contributor

@zhiyu0729 zhiyu0729 commented Aug 24, 2023

Resolves #1199
change default lookup type from path to auto, it may cause the previous butcket configuration to be unavailable, but I think auto can cover most cases.

makkes
makkes previously requested changes Aug 24, 2023
Copy link
Member

@makkes makkes left a comment

Choose a reason for hiding this comment

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

Please update the documentation at docs/spec/.

api/v1beta2/bucket_types.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
@zhiyu0729 zhiyu0729 marked this pull request as draft August 24, 2023 08:44
@zhiyu0729 zhiyu0729 force-pushed the lookuptype branch 3 times, most recently from 1b92340 to 239a7c1 Compare August 25, 2023 03:05
@zhiyu0729
Copy link
Contributor Author

Please update the documentation at docs/spec/.

Thank you for your advice

@zhiyu0729 zhiyu0729 requested a review from makkes August 25, 2023 03:13
@zhiyu0729 zhiyu0729 marked this pull request as ready for review August 25, 2023 03:13
@darkowlzz
Copy link
Contributor

Thanks for submitting this fix. I had a short discussion about this with Hidde, who carried the change that introduced the lookup path value in ed6c6eb, a few weeks ago and he wasn't sure why this field was set to BucketLookupPath. I checked the git history to find out when this was introduced and if it worked without setting anything before. The BucketLookupPath lookup value was introduced in v0.22.0, as can be seen from the aforementioned commit. In v0.21.0, it looks like minio.Options didn't had any lookup value, refer https://github.com/fluxcd/source-controller/blob/v0.21.0/controllers/bucket_controller.go#L482 . Also, I couldn't find any mention of "lookup" in the initial PR that the final commit is based on #455.
I also checked if it ever changed on the minio side since source-controller v0.21.0, the default BucketLookupAuto was introduced in 2018 minio/minio-go@ff08912 .

Based on the above, I believe this may have been an unintended change and just using the default would be enough, unless we have good reason to expose this value in Bucket API. As mentioned in #1199, the default auto lookup would fix it for Alibaba Cloud's OSS buckets.

We can also verify with AWS that it continues to work with auto lookup.

@zhiyu0729
Copy link
Contributor Author

I also approve use auto lookup, Amazon S3 is planning to deprecation path type

https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#path-style-access

@darkowlzz
Copy link
Contributor

darkowlzz commented Aug 30, 2023

I did some manual testing by changing the BucketLookup to auto in the code and running source-controller against both S3 and a self-hosted minio server with proper DNS in a subdomain with reverse proxy and it worked for both of them. My minio server was not configured with MINIO_DOMAIN, as mentioned in https://min.io/docs/minio/linux/reference/minio-server/minio-server.html#envvar.MINIO_DOMAIN which would enable DNS style requests. I enabled it and tried using the same source-controller Bucket object and it was able to fetch the bucket content again. I guess it's safe to switch to auto. This may only affect the usage of the bucket name as a subdomain but we don't use it that way.
While setting up the minio bucket, I also noticed that my mc - minio CLI, configuration file had all the targets listed in them with path auto (for non-minio but other S3 compatible servers too), similar to the configurations in https://github.com/minio/mc/blob/master/docs/minio-client-configuration-files.md. Which makes me believe that most of the use cases will be covered with auto.

If we find need to configure it in the future, we can add a new field in the Bucket API to make it configurable.
@zhiyu0729 let's go ahead with auto for now. It'd help to provide some context in the code. Can you update

BucketLookup: minio.BucketLookupPath,
to use auto and also add a comment stating that path lookup is not supported by all the servers, so we let minio client automatically resolve what to use?

@zhiyu0729 zhiyu0729 force-pushed the lookuptype branch 2 times, most recently from cde92a7 to d174bff Compare August 31, 2023 09:54
@zhiyu0729 zhiyu0729 changed the title Feat: support bucket lookup type use auto bucket lookup type Aug 31, 2023
@stefanprodan
Copy link
Member

@zhiyu0729 please rebase with upstream main and force push.

@stefanprodan stefanprodan added the area/bucket Bucket related issues and pull requests label Aug 31, 2023
Signed-off-by: Zhiyu Wang <zhiyuwang.newbis@gmail.com>
@zhiyu0729
Copy link
Contributor Author

I have removed BucketLookup: minio.BucketLookupPath, which will use the default initialization value BucketLookupAuto. I believe that when there are no fields in the API that can be configured, using minio's default initialization value should be enough.

@stefanprodan stefanprodan changed the title use auto bucket lookup type bucket: Use auto lookup type Aug 31, 2023
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @zhiyu0729

@stefanprodan stefanprodan added backport:release/v1.0.x To be backported to release/v1.0.x backport:release/v1.1.x To be backported to release/v1.1.x bug Something isn't working labels Aug 31, 2023
Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

LGTM!
Thanks.

@darkowlzz darkowlzz merged commit 66354a2 into fluxcd:main Aug 31, 2023
13 checks passed
@fluxcdbot
Copy link
Member

Successfully created backport PR for release/v1.0.x:

@fluxcdbot
Copy link
Member

Successfully created backport PR for release/v1.1.x:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bucket Bucket related issues and pull requests backport:release/v1.0.x To be backported to release/v1.0.x backport:release/v1.1.x To be backported to release/v1.1.x bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bucket: generic bucket provider support custom url lookup type
5 participants